• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
17 #include "art_method-inl.h"
18 #include "callee_save_frame.h"
19 #include "entrypoints/entrypoint_utils-inl.h"
20 #include "class_linker-inl.h"
21 #include "dex_file-inl.h"
22 #include "gc/accounting/card_table-inl.h"
23 #include "mirror/object_array-inl.h"
24 #include "mirror/object-inl.h"
25 
26 namespace art {
27 
artInitializeStaticStorageFromCode(uint32_t type_idx,Thread * self)28 extern "C" mirror::Class* artInitializeStaticStorageFromCode(uint32_t type_idx,
29                                                              Thread* self)
30     SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
31   // 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.
34   ScopedQuickEntrypointChecks sqec(self);
35   auto* caller = GetCalleeSaveMethodCaller(self, Runtime::kRefsOnly);
36   return ResolveVerifyAndClinit(type_idx, caller, self, true, false);
37 }
38 
artInitializeTypeFromCode(uint32_t type_idx,Thread * self)39 extern "C" mirror::Class* artInitializeTypeFromCode(uint32_t type_idx,
40                                                     Thread* self)
41     SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
42   // Called when method->dex_cache_resolved_types_[] misses.
43   ScopedQuickEntrypointChecks sqec(self);
44   auto* caller = GetCalleeSaveMethodCaller(self, Runtime::kRefsOnly);
45   return ResolveVerifyAndClinit(type_idx, caller, self, false, false);
46 }
47 
artInitializeTypeAndVerifyAccessFromCode(uint32_t type_idx,Thread * self)48 extern "C" mirror::Class* artInitializeTypeAndVerifyAccessFromCode(uint32_t type_idx,
49                                                                    Thread* self)
50     SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
51   // Called when caller isn't guaranteed to have access to a type and the dex cache may be
52   // unpopulated.
53   ScopedQuickEntrypointChecks sqec(self);
54   auto* caller = GetCalleeSaveMethodCaller(self, Runtime::kRefsOnly);
55   return ResolveVerifyAndClinit(type_idx, caller, self, false, true);
56 }
57 
artResolveStringFromCode(int32_t string_idx,Thread * self)58 extern "C" mirror::String* artResolveStringFromCode(int32_t string_idx,
59                                                     Thread* self)
60     SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
61   ScopedQuickEntrypointChecks sqec(self);
62   auto* caller = GetCalleeSaveMethodCaller(self, Runtime::kRefsOnly);
63   return ResolveStringFromCode(caller, string_idx);
64 }
65 
66 }  // namespace art
67