Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 1 | /* |
| 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 | |
Mathieu Chartier | e401d14 | 2015-04-22 13:56:20 -0700 | [diff] [blame] | 17 | #include "art_method-inl.h" |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 18 | #include "callee_save_frame.h" |
Mingyao Yang | 98d1cc8 | 2014-05-15 17:02:16 -0700 | [diff] [blame] | 19 | #include "entrypoints/entrypoint_utils-inl.h" |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 20 | #include "class_linker-inl.h" |
Ian Rogers | fa46d3e | 2013-05-15 00:16:04 -0700 | [diff] [blame] | 21 | #include "dex_file-inl.h" |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 22 | #include "gc/accounting/card_table-inl.h" |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 23 | #include "mirror/object_array-inl.h" |
Ian Rogers | 4f6ad8a | 2013-03-18 15:27:28 -0700 | [diff] [blame] | 24 | #include "mirror/object-inl.h" |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 25 | |
| 26 | namespace art { |
| 27 | |
Nicolas Geoffray | 7ea6a17 | 2015-05-19 18:58:54 +0100 | [diff] [blame] | 28 | extern "C" mirror::Class* artInitializeStaticStorageFromCode(uint32_t type_idx, Thread* self) |
Mathieu Chartier | 9044347 | 2015-07-16 20:32:27 -0700 | [diff] [blame] | 29 | SHARED_REQUIRES(Locks::mutator_lock_) { |
Ian Rogers | e2645d3 | 2012-04-11 14:42:42 -0700 | [diff] [blame] | 30 | // 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 Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 33 | ScopedQuickEntrypointChecks sqec(self); |
Vladimir Marko | fd36f1f | 2016-08-03 18:49:58 +0100 | [diff] [blame] | 34 | auto* caller = GetCalleeSaveMethodCaller(self, Runtime::kSaveRefsOnly); |
Vladimir Marko | 5ea536a | 2015-04-20 20:11:30 +0100 | [diff] [blame] | 35 | return ResolveVerifyAndClinit(type_idx, caller, self, true, false); |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 36 | } |
| 37 | |
Nicolas Geoffray | 7ea6a17 | 2015-05-19 18:58:54 +0100 | [diff] [blame] | 38 | extern "C" mirror::Class* artInitializeTypeFromCode(uint32_t type_idx, Thread* self) |
Mathieu Chartier | 9044347 | 2015-07-16 20:32:27 -0700 | [diff] [blame] | 39 | SHARED_REQUIRES(Locks::mutator_lock_) { |
Ian Rogers | e2645d3 | 2012-04-11 14:42:42 -0700 | [diff] [blame] | 40 | // Called when method->dex_cache_resolved_types_[] misses. |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 41 | ScopedQuickEntrypointChecks sqec(self); |
Vladimir Marko | fd36f1f | 2016-08-03 18:49:58 +0100 | [diff] [blame] | 42 | auto* caller = GetCalleeSaveMethodCaller(self, Runtime::kSaveRefsOnly); |
Vladimir Marko | 5ea536a | 2015-04-20 20:11:30 +0100 | [diff] [blame] | 43 | return ResolveVerifyAndClinit(type_idx, caller, self, false, false); |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 44 | } |
| 45 | |
Nicolas Geoffray | 7ea6a17 | 2015-05-19 18:58:54 +0100 | [diff] [blame] | 46 | extern "C" mirror::Class* artInitializeTypeAndVerifyAccessFromCode(uint32_t type_idx, Thread* self) |
Mathieu Chartier | 9044347 | 2015-07-16 20:32:27 -0700 | [diff] [blame] | 47 | SHARED_REQUIRES(Locks::mutator_lock_) { |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 48 | // Called when caller isn't guaranteed to have access to a type and the dex cache may be |
Ian Rogers | e2645d3 | 2012-04-11 14:42:42 -0700 | [diff] [blame] | 49 | // unpopulated. |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 50 | ScopedQuickEntrypointChecks sqec(self); |
Vladimir Marko | fd36f1f | 2016-08-03 18:49:58 +0100 | [diff] [blame] | 51 | auto* caller = GetCalleeSaveMethodCaller(self, Runtime::kSaveRefsOnly); |
Vladimir Marko | 5ea536a | 2015-04-20 20:11:30 +0100 | [diff] [blame] | 52 | return ResolveVerifyAndClinit(type_idx, caller, self, false, true); |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 53 | } |
| 54 | |
Nicolas Geoffray | 7ea6a17 | 2015-05-19 18:58:54 +0100 | [diff] [blame] | 55 | extern "C" mirror::String* artResolveStringFromCode(int32_t string_idx, Thread* self) |
Mathieu Chartier | 9044347 | 2015-07-16 20:32:27 -0700 | [diff] [blame] | 56 | SHARED_REQUIRES(Locks::mutator_lock_) { |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 57 | ScopedQuickEntrypointChecks sqec(self); |
Vladimir Marko | fd36f1f | 2016-08-03 18:49:58 +0100 | [diff] [blame] | 58 | auto* caller = GetCalleeSaveMethodCaller(self, Runtime::kSaveRefsOnly); |
Vladimir Marko | 5ea536a | 2015-04-20 20:11:30 +0100 | [diff] [blame] | 59 | return ResolveStringFromCode(caller, string_idx); |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 60 | } |
| 61 | |
| 62 | } // namespace art |