/*
 * Copyright (C) 2017 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.
 */

#include "call_site.h"

#include "class-inl.h"
#include "class_root.h"
#include "obj_ptr-inl.h"

namespace art {
namespace mirror {

mirror::CallSite* CallSite::Create(Thread* const self, Handle<MethodHandle> target) {
  ObjPtr<mirror::CallSite> cs =
      ObjPtr<CallSite>::DownCast(GetClassRoot<CallSite>()->AllocObject(self));
  CHECK(!Runtime::Current()->IsActiveTransaction());
  cs->SetFieldObject<false>(TargetOffset(), target.Get());
  return cs.Ptr();
}

}  // namespace mirror
}  // namespace art
