1 /*
2  * Copyright (C) 2014 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_QUICK_QUICK_DEFAULT_EXTERNS_H_
18 #define ART_RUNTIME_ENTRYPOINTS_QUICK_QUICK_DEFAULT_EXTERNS_H_
19 
20 #include <cstdint>
21 
22 namespace art {
23 namespace mirror {
24 class Array;
25 class Class;
26 class Object;
27 }  // namespace mirror
28 class ArtMethod;
29 }  // namespace art
30 
31 // These are extern declarations of assembly stubs with common names.
32 
33 // Cast entrypoints.
34 extern "C" void art_quick_check_instance_of(art::mirror::Object*, art::mirror::Class*);
35 
36 // Resolution and initialization entrypoints.
37 extern "C" void* art_quick_initialize_static_storage(art::mirror::Class*);
38 extern "C" void* art_quick_resolve_type(uint32_t);
39 extern "C" void* art_quick_resolve_type_and_verify_access(uint32_t);
40 extern "C" void* art_quick_resolve_method_handle(uint32_t);
41 extern "C" void* art_quick_resolve_method_type(uint32_t);
42 extern "C" void* art_quick_resolve_string(uint32_t);
43 
44 // Field entrypoints.
45 extern "C" int art_quick_set8_instance(uint32_t, void*, int8_t);
46 extern "C" int art_quick_set8_static(uint32_t, int8_t);
47 extern "C" int art_quick_set16_instance(uint32_t, void*, int16_t);
48 extern "C" int art_quick_set16_static(uint32_t, int16_t);
49 extern "C" int art_quick_set32_instance(uint32_t, void*, int32_t);
50 extern "C" int art_quick_set32_static(uint32_t, int32_t);
51 extern "C" int art_quick_set64_instance(uint32_t, void*, int64_t);
52 extern "C" int art_quick_set64_static(uint32_t, int64_t);
53 extern "C" int art_quick_set_obj_instance(uint32_t, void*, void*);
54 extern "C" int art_quick_set_obj_static(uint32_t, void*);
55 extern "C" ssize_t art_quick_get_byte_instance(uint32_t, void*);
56 extern "C" size_t art_quick_get_boolean_instance(uint32_t, void*);
57 extern "C" ssize_t art_quick_get_byte_static(uint32_t);
58 extern "C" size_t art_quick_get_boolean_static(uint32_t);
59 extern "C" ssize_t art_quick_get_short_instance(uint32_t, void*);
60 extern "C" size_t art_quick_get_char_instance(uint32_t, void*);
61 extern "C" ssize_t art_quick_get_short_static(uint32_t);
62 extern "C" size_t art_quick_get_char_static(uint32_t);
63 extern "C" ssize_t art_quick_get32_instance(uint32_t, void*);
64 extern "C" ssize_t art_quick_get32_static(uint32_t);
65 extern "C" int64_t art_quick_get64_instance(uint32_t, void*);
66 extern "C" int64_t art_quick_get64_static(uint32_t);
67 extern "C" void* art_quick_get_obj_instance(uint32_t, void*);
68 extern "C" void* art_quick_get_obj_static(uint32_t);
69 
70 // Array entrypoints.
71 extern "C" void art_quick_aput_obj_with_null_and_bound_check(art::mirror::Array*, int32_t,
72                                                              art::mirror::Object*);
73 extern "C" void art_quick_aput_obj_with_bound_check(art::mirror::Array*, int32_t,
74                                                     art::mirror::Object*);
75 extern "C" void art_quick_aput_obj(art::mirror::Array*, int32_t, art::mirror::Object*);
76 extern "C" void art_quick_handle_fill_data(void*, void*);
77 
78 // Lock entrypoints.
79 extern "C" void art_quick_lock_object(art::mirror::Object*);
80 extern "C" void art_quick_unlock_object(art::mirror::Object*);
81 
82 // Lock entrypoints that do not inline any behavior (e.g., thin-locks).
83 extern "C" void art_quick_lock_object_no_inline(art::mirror::Object*);
84 extern "C" void art_quick_unlock_object_no_inline(art::mirror::Object*);
85 
86 // Math entrypoints.
87 extern "C" int64_t art_quick_d2l(double);
88 extern "C" int64_t art_quick_f2l(float);
89 extern "C" float art_quick_l2f(int64_t);
90 extern "C" int64_t art_quick_ldiv(int64_t, int64_t);
91 extern "C" int64_t art_quick_lmod(int64_t, int64_t);
92 extern "C" int64_t art_quick_lmul(int64_t, int64_t);
93 extern "C" uint64_t art_quick_lshl(uint64_t, uint32_t);
94 extern "C" uint64_t art_quick_lshr(uint64_t, uint32_t);
95 extern "C" uint64_t art_quick_lushr(uint64_t, uint32_t);
96 extern "C" int64_t art_quick_mul_long(int64_t, int64_t);
97 extern "C" uint64_t art_quick_shl_long(uint64_t, uint32_t);
98 extern "C" uint64_t art_quick_shr_long(uint64_t, uint32_t);
99 extern "C" uint64_t art_quick_ushr_long(uint64_t, uint32_t);
100 
101 // Intrinsic entrypoints.
102 extern "C" int32_t art_quick_indexof(void*, uint32_t, uint32_t);
103 extern "C" int32_t art_quick_string_compareto(void*, void*);
104 extern "C" void* art_quick_memcpy(void*, const void*, size_t);
105 
106 // Invoke entrypoints.
107 extern "C" void art_quick_imt_conflict_trampoline(art::ArtMethod*);
108 extern "C" void art_quick_resolution_trampoline(art::ArtMethod*);
109 extern "C" void art_quick_to_interpreter_bridge(art::ArtMethod*);
110 extern "C" void art_quick_invoke_direct_trampoline_with_access_check(uint32_t, void*);
111 extern "C" void art_quick_invoke_interface_trampoline_with_access_check(uint32_t, void*);
112 extern "C" void art_quick_invoke_static_trampoline_with_access_check(uint32_t, void*);
113 extern "C" void art_quick_invoke_super_trampoline_with_access_check(uint32_t, void*);
114 
115 extern "C" void art_quick_invoke_virtual_trampoline_with_access_check(uint32_t, void*);
116 
117 // Polymorphic invoke entrypoints.
118 extern "C" void art_quick_invoke_polymorphic(uint32_t, void*);
119 extern "C" void art_quick_invoke_custom(uint32_t, void*);
120 
121 // Thread entrypoints.
122 extern "C" void art_quick_test_suspend();
123 
124 // Throw entrypoints.
125 extern "C" void art_quick_deliver_exception(art::mirror::Object*);
126 extern "C" void art_quick_throw_array_bounds(int32_t index, int32_t limit);
127 extern "C" void art_quick_throw_div_zero();
128 extern "C" void art_quick_throw_null_pointer_exception();
129 extern "C" void art_quick_throw_null_pointer_exception_from_signal(uintptr_t address);
130 extern "C" void art_quick_throw_stack_overflow(void*);
131 extern "C" void art_quick_throw_string_bounds(int32_t index, int32_t limit);
132 
133 // Inline cache.
134 extern "C" void art_quick_update_inline_cache();
135 
136 #endif  // ART_RUNTIME_ENTRYPOINTS_QUICK_QUICK_DEFAULT_EXTERNS_H_
137