blob: 6811d20c974fb1019e471bc060983e08078853f6 [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 Rogers4f6ad8a2013-03-18 15:27:28 -070021#include "mirror/object-inl.h"
Ian Rogers57b86d42012-03-27 16:05:41 -070022#include "runtime_support.h"
23
24namespace art {
25
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080026extern "C" mirror::Class* artInitializeStaticStorageFromCode(uint32_t type_idx,
27 const mirror::AbstractMethod* referrer,
28 Thread* self,
29 mirror::AbstractMethod** sp)
Ian Rogersb726dcb2012-09-05 08:57:23 -070030 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Ian Rogerse2645d32012-04-11 14:42:42 -070031 // Called to ensure static storage base is initialized for direct static field reads and writes.
32 // A class may be accessing another class' fields when it doesn't have access, as access has been
33 // given by inheritance.
Ian Rogers57b86d42012-03-27 16:05:41 -070034 FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsOnly);
Ian Rogerse2645d32012-04-11 14:42:42 -070035 return ResolveVerifyAndClinit(type_idx, referrer, self, true, false);
Ian Rogers57b86d42012-03-27 16:05:41 -070036}
37
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080038extern "C" mirror::Class* artInitializeTypeFromCode(uint32_t type_idx,
39 const mirror::AbstractMethod* referrer,
40 Thread* self, mirror::AbstractMethod** sp)
Ian Rogersb726dcb2012-09-05 08:57:23 -070041 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Ian Rogerse2645d32012-04-11 14:42:42 -070042 // Called when method->dex_cache_resolved_types_[] misses.
Ian Rogers57b86d42012-03-27 16:05:41 -070043 FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsOnly);
44 return ResolveVerifyAndClinit(type_idx, referrer, self, false, false);
45}
46
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080047extern "C" mirror::Class* artInitializeTypeAndVerifyAccessFromCode(uint32_t type_idx,
48 const mirror::AbstractMethod* referrer,
49 Thread* self,
50 mirror::AbstractMethod** sp)
Ian Rogersb726dcb2012-09-05 08:57:23 -070051 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Ian Rogers57b86d42012-03-27 16:05:41 -070052 // 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 -070053 // unpopulated.
Ian Rogers57b86d42012-03-27 16:05:41 -070054 FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsOnly);
55 return ResolveVerifyAndClinit(type_idx, referrer, self, false, true);
56}
57
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080058extern "C" mirror::String* artResolveStringFromCode(mirror::AbstractMethod* referrer,
59 int32_t string_idx,
60 Thread* self, mirror::AbstractMethod** sp)
Ian Rogersb726dcb2012-09-05 08:57:23 -070061 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Ian Rogers57b86d42012-03-27 16:05:41 -070062 FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsOnly);
63 return ResolveStringFromCode(referrer, string_idx);
64}
65
66} // namespace art