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 #ifndef ART_RUNTIME_ENTRYPOINTS_RUNTIME_ASM_ENTRYPOINTS_H_
18 #define ART_RUNTIME_ENTRYPOINTS_RUNTIME_ASM_ENTRYPOINTS_H_
19 
20 #include "deoptimization_kind.h"
21 
22 #include "base/macros.h"
23 #include "jni.h"
24 
25 namespace art HIDDEN {
26 
27 class ArtMethod;
28 class Thread;
29 
30 extern "C" void* art_jni_dlsym_lookup_stub(JNIEnv*, jobject);
GetJniDlsymLookupStub()31 static inline const void* GetJniDlsymLookupStub() {
32   return reinterpret_cast<const void*>(art_jni_dlsym_lookup_stub);
33 }
34 
35 extern "C" void* art_jni_dlsym_lookup_critical_stub(JNIEnv*, jobject);
GetJniDlsymLookupCriticalStub()36 static inline const void* GetJniDlsymLookupCriticalStub() {
37   return reinterpret_cast<const void*>(art_jni_dlsym_lookup_critical_stub);
38 }
39 
40 // Return the address of quick stub code for handling IMT conflicts.
41 extern "C" void art_quick_imt_conflict_trampoline(ArtMethod*);
GetQuickImtConflictStub()42 static inline const void* GetQuickImtConflictStub() {
43   return reinterpret_cast<const void*>(art_quick_imt_conflict_trampoline);
44 }
45 
46 // Return the address of quick stub code for bridging from quick code to the interpreter.
47 extern "C" void art_quick_to_interpreter_bridge(ArtMethod*);
GetQuickToInterpreterBridge()48 static inline const void* GetQuickToInterpreterBridge() {
49   return reinterpret_cast<const void*>(art_quick_to_interpreter_bridge);
50 }
51 
52 // Return the address of stub code for attempting to invoke an obsolete method.
53 extern "C" void art_invoke_obsolete_method_stub(ArtMethod*);
GetInvokeObsoleteMethodStub()54 static inline const void* GetInvokeObsoleteMethodStub() {
55   return reinterpret_cast<const void*>(art_invoke_obsolete_method_stub);
56 }
57 
58 // Return the address of quick stub code for handling JNI calls.
59 extern "C" void art_quick_generic_jni_trampoline(ArtMethod*);
GetQuickGenericJniStub()60 static inline const void* GetQuickGenericJniStub() {
61   return reinterpret_cast<const void*>(art_quick_generic_jni_trampoline);
62 }
63 
64 // Return the address of quick stub code for handling transitions into the proxy invoke handler.
65 extern "C" void art_quick_proxy_invoke_handler();
GetQuickProxyInvokeHandler()66 static inline const void* GetQuickProxyInvokeHandler() {
67   return reinterpret_cast<const void*>(art_quick_proxy_invoke_handler);
68 }
69 
70 // Return the address of quick stub code for resolving a method at first call.
71 extern "C" void art_quick_resolution_trampoline(ArtMethod*);
GetQuickResolutionStub()72 static inline const void* GetQuickResolutionStub() {
73   return reinterpret_cast<const void*>(art_quick_resolution_trampoline);
74 }
75 
76 // Entry point for quick code that performs deoptimization.
77 extern "C" void art_quick_deoptimize();
GetQuickDeoptimizationEntryPoint()78 static inline const void* GetQuickDeoptimizationEntryPoint() {
79   return reinterpret_cast<const void*>(art_quick_deoptimize);
80 }
81 
82 // Return address of instrumentation entry point used by non-interpreter based tracing.
83 extern "C" void art_quick_instrumentation_entry(void*);
GetQuickInstrumentationEntryPoint()84 static inline const void* GetQuickInstrumentationEntryPoint() {
85   return reinterpret_cast<const void*>(art_quick_instrumentation_entry);
86 }
87 
88 // Stub to deoptimize from compiled code.
89 extern "C" void art_quick_deoptimize_from_compiled_code(DeoptimizationKind);
90 
91 // The return_pc of instrumentation exit stub.
92 extern "C" void art_quick_instrumentation_exit();
GetQuickInstrumentationExitPc()93 static inline const void* GetQuickInstrumentationExitPc() {
94   return reinterpret_cast<const void*>(art_quick_instrumentation_exit);
95 }
96 
97 extern "C" void* art_quick_string_builder_append(uint32_t format);
98 extern "C" void art_quick_compile_optimized(ArtMethod*, Thread*);
99 
100 }  // namespace art
101 
102 #endif  // ART_RUNTIME_ENTRYPOINTS_RUNTIME_ASM_ENTRYPOINTS_H_
103