blob: 98cce55c7b988975e1873cea7229cd3790456ac3 [file] [log] [blame]
Ian Rogers57b86d42012-03-27 16:05:41 -07001/*
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 "runtime_support.h"
19
20namespace art {
21
22extern "C" Class* artInitializeStaticStorageFromCode(uint32_t type_idx, const Method* referrer,
Ian Rogers00f7d0e2012-07-19 15:28:27 -070023 Thread* self, Method** sp)
Ian Rogersb726dcb2012-09-05 08:57:23 -070024 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Ian Rogerse2645d32012-04-11 14:42:42 -070025 // Called to ensure static storage base is initialized for direct static field reads and writes.
26 // A class may be accessing another class' fields when it doesn't have access, as access has been
27 // given by inheritance.
Ian Rogers57b86d42012-03-27 16:05:41 -070028 FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsOnly);
Ian Rogerse2645d32012-04-11 14:42:42 -070029 return ResolveVerifyAndClinit(type_idx, referrer, self, true, false);
Ian Rogers57b86d42012-03-27 16:05:41 -070030}
31
32extern "C" Class* artInitializeTypeFromCode(uint32_t type_idx, const Method* referrer, Thread* self,
Ian Rogers00f7d0e2012-07-19 15:28:27 -070033 Method** sp)
Ian Rogersb726dcb2012-09-05 08:57:23 -070034 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Ian Rogerse2645d32012-04-11 14:42:42 -070035 // Called when method->dex_cache_resolved_types_[] misses.
Ian Rogers57b86d42012-03-27 16:05:41 -070036 FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsOnly);
37 return ResolveVerifyAndClinit(type_idx, referrer, self, false, false);
38}
39
40extern "C" Class* artInitializeTypeAndVerifyAccessFromCode(uint32_t type_idx,
41 const Method* referrer, Thread* self,
Ian Rogers00f7d0e2012-07-19 15:28:27 -070042 Method** sp)
Ian Rogersb726dcb2012-09-05 08:57:23 -070043 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Ian Rogers57b86d42012-03-27 16:05:41 -070044 // Called when caller isn't guaranteed to have access to a type and the dex cache may be
Ian Rogerse2645d32012-04-11 14:42:42 -070045 // unpopulated.
Ian Rogers57b86d42012-03-27 16:05:41 -070046 FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsOnly);
47 return ResolveVerifyAndClinit(type_idx, referrer, self, false, true);
48}
49
50extern "C" String* artResolveStringFromCode(Method* referrer, int32_t string_idx,
Ian Rogers00f7d0e2012-07-19 15:28:27 -070051 Thread* self, Method** sp)
Ian Rogersb726dcb2012-09-05 08:57:23 -070052 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Ian Rogers57b86d42012-03-27 16:05:41 -070053 FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsOnly);
54 return ResolveStringFromCode(referrer, string_idx);
55}
56
57} // namespace art