/*
 * Copyright (C) 2014 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef ART_RUNTIME_GC_ROOT_INL_H_
#define ART_RUNTIME_GC_ROOT_INL_H_

#include "gc_root.h"

#include <sstream>

#include "obj_ptr-inl.h"
#include "read_barrier-inl.h"

namespace art HIDDEN {

template<class MirrorType>
template<ReadBarrierOption kReadBarrierOption>
inline MirrorType* GcRoot<MirrorType>::Read(GcRootSource* gc_root_source) const {
  return down_cast<MirrorType*>(
      ReadBarrier::BarrierForRoot<mirror::Object, kReadBarrierOption>(&root_, gc_root_source));
}

template<class MirrorType>
inline GcRoot<MirrorType>::GcRoot(mirror::CompressedReference<mirror::Object> ref)
    : root_(ref) { }

template<class MirrorType>
inline GcRoot<MirrorType>::GcRoot(MirrorType* ref)
    : GcRoot(mirror::CompressedReference<mirror::Object>::FromMirrorPtr(ref)) { }

template<class MirrorType>
inline GcRoot<MirrorType>::GcRoot(ObjPtr<MirrorType> ref)
    : GcRoot(ref.Ptr()) { }

inline std::string RootInfo::ToString() const {
  std::ostringstream oss;
  Describe(oss);
  return oss.str();
}

}  // namespace art
#endif  // ART_RUNTIME_GC_ROOT_INL_H_
