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_cast(const art::mirror::Class*, const art::mirror::Class*);
35 
36 // DexCache entrypoints.
37 extern "C" void* art_quick_initialize_static_storage(uint32_t);
38 extern "C" void* art_quick_initialize_type(uint32_t);
39 extern "C" void* art_quick_initialize_type_and_verify_access(uint32_t);
40 extern "C" void* art_quick_resolve_string(uint32_t);
41 
42 // Field entrypoints.
43 extern "C" int art_quick_set8_instance(uint32_t, void*, int8_t);
44 extern "C" int art_quick_set8_static(uint32_t, int8_t);
45 extern "C" int art_quick_set16_instance(uint32_t, void*, int16_t);
46 extern "C" int art_quick_set16_static(uint32_t, int16_t);
47 extern "C" int art_quick_set32_instance(uint32_t, void*, int32_t);
48 extern "C" int art_quick_set32_static(uint32_t, int32_t);
49 extern "C" int art_quick_set64_instance(uint32_t, void*, int64_t);
50 extern "C" int art_quick_set64_static(uint32_t, int64_t);
51 extern "C" int art_quick_set_obj_instance(uint32_t, void*, void*);
52 extern "C" int art_quick_set_obj_static(uint32_t, void*);
53 extern "C" int8_t art_quick_get_byte_instance(uint32_t, void*);
54 extern "C" uint8_t art_quick_get_boolean_instance(uint32_t, void*);
55 extern "C" int8_t art_quick_get_byte_static(uint32_t);
56 extern "C" uint8_t art_quick_get_boolean_static(uint32_t);
57 extern "C" int16_t art_quick_get_short_instance(uint32_t, void*);
58 extern "C" uint16_t art_quick_get_char_instance(uint32_t, void*);
59 extern "C" int16_t art_quick_get_short_static(uint32_t);
60 extern "C" uint16_t art_quick_get_char_static(uint32_t);
61 extern "C" int32_t art_quick_get32_instance(uint32_t, void*);
62 extern "C" int32_t art_quick_get32_static(uint32_t);
63 extern "C" int64_t art_quick_get64_instance(uint32_t, void*);
64 extern "C" int64_t art_quick_get64_static(uint32_t);
65 extern "C" void* art_quick_get_obj_instance(uint32_t, void*);
66 extern "C" void* art_quick_get_obj_static(uint32_t);
67 
68 // Array entrypoints.
69 extern "C" void art_quick_aput_obj_with_null_and_bound_check(art::mirror::Array*, int32_t,
70                                                              art::mirror::Object*);
71 extern "C" void art_quick_aput_obj_with_bound_check(art::mirror::Array*, int32_t,
72                                                     art::mirror::Object*);
73 extern "C" void art_quick_aput_obj(art::mirror::Array*, int32_t, art::mirror::Object*);
74 extern "C" void art_quick_handle_fill_data(void*, void*);
75 
76 // Lock entrypoints.
77 extern "C" void art_quick_lock_object(art::mirror::Object*);
78 extern "C" void art_quick_unlock_object(art::mirror::Object*);
79 
80 // Lock entrypoints that do not inline any behavior (e.g., thin-locks).
81 extern "C" void art_quick_lock_object_no_inline(art::mirror::Object*);
82 extern "C" void art_quick_unlock_object_no_inline(art::mirror::Object*);
83 
84 // Math entrypoints.
85 extern "C" int64_t art_quick_d2l(double);
86 extern "C" int64_t art_quick_f2l(float);
87 extern "C" float art_quick_l2f(int64_t);
88 extern "C" int64_t art_quick_ldiv(int64_t, int64_t);
89 extern "C" int64_t art_quick_lmod(int64_t, int64_t);
90 extern "C" int64_t art_quick_lmul(int64_t, int64_t);
91 extern "C" uint64_t art_quick_lshl(uint64_t, uint32_t);
92 extern "C" uint64_t art_quick_lshr(uint64_t, uint32_t);
93 extern "C" uint64_t art_quick_lushr(uint64_t, uint32_t);
94 extern "C" int64_t art_quick_mul_long(int64_t, int64_t);
95 extern "C" uint64_t art_quick_shl_long(uint64_t, uint32_t);
96 extern "C" uint64_t art_quick_shr_long(uint64_t, uint32_t);
97 extern "C" uint64_t art_quick_ushr_long(uint64_t, uint32_t);
98 
99 // Intrinsic entrypoints.
100 extern "C" int32_t art_quick_indexof(void*, uint32_t, uint32_t);
101 extern "C" int32_t art_quick_string_compareto(void*, void*);
102 extern "C" void* art_quick_memcpy(void*, const void*, size_t);
103 
104 // Invoke entrypoints.
105 extern "C" void art_quick_imt_conflict_trampoline(art::ArtMethod*);
106 extern "C" void art_quick_resolution_trampoline(art::ArtMethod*);
107 extern "C" void art_quick_to_interpreter_bridge(art::ArtMethod*);
108 extern "C" void art_quick_invoke_direct_trampoline_with_access_check(uint32_t, void*);
109 extern "C" void art_quick_invoke_interface_trampoline_with_access_check(uint32_t, void*);
110 extern "C" void art_quick_invoke_static_trampoline_with_access_check(uint32_t, void*);
111 extern "C" void art_quick_invoke_super_trampoline_with_access_check(uint32_t, void*);
112 extern "C" void art_quick_invoke_virtual_trampoline_with_access_check(uint32_t, void*);
113 
114 // Thread entrypoints.
115 extern "C" void art_quick_test_suspend();
116 
117 // Throw entrypoints.
118 extern "C" void art_quick_deliver_exception(art::mirror::Object*);
119 extern "C" void art_quick_throw_array_bounds(int32_t index, int32_t limit);
120 extern "C" void art_quick_throw_div_zero();
121 extern "C" void art_quick_throw_no_such_method(int32_t method_idx);
122 extern "C" void art_quick_throw_null_pointer_exception();
123 extern "C" void art_quick_throw_stack_overflow(void*);
124 
125 #endif  // ART_RUNTIME_ENTRYPOINTS_QUICK_QUICK_DEFAULT_EXTERNS_H_
126