blob: 46629f59584687321c3eb4ce1096a16c5c8c837e [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"
Mingyao Yang98d1cc82014-05-15 17:02:16 -070018#include "entrypoints/entrypoint_utils-inl.h"
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080019#include "class_linker-inl.h"
Ian Rogersfa46d3e2013-05-15 00:16:04 -070020#include "dex_file-inl.h"
Ian Rogers7655f292013-07-29 11:07:13 -070021#include "gc/accounting/card_table-inl.h"
Brian Carlstromea46f952013-07-30 01:26:50 -070022#include "mirror/art_method-inl.h"
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080023#include "mirror/object_array-inl.h"
Ian Rogers4f6ad8a2013-03-18 15:27:28 -070024#include "mirror/object-inl.h"
Ian Rogers57b86d42012-03-27 16:05:41 -070025
26namespace art {
27
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080028extern "C" mirror::Class* artInitializeStaticStorageFromCode(uint32_t type_idx,
Ian Rogers1d8cdbc2014-09-22 22:51:09 -070029 Thread* self)
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 Rogers1d8cdbc2014-09-22 22:51:09 -070034 ScopedQuickEntrypointChecks sqec(self);
Vladimir Marko5ea536a2015-04-20 20:11:30 +010035 auto* caller = GetCalleeSaveMethodCaller(self, Runtime::kRefsOnly);
36 return ResolveVerifyAndClinit(type_idx, caller, self, true, false);
Ian Rogers57b86d42012-03-27 16:05:41 -070037}
38
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080039extern "C" mirror::Class* artInitializeTypeFromCode(uint32_t type_idx,
Ian Rogers1d8cdbc2014-09-22 22:51:09 -070040 Thread* self)
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 Rogers1d8cdbc2014-09-22 22:51:09 -070043 ScopedQuickEntrypointChecks sqec(self);
Vladimir Marko5ea536a2015-04-20 20:11:30 +010044 auto* caller = GetCalleeSaveMethodCaller(self, Runtime::kRefsOnly);
45 return ResolveVerifyAndClinit(type_idx, caller, self, false, false);
Ian Rogers57b86d42012-03-27 16:05:41 -070046}
47
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080048extern "C" mirror::Class* artInitializeTypeAndVerifyAccessFromCode(uint32_t type_idx,
Ian Rogers1d8cdbc2014-09-22 22:51:09 -070049 Thread* self)
50 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 Rogers1d8cdbc2014-09-22 22:51:09 -070053 ScopedQuickEntrypointChecks sqec(self);
Vladimir Marko5ea536a2015-04-20 20:11:30 +010054 auto* caller = GetCalleeSaveMethodCaller(self, Runtime::kRefsOnly);
55 return ResolveVerifyAndClinit(type_idx, caller, self, false, true);
Ian Rogers57b86d42012-03-27 16:05:41 -070056}
57
Andreas Gampe1cc7dba2014-12-17 18:43:01 -080058extern "C" mirror::String* artResolveStringFromCode(int32_t string_idx,
Ian Rogers1d8cdbc2014-09-22 22:51:09 -070059 Thread* self)
Ian Rogersb726dcb2012-09-05 08:57:23 -070060 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Ian Rogers1d8cdbc2014-09-22 22:51:09 -070061 ScopedQuickEntrypointChecks sqec(self);
Vladimir Marko5ea536a2015-04-20 20:11:30 +010062 auto* caller = GetCalleeSaveMethodCaller(self, Runtime::kRefsOnly);
63 return ResolveStringFromCode(caller, string_idx);
Ian Rogers57b86d42012-03-27 16:05:41 -070064}
65
66} // namespace art