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