blob: da15917ed842fa4a533e96c54b7fdeb1118d7b43 [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"
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080018#include "class_linker-inl.h"
19#include "mirror/abstract_method-inl.h"
20#include "mirror/object_array-inl.h"
Ian Rogers57b86d42012-03-27 16:05:41 -070021#include "runtime_support.h"
22
23namespace art {
24
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080025extern "C" mirror::Class* artInitializeStaticStorageFromCode(uint32_t type_idx,
26 const mirror::AbstractMethod* referrer,
27 Thread* self,
28 mirror::AbstractMethod** sp)
Ian Rogersb726dcb2012-09-05 08:57:23 -070029 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Ian Rogerse2645d32012-04-11 14:42:42 -070030 // 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.
Ian Rogers57b86d42012-03-27 16:05:41 -070033 FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsOnly);
Ian Rogerse2645d32012-04-11 14:42:42 -070034 return ResolveVerifyAndClinit(type_idx, referrer, self, true, false);
Ian Rogers57b86d42012-03-27 16:05:41 -070035}
36
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080037extern "C" mirror::Class* artInitializeTypeFromCode(uint32_t type_idx,
38 const mirror::AbstractMethod* referrer,
39 Thread* self, mirror::AbstractMethod** sp)
Ian Rogersb726dcb2012-09-05 08:57:23 -070040 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Ian Rogerse2645d32012-04-11 14:42:42 -070041 // Called when method->dex_cache_resolved_types_[] misses.
Ian Rogers57b86d42012-03-27 16:05:41 -070042 FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsOnly);
43 return ResolveVerifyAndClinit(type_idx, referrer, self, false, false);
44}
45
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080046extern "C" mirror::Class* artInitializeTypeAndVerifyAccessFromCode(uint32_t type_idx,
47 const mirror::AbstractMethod* referrer,
48 Thread* self,
49 mirror::AbstractMethod** sp)
Ian Rogersb726dcb2012-09-05 08:57:23 -070050 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Ian Rogers57b86d42012-03-27 16:05:41 -070051 // 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 -070052 // unpopulated.
Ian Rogers57b86d42012-03-27 16:05:41 -070053 FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsOnly);
54 return ResolveVerifyAndClinit(type_idx, referrer, self, false, true);
55}
56
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080057extern "C" mirror::String* artResolveStringFromCode(mirror::AbstractMethod* referrer,
58 int32_t string_idx,
59 Thread* self, mirror::AbstractMethod** sp)
Ian Rogersb726dcb2012-09-05 08:57:23 -070060 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Ian Rogers57b86d42012-03-27 16:05:41 -070061 FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsOnly);
62 return ResolveStringFromCode(referrer, string_idx);
63}
64
65} // namespace art