blob: 10c7930f3ca295f27e913dbeffa2abe03eec07fa [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
Mathieu Chartier66f19252012-09-18 08:57:04 -070022extern "C" Class* artInitializeStaticStorageFromCode(uint32_t type_idx, const AbstractMethod* referrer,
23 Thread* self, AbstractMethod** 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
Mathieu Chartier66f19252012-09-18 08:57:04 -070032extern "C" Class* artInitializeTypeFromCode(uint32_t type_idx, const AbstractMethod* referrer,
33 Thread* self, AbstractMethod** 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,
Mathieu Chartier66f19252012-09-18 08:57:04 -070041 const AbstractMethod* referrer,
42 Thread* self,
43 AbstractMethod** sp)
Ian Rogersb726dcb2012-09-05 08:57:23 -070044 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Ian Rogers57b86d42012-03-27 16:05:41 -070045 // 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 -070046 // unpopulated.
Ian Rogers57b86d42012-03-27 16:05:41 -070047 FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsOnly);
48 return ResolveVerifyAndClinit(type_idx, referrer, self, false, true);
49}
50
Mathieu Chartier66f19252012-09-18 08:57:04 -070051extern "C" String* artResolveStringFromCode(AbstractMethod* referrer, int32_t string_idx,
52 Thread* self, AbstractMethod** sp)
Ian Rogersb726dcb2012-09-05 08:57:23 -070053 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Ian Rogers57b86d42012-03-27 16:05:41 -070054 FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsOnly);
55 return ResolveStringFromCode(referrer, string_idx);
56}
57
58} // namespace art