1 /* 2 * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. 3 * Copyright (c) 2024, Red Hat, Inc. All rights reserved. 4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5 * 6 * This code is free software; you can redistribute it and/or modify it 7 * under the terms of the GNU General Public License version 2 only, as 8 * published by the Free Software Foundation. 9 * 10 * This code is distributed in the hope that it will be useful, but WITHOUT 11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 * version 2 for more details (a copy is included in the LICENSE file that 14 * accompanied this code). 15 * 16 * You should have received a copy of the GNU General Public License version 17 * 2 along with this work; if not, write to the Free Software Foundation, 18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 19 * 20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 21 * or visit www.oracle.com if you need additional information or have any 22 * questions. 23 * 24 */ 25 26 #ifndef SHARE_RUNTIME_STUBDECLARATIONS_HPP 27 #define SHARE_RUNTIME_STUBDECLARATIONS_HPP 28 29 #include "utilities/macros.hpp" 30 31 // macros for generating definitions and declarations for shared, c1 32 // and opto blob fields and associated stub ids 33 34 // Different shared stubs can have different blob types and may 35 // include some JFR stubs 36 // 37 // n.b resolve, handler and throw stubs must remain grouped in the 38 // same order to allow id values to be range checked 39 40 #if INCLUDE_JFR 41 // do_blob(name, type) 42 #define SHARED_JFR_STUBS_DO(do_blob) \ 43 do_blob(jfr_write_checkpoint, RuntimeStub*) \ 44 do_blob(jfr_return_lease, RuntimeStub*) \ 45 46 #else 47 #define SHARED_JFR_STUBS_DO(do_blob) 48 #endif 49 50 // do_blob(name, type) 51 #define SHARED_STUBS_DO(do_blob) \ 52 do_blob(deopt, DeoptimizationBlob*) \ 53 /* resolve stubs */ \ 54 do_blob(wrong_method, RuntimeStub*) \ 55 do_blob(wrong_method_abstract, RuntimeStub*) \ 56 do_blob(ic_miss, RuntimeStub*) \ 57 do_blob(resolve_opt_virtual_call, RuntimeStub*) \ 58 do_blob(resolve_virtual_call, RuntimeStub*) \ 59 do_blob(resolve_static_call, RuntimeStub*) \ 60 /* handler stubs */ \ 61 do_blob(polling_page_vectors_safepoint_handler, SafepointBlob*) \ 62 do_blob(polling_page_safepoint_handler, SafepointBlob*) \ 63 do_blob(polling_page_return_handler, SafepointBlob*) \ 64 /* throw stubs */ \ 65 do_blob(throw_AbstractMethodError, RuntimeStub*) \ 66 do_blob(throw_IncompatibleClassChangeError, RuntimeStub*) \ 67 do_blob(throw_NullPointerException_at_call, RuntimeStub*) \ 68 do_blob(throw_StackOverflowError, RuntimeStub*) \ 69 do_blob(throw_delayed_StackOverflowError, RuntimeStub*) \ 70 /* other stubs */ \ 71 SHARED_JFR_STUBS_DO(do_blob) \ 72 73 // C1 stubs are always generated in a generic CodeBlob 74 75 #ifdef COMPILER1 76 // do_blob(name) 77 #define C1_STUBS_DO(do_blob) \ 78 do_blob(dtrace_object_alloc) \ 79 do_blob(unwind_exception) \ 80 do_blob(forward_exception) \ 81 do_blob(throw_range_check_failed) /* throws ArrayIndexOutOfBoundsException */ \ 82 do_blob(throw_index_exception) /* throws IndexOutOfBoundsException */ \ 83 do_blob(throw_div0_exception) \ 84 do_blob(throw_null_pointer_exception) \ 85 do_blob(register_finalizer) \ 86 do_blob(new_instance) \ 87 do_blob(fast_new_instance) \ 88 do_blob(fast_new_instance_init_check) \ 89 do_blob(new_type_array) \ 90 do_blob(new_object_array) \ 91 do_blob(new_null_free_array) \ 92 do_blob(new_multi_array) \ 93 do_blob(load_flat_array) \ 94 do_blob(store_flat_array) \ 95 do_blob(substitutability_check) \ 96 do_blob(buffer_inline_args) \ 97 do_blob(buffer_inline_args_no_receiver) \ 98 do_blob(handle_exception_nofpu) /* optimized version that does not preserve fpu registers */ \ 99 do_blob(handle_exception) \ 100 do_blob(handle_exception_from_callee) \ 101 do_blob(throw_array_store_exception) \ 102 do_blob(throw_class_cast_exception) \ 103 do_blob(throw_incompatible_class_change_error) \ 104 do_blob(throw_illegal_monitor_state_exception) \ 105 do_blob(throw_identity_exception) \ 106 do_blob(slow_subtype_check) \ 107 do_blob(monitorenter) \ 108 do_blob(monitorenter_nofpu) /* optimized version that does not preserve fpu registers */ \ 109 do_blob(monitorexit) \ 110 do_blob(monitorexit_nofpu) /* optimized version that does not preserve fpu registers */ \ 111 do_blob(deoptimize) \ 112 do_blob(access_field_patching) \ 113 do_blob(load_klass_patching) \ 114 do_blob(load_mirror_patching) \ 115 do_blob(load_appendix_patching) \ 116 do_blob(fpu2long_stub) \ 117 do_blob(counter_overflow) \ 118 do_blob(predicate_failed_trap) \ 119 120 #else 121 #define C1_STUBS_DO(do_blob) 122 #endif 123 124 // Opto stubs can be stored as entries with just an address or as 125 // blobs of different types. The former may include some JVMTI stubs. 126 // 127 // n.b. blobs and stub defines are generated in the order defined by 128 // C2_STUBS_DO, allowing dependencies from any givem stub on its 129 // predecessors to be guaranteed. That explains the initial placement 130 // of the blob declarations and intermediate placement of the jvmti 131 // stubs. 132 133 #ifdef COMPILER2 134 // do_jvmti_stub(name) 135 #if INCLUDE_JVMTI 136 #define C2_JVMTI_STUBS_DO(do_jvmti_stub) \ 137 do_jvmti_stub(notify_jvmti_vthread_start) \ 138 do_jvmti_stub(notify_jvmti_vthread_end) \ 139 do_jvmti_stub(notify_jvmti_vthread_mount) \ 140 do_jvmti_stub(notify_jvmti_vthread_unmount) \ 141 142 #else 143 #define C2_JVMTI_STUBS_DO(do_jvmti_stub) 144 #endif // INCLUDE_JVMTI 145 146 // do_blob(name, type) 147 // do_stub(name, fancy_jump, pass_tls, return_pc) 148 // do_jvmti_stub(name) 149 // 150 // n.b. non-jvmti stubs may employ a special type of jump (0, 1 or 2) 151 // and require access to TLS and the return pc. jvmti stubs always 152 // employ jump 0, and require no special access 153 #define C2_STUBS_DO(do_blob, do_stub, do_jvmti_stub) \ 154 do_blob(uncommon_trap, UncommonTrapBlob*) \ 155 do_blob(exception, ExceptionBlob*) \ 156 do_stub(new_instance, 0, true, false) \ 157 do_stub(new_array, 0, true, false) \ 158 do_stub(new_array_nozero, 0, true, false) \ 159 do_stub(multianewarray2, 0, true, false) \ 160 do_stub(multianewarray3, 0, true, false) \ 161 do_stub(multianewarray4, 0, true, false) \ 162 do_stub(multianewarray5, 0, true, false) \ 163 do_stub(multianewarrayN, 0, true, false) \ 164 C2_JVMTI_STUBS_DO(do_jvmti_stub) \ 165 do_stub(complete_monitor_locking, 0, false, false) \ 166 do_stub(monitor_notify, 0, false, false) \ 167 do_stub(monitor_notifyAll, 0, false, false) \ 168 do_stub(rethrow, 2, true, true) \ 169 do_stub(slow_arraycopy, 0, false, false) \ 170 do_stub(register_finalizer, 0, false, false) \ 171 do_stub(load_unknown_inline, 0, true, false) \ 172 173 #else 174 #define C2_STUBS_DO(do_blob, do_stub, do_jvmti_stub) 175 #endif 176 177 // generate a stub or blob id enum tag from a name 178 179 #define STUB_ID_NAME(base) base##_id 180 181 // generate a stub field name 182 183 #define STUB_FIELD_NAME(base) _##base 184 185 // generate a blob field name 186 187 #define BLOB_FIELD_NAME(base) _##base##_blob 188 189 #endif // SHARE_RUNTIME_STUBDECLARATIONS_HPP 190