quick_dexcache_entrypoints.cc revision 7655f29fabc0a12765de828914a18314382e5a35
1/* 2 * Copyright (C) 2012 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17#include "callee_save_frame.h" 18#include "entrypoints/entrypoint_utils.h" 19#include "class_linker-inl.h" 20#include "dex_file-inl.h" 21#include "gc/accounting/card_table-inl.h" 22#include "mirror/abstract_method-inl.h" 23#include "mirror/object_array-inl.h" 24#include "mirror/object-inl.h" 25 26namespace art { 27 28extern "C" mirror::Class* artInitializeStaticStorageFromCode(uint32_t type_idx, 29 const mirror::AbstractMethod* referrer, 30 Thread* self, 31 mirror::AbstractMethod** sp) 32 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { 33 // Called to ensure static storage base is initialized for direct static field reads and writes. 34 // A class may be accessing another class' fields when it doesn't have access, as access has been 35 // given by inheritance. 36 FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsOnly); 37 return ResolveVerifyAndClinit(type_idx, referrer, self, true, false); 38} 39 40extern "C" mirror::Class* artInitializeTypeFromCode(uint32_t type_idx, 41 const mirror::AbstractMethod* referrer, 42 Thread* self, mirror::AbstractMethod** sp) 43 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { 44 // Called when method->dex_cache_resolved_types_[] misses. 45 FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsOnly); 46 return ResolveVerifyAndClinit(type_idx, referrer, self, false, false); 47} 48 49extern "C" mirror::Class* artInitializeTypeAndVerifyAccessFromCode(uint32_t type_idx, 50 const mirror::AbstractMethod* referrer, 51 Thread* self, 52 mirror::AbstractMethod** sp) 53 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { 54 // Called when caller isn't guaranteed to have access to a type and the dex cache may be 55 // unpopulated. 56 FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsOnly); 57 return ResolveVerifyAndClinit(type_idx, referrer, self, false, true); 58} 59 60extern "C" mirror::String* artResolveStringFromCode(mirror::AbstractMethod* referrer, 61 int32_t string_idx, 62 Thread* self, mirror::AbstractMethod** sp) 63 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { 64 FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsOnly); 65 return ResolveStringFromCode(referrer, string_idx); 66} 67 68} // namespace art 69