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 "art_method-inl.h" 18#include "callee_save_frame.h" 19#include "entrypoints/entrypoint_utils-inl.h" 20#include "class_linker-inl.h" 21#include "dex_file-inl.h" 22#include "gc/accounting/card_table-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, Thread* self) 29 SHARED_REQUIRES(Locks::mutator_lock_) { 30 // Called to ensure static storage base is initialized for direct static field reads and writes. 31 // A class may be accessing another class' fields when it doesn't have access, as access has been 32 // given by inheritance. 33 ScopedQuickEntrypointChecks sqec(self); 34 auto* caller = GetCalleeSaveMethodCaller(self, Runtime::kRefsOnly); 35 return ResolveVerifyAndClinit(type_idx, caller, self, true, false); 36} 37 38extern "C" mirror::Class* artInitializeTypeFromCode(uint32_t type_idx, Thread* self) 39 SHARED_REQUIRES(Locks::mutator_lock_) { 40 // Called when method->dex_cache_resolved_types_[] misses. 41 ScopedQuickEntrypointChecks sqec(self); 42 auto* caller = GetCalleeSaveMethodCaller(self, Runtime::kRefsOnly); 43 return ResolveVerifyAndClinit(type_idx, caller, self, false, false); 44} 45 46extern "C" mirror::Class* artInitializeTypeAndVerifyAccessFromCode(uint32_t type_idx, Thread* self) 47 SHARED_REQUIRES(Locks::mutator_lock_) { 48 // Called when caller isn't guaranteed to have access to a type and the dex cache may be 49 // unpopulated. 50 ScopedQuickEntrypointChecks sqec(self); 51 auto* caller = GetCalleeSaveMethodCaller(self, Runtime::kRefsOnly); 52 return ResolveVerifyAndClinit(type_idx, caller, self, false, true); 53} 54 55extern "C" mirror::String* artResolveStringFromCode(int32_t string_idx, Thread* self) 56 SHARED_REQUIRES(Locks::mutator_lock_) { 57 ScopedQuickEntrypointChecks sqec(self); 58 auto* caller = GetCalleeSaveMethodCaller(self, Runtime::kRefsOnly); 59 return ResolveStringFromCode(caller, string_idx); 60} 61 62} // namespace art 63