quick_dexcache_entrypoints.cc revision 1d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5
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 "callee_save_frame.h"
18#include "entrypoints/entrypoint_utils-inl.h"
19#include "class_linker-inl.h"
20#include "dex_file-inl.h"
21#include "gc/accounting/card_table-inl.h"
22#include "mirror/art_method-inl.h"
23#include "mirror/object_array-inl.h"
24#include "mirror/object-inl.h"
25
26namespace art {
27
28extern "C" mirror::Class* artInitializeStaticStorageFromCode(uint32_t type_idx,
29                                                             mirror::ArtMethod* referrer,
30                                                             Thread* self)
31    SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
32  // Called to ensure static storage base is initialized for direct static field reads and writes.
33  // A class may be accessing another class' fields when it doesn't have access, as access has been
34  // given by inheritance.
35  ScopedQuickEntrypointChecks sqec(self);
36  return ResolveVerifyAndClinit(type_idx, referrer, self, true, false);
37}
38
39extern "C" mirror::Class* artInitializeTypeFromCode(uint32_t type_idx,
40                                                    mirror::ArtMethod* referrer,
41                                                    Thread* self)
42    SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
43  // Called when method->dex_cache_resolved_types_[] misses.
44  ScopedQuickEntrypointChecks sqec(self);
45  return ResolveVerifyAndClinit(type_idx, referrer, self, false, false);
46}
47
48extern "C" mirror::Class* artInitializeTypeAndVerifyAccessFromCode(uint32_t type_idx,
49                                                                   mirror::ArtMethod* referrer,
50                                                                   Thread* self)
51    SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
52  // Called when caller isn't guaranteed to have access to a type and the dex cache may be
53  // unpopulated.
54  ScopedQuickEntrypointChecks sqec(self);
55  return ResolveVerifyAndClinit(type_idx, referrer, self, false, true);
56}
57
58extern "C" mirror::String* artResolveStringFromCode(mirror::ArtMethod* referrer,
59                                                    int32_t string_idx,
60                                                    Thread* self)
61    SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
62  ScopedQuickEntrypointChecks sqec(self);
63  return ResolveStringFromCode(referrer, string_idx);
64}
65
66}  // namespace art
67