1 /*
2 * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_OPTO_LIBRARY_CALL_HPP
26 #define SHARE_OPTO_LIBRARY_CALL_HPP
27
28 #include "ci/ciMethod.hpp"
29 #include "classfile/javaClasses.hpp"
30 #include "opto/callGenerator.hpp"
31 #include "opto/castnode.hpp"
32 #include "opto/convertnode.hpp"
33 #include "opto/graphKit.hpp"
34 #include "opto/intrinsicnode.hpp"
35 #include "opto/movenode.hpp"
36
37 class LibraryIntrinsic : public InlineCallGenerator {
38 // Extend the set of intrinsics known to the runtime:
39 public:
40 private:
41 bool _is_virtual;
42 bool _does_virtual_dispatch;
43 int8_t _predicates_count; // Intrinsic is predicated by several conditions
44 int8_t _last_predicate; // Last generated predicate
45 vmIntrinsics::ID _intrinsic_id;
46
47 public:
48 LibraryIntrinsic(ciMethod* m, bool is_virtual, int predicates_count, bool does_virtual_dispatch, vmIntrinsics::ID id)
49 : InlineCallGenerator(m),
50 _is_virtual(is_virtual),
51 _does_virtual_dispatch(does_virtual_dispatch),
52 _predicates_count((int8_t)predicates_count),
53 _last_predicate((int8_t)-1),
91 ciSignature* declared_signature = nullptr;
92 ciMethod* ignored_callee = caller()->get_method_at_bci(bci(), ignored_will_link, &declared_signature);
93 const int nargs = declared_signature->arg_size_for_bc(caller()->java_code_at_bci(bci()));
94 _reexecute_sp = sp() + nargs; // "push" arguments back on stack
95 }
96 }
97
98 virtual LibraryCallKit* is_LibraryCallKit() const { return (LibraryCallKit*)this; }
99
100 ciMethod* caller() const { return jvms()->method(); }
101 int bci() const { return jvms()->bci(); }
102 LibraryIntrinsic* intrinsic() const { return _intrinsic; }
103 vmIntrinsics::ID intrinsic_id() const { return _intrinsic->intrinsic_id(); }
104 ciMethod* callee() const { return _intrinsic->method(); }
105
106 bool try_to_inline(int predicate);
107 Node* try_to_predicate(int predicate);
108
109 void push_result() {
110 // Push the result onto the stack.
111 if (!stopped() && result() != nullptr) {
112 if (result()->is_top()) {
113 assert(false, "Can't determine return value.");
114 C->record_method_not_compilable("Can't determine return value.");
115 }
116 BasicType bt = result()->bottom_type()->basic_type();
117 push_node(bt, result());
118 }
119 }
120
121 private:
122 void fatal_unexpected_iid(vmIntrinsics::ID iid) {
123 fatal("unexpected intrinsic %d: %s", vmIntrinsics::as_int(iid), vmIntrinsics::name_at(iid));
124 }
125
126 void set_result(Node* n) { assert(_result == nullptr, "only set once"); _result = n; }
127 void set_result(RegionNode* region, PhiNode* value);
128 Node* result() { return _result; }
129
130 virtual int reexecute_sp() { return _reexecute_sp; }
131
132 /* When an intrinsic makes changes before bailing out, it's necessary to restore the graph
133 * as it was. See JDK-8359344 for what can happen wrong. It's also not always possible to
134 * bailout before making changes because the bailing out decision might depend on new nodes
135 * (their types, for instance).
136 *
137 * So, if an intrinsic might cause this situation, one must start by saving the state in a
169 Node* generate_current_thread(Node* &tls_output);
170 Node* generate_virtual_thread(Node* threadObj);
171 Node* load_mirror_from_klass(Node* klass);
172 Node* load_klass_from_mirror_common(Node* mirror, bool never_see_null,
173 RegionNode* region, int null_path,
174 int offset);
175 Node* load_klass_from_mirror(Node* mirror, bool never_see_null,
176 RegionNode* region, int null_path) {
177 int offset = java_lang_Class::klass_offset();
178 return load_klass_from_mirror_common(mirror, never_see_null,
179 region, null_path,
180 offset);
181 }
182 Node* load_array_klass_from_mirror(Node* mirror, bool never_see_null,
183 RegionNode* region, int null_path) {
184 int offset = java_lang_Class::array_klass_offset();
185 return load_klass_from_mirror_common(mirror, never_see_null,
186 region, null_path,
187 offset);
188 }
189 Node* generate_klass_flags_guard(Node* kls, int modifier_mask, int modifier_bits, RegionNode* region,
190 ByteSize offset, const Type* type, BasicType bt);
191 Node* generate_misc_flags_guard(Node* kls,
192 int modifier_mask, int modifier_bits,
193 RegionNode* region);
194 Node* generate_interface_guard(Node* kls, RegionNode* region);
195 Node* generate_hidden_class_guard(Node* kls, RegionNode* region);
196 Node* generate_array_guard(Node* kls, RegionNode* region, Node** obj = nullptr) {
197 return generate_array_guard_common(kls, region, false, false, obj);
198 }
199 Node* generate_non_array_guard(Node* kls, RegionNode* region, Node** obj = nullptr) {
200 return generate_array_guard_common(kls, region, false, true, obj);
201 }
202 Node* generate_objArray_guard(Node* kls, RegionNode* region, Node** obj = nullptr) {
203 return generate_array_guard_common(kls, region, true, false, obj);
204 }
205 Node* generate_non_objArray_guard(Node* kls, RegionNode* region, Node** obj = nullptr) {
206 return generate_array_guard_common(kls, region, true, true, obj);
207 }
208 Node* generate_array_guard_common(Node* kls, RegionNode* region,
209 bool obj_array, bool not_array, Node** obj = nullptr);
210 Node* generate_virtual_guard(Node* obj_klass, RegionNode* slow_region);
211 CallJavaNode* generate_method_call(vmIntrinsicID method_id, bool is_virtual, bool is_static, bool res_not_null);
212 CallJavaNode* generate_method_call_static(vmIntrinsicID method_id, bool res_not_null) {
213 return generate_method_call(method_id, false, true, res_not_null);
214 }
215 Node* load_field_from_object(Node* fromObj, const char* fieldName, const char* fieldTypeString, DecoratorSet decorators = IN_HEAP, bool is_static = false, ciInstanceKlass* fromKls = nullptr);
216 Node* field_address_from_object(Node* fromObj, const char* fieldName, const char* fieldTypeString, bool is_exact = true, bool is_static = false, ciInstanceKlass* fromKls = nullptr);
217
218 Node* make_string_method_node(int opcode, Node* str1_start, Node* cnt1, Node* str2_start, Node* cnt2, StrIntrinsicNode::ArgEnc ae);
219 bool inline_string_compareTo(StrIntrinsicNode::ArgEnc ae);
220 bool inline_string_indexOf(StrIntrinsicNode::ArgEnc ae);
221 bool inline_string_indexOfI(StrIntrinsicNode::ArgEnc ae);
222 Node* make_indexOf_node(Node* src_start, Node* src_count, Node* tgt_start, Node* tgt_count,
223 RegionNode* region, Node* phi, StrIntrinsicNode::ArgEnc ae);
224 bool inline_string_indexOfChar(StrIntrinsicNode::ArgEnc ae);
225 bool inline_string_equals(StrIntrinsicNode::ArgEnc ae);
226 bool inline_vectorizedHashCode();
227 bool inline_string_toBytesU();
228 bool inline_string_getCharsU();
229 bool inline_string_copy(bool compress);
238 bool inline_math_mathExact(Node* math, Node* test);
239 bool inline_math_addExactI(bool is_increment);
240 bool inline_math_addExactL(bool is_increment);
241 bool inline_math_multiplyExactI();
242 bool inline_math_multiplyExactL();
243 bool inline_math_multiplyHigh();
244 bool inline_math_unsignedMultiplyHigh();
245 bool inline_math_negateExactI();
246 bool inline_math_negateExactL();
247 bool inline_math_subtractExactI(bool is_decrement);
248 bool inline_math_subtractExactL(bool is_decrement);
249 bool inline_min_max(vmIntrinsics::ID id);
250 bool inline_notify(vmIntrinsics::ID id);
251 // This returns Type::AnyPtr, RawPtr, or OopPtr.
252 int classify_unsafe_addr(Node* &base, Node* &offset, BasicType type);
253 Node* make_unsafe_address(Node*& base, Node* offset, BasicType type = T_ILLEGAL, bool can_cast = false);
254
255 typedef enum { Relaxed, Opaque, Volatile, Acquire, Release } AccessKind;
256 DecoratorSet mo_decorator_for_access_kind(AccessKind kind);
257 bool inline_unsafe_access(bool is_store, BasicType type, AccessKind kind, bool is_unaligned);
258 static bool klass_needs_init_guard(Node* kls);
259 bool inline_unsafe_allocate();
260 bool inline_unsafe_newArray(bool uninitialized);
261 bool inline_unsafe_writeback0();
262 bool inline_unsafe_writebackSync0(bool is_pre);
263 bool inline_unsafe_copyMemory();
264 bool inline_unsafe_setMemory();
265
266 bool inline_native_currentCarrierThread();
267 bool inline_native_currentThread();
268 bool inline_native_setCurrentThread();
269
270 bool inline_native_scopedValueCache();
271 const Type* scopedValueCache_type();
272 Node* scopedValueCache_helper();
273 bool inline_native_setScopedValueCache();
274 bool inline_native_Continuation_pinning(bool unpin);
275
276 bool inline_native_time_funcs(address method, const char* funcName);
277
278 bool inline_native_vthread_start_transition(address funcAddr, const char* funcName, bool is_final_transition);
279 bool inline_native_vthread_end_transition(address funcAddr, const char* funcName, bool is_first_transition);
280
281 #if INCLUDE_JVMTI
282 bool inline_native_notify_jvmti_sync();
283 #endif
284
285 #ifdef JFR_HAVE_INTRINSICS
286 bool inline_native_classID();
287 bool inline_native_getEventWriter();
288 bool inline_native_jvm_commit();
289 void extend_setCurrentThread(Node* jt, Node* thread);
290 #endif
291 bool inline_native_Class_query(vmIntrinsics::ID id);
292 bool inline_native_subtype_check();
293 bool inline_native_getLength();
294 bool inline_array_copyOf(bool is_copyOfRange);
295 bool inline_array_equals(StrIntrinsicNode::ArgEnc ae);
296 bool inline_preconditions_checkIndex(BasicType bt);
297 void copy_to_clone(Node* obj, Node* alloc_obj, Node* obj_size, bool is_array);
298 bool inline_native_clone(bool is_virtual);
299 bool inline_native_Reflection_getCallerClass();
300 // Helper function for inlining native object hash method
301 bool inline_native_hashcode(bool is_virtual, bool is_static);
302 bool inline_native_getClass();
303
304 // Helper functions for inlining arraycopy
305 bool inline_arraycopy();
306 AllocateArrayNode* tightly_coupled_allocation(Node* ptr);
307 static CallStaticJavaNode* get_uncommon_trap_from_success_proj(Node* node);
308 SafePointNode* create_safepoint_with_state_before_array_allocation(const AllocateArrayNode* alloc) const;
309 void replace_unrelated_uncommon_traps_with_alloc_state(AllocateArrayNode* alloc, JVMState* saved_jvms_before_guards);
310 void replace_unrelated_uncommon_traps_with_alloc_state(JVMState* saved_jvms_before_guards);
311 void create_new_uncommon_trap(CallStaticJavaNode* uncommon_trap_call);
312 JVMState* arraycopy_restore_alloc_state(AllocateArrayNode* alloc, int& saved_reexecute_sp);
313 void arraycopy_move_allocation_here(AllocateArrayNode* alloc, Node* dest, JVMState* saved_jvms_before_guards, int saved_reexecute_sp,
314 uint new_idx);
315 bool check_array_sort_arguments(Node* elementType, Node* obj, BasicType& bt);
316 bool inline_array_sort();
317 bool inline_array_partition();
318 typedef enum { LS_get_add, LS_get_set, LS_cmp_swap, LS_cmp_swap_weak, LS_cmp_exchange } LoadStoreKind;
319 bool inline_unsafe_load_store(BasicType type, LoadStoreKind kind, AccessKind access_kind);
320 bool inline_unsafe_fence(vmIntrinsics::ID id);
321 bool inline_onspinwait();
322 bool inline_fp_conversions(vmIntrinsics::ID id);
323 bool inline_fp_range_check(vmIntrinsics::ID id);
324 bool inline_fp16_operations(vmIntrinsics::ID id, int num_args);
325 Node* unbox_fp16_value(const TypeInstPtr* box_class, ciField* field, Node* box);
326 Node* box_fp16_value(const TypeInstPtr* box_class, ciField* field, Node* value);
327 bool inline_number_methods(vmIntrinsics::ID id);
328 bool inline_bitshuffle_methods(vmIntrinsics::ID id);
329 bool inline_compare_unsigned(vmIntrinsics::ID id);
330 bool inline_divmod_methods(vmIntrinsics::ID id);
331 bool inline_reference_get0();
332 bool inline_reference_refersTo0(bool is_phantom);
333 bool inline_reference_clear0(bool is_phantom);
334 bool inline_Class_cast();
335 bool inline_aescrypt_Block(vmIntrinsics::ID id);
336 bool inline_cipherBlockChaining_AESCrypt(vmIntrinsics::ID id);
337 bool inline_electronicCodeBook_AESCrypt(vmIntrinsics::ID id);
338 bool inline_counterMode_AESCrypt(vmIntrinsics::ID id);
339 Node* inline_cipherBlockChaining_AESCrypt_predicate(bool decrypting);
340 Node* inline_electronicCodeBook_AESCrypt_predicate(bool decrypting);
|
1 /*
2 * Copyright (c) 2020, 2026, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_OPTO_LIBRARY_CALL_HPP
26 #define SHARE_OPTO_LIBRARY_CALL_HPP
27
28 #include "ci/ciMethod.hpp"
29 #include "classfile/javaClasses.hpp"
30 #include "opto/callGenerator.hpp"
31 #include "opto/castnode.hpp"
32 #include "opto/convertnode.hpp"
33 #include "opto/graphKit.hpp"
34 #include "opto/inlinetypenode.hpp"
35 #include "opto/intrinsicnode.hpp"
36 #include "opto/movenode.hpp"
37
38 class LibraryIntrinsic : public InlineCallGenerator {
39 // Extend the set of intrinsics known to the runtime:
40 public:
41 private:
42 bool _is_virtual;
43 bool _does_virtual_dispatch;
44 int8_t _predicates_count; // Intrinsic is predicated by several conditions
45 int8_t _last_predicate; // Last generated predicate
46 vmIntrinsics::ID _intrinsic_id;
47
48 public:
49 LibraryIntrinsic(ciMethod* m, bool is_virtual, int predicates_count, bool does_virtual_dispatch, vmIntrinsics::ID id)
50 : InlineCallGenerator(m),
51 _is_virtual(is_virtual),
52 _does_virtual_dispatch(does_virtual_dispatch),
53 _predicates_count((int8_t)predicates_count),
54 _last_predicate((int8_t)-1),
92 ciSignature* declared_signature = nullptr;
93 ciMethod* ignored_callee = caller()->get_method_at_bci(bci(), ignored_will_link, &declared_signature);
94 const int nargs = declared_signature->arg_size_for_bc(caller()->java_code_at_bci(bci()));
95 _reexecute_sp = sp() + nargs; // "push" arguments back on stack
96 }
97 }
98
99 virtual LibraryCallKit* is_LibraryCallKit() const { return (LibraryCallKit*)this; }
100
101 ciMethod* caller() const { return jvms()->method(); }
102 int bci() const { return jvms()->bci(); }
103 LibraryIntrinsic* intrinsic() const { return _intrinsic; }
104 vmIntrinsics::ID intrinsic_id() const { return _intrinsic->intrinsic_id(); }
105 ciMethod* callee() const { return _intrinsic->method(); }
106
107 bool try_to_inline(int predicate);
108 Node* try_to_predicate(int predicate);
109
110 void push_result() {
111 // Push the result onto the stack.
112 Node* res = result();
113 if (!stopped() && res != nullptr) {
114 if (res->is_top()) {
115 assert(false, "Can't determine return value.");
116 C->record_method_not_compilable("Can't determine return value.");
117 }
118 BasicType bt = res->bottom_type()->basic_type();
119 if (C->inlining_incrementally() && res->is_InlineType()) {
120 // The caller expects an oop when incrementally inlining an intrinsic that returns an
121 // inline type. Make sure the call is re-executed if the allocation triggers a deoptimization.
122 PreserveReexecuteState preexecs(this);
123 jvms()->set_should_reexecute(true);
124 res = res->as_InlineType()->buffer(this);
125 }
126 push_node(bt, res);
127 }
128 }
129
130 private:
131 void fatal_unexpected_iid(vmIntrinsics::ID iid) {
132 fatal("unexpected intrinsic %d: %s", vmIntrinsics::as_int(iid), vmIntrinsics::name_at(iid));
133 }
134
135 void set_result(Node* n) { assert(_result == nullptr, "only set once"); _result = n; }
136 void set_result(RegionNode* region, PhiNode* value);
137 Node* result() { return _result; }
138
139 virtual int reexecute_sp() { return _reexecute_sp; }
140
141 /* When an intrinsic makes changes before bailing out, it's necessary to restore the graph
142 * as it was. See JDK-8359344 for what can happen wrong. It's also not always possible to
143 * bailout before making changes because the bailing out decision might depend on new nodes
144 * (their types, for instance).
145 *
146 * So, if an intrinsic might cause this situation, one must start by saving the state in a
178 Node* generate_current_thread(Node* &tls_output);
179 Node* generate_virtual_thread(Node* threadObj);
180 Node* load_mirror_from_klass(Node* klass);
181 Node* load_klass_from_mirror_common(Node* mirror, bool never_see_null,
182 RegionNode* region, int null_path,
183 int offset);
184 Node* load_klass_from_mirror(Node* mirror, bool never_see_null,
185 RegionNode* region, int null_path) {
186 int offset = java_lang_Class::klass_offset();
187 return load_klass_from_mirror_common(mirror, never_see_null,
188 region, null_path,
189 offset);
190 }
191 Node* load_array_klass_from_mirror(Node* mirror, bool never_see_null,
192 RegionNode* region, int null_path) {
193 int offset = java_lang_Class::array_klass_offset();
194 return load_klass_from_mirror_common(mirror, never_see_null,
195 region, null_path,
196 offset);
197 }
198 Node* load_default_refined_array_klass(Node* klass_node, bool type_array_guard = true);
199 Node* load_non_refined_array_klass(Node* klass_node);
200
201 Node* generate_klass_flags_guard(Node* kls, int modifier_mask, int modifier_bits, RegionNode* region,
202 ByteSize offset, const Type* type, BasicType bt);
203 Node* generate_misc_flags_guard(Node* kls,
204 int modifier_mask, int modifier_bits,
205 RegionNode* region);
206 Node* generate_interface_guard(Node* kls, RegionNode* region);
207
208 enum ArrayKind {
209 AnyArray,
210 NonArray,
211 RefArray,
212 NonRefArray,
213 TypeArray
214 };
215
216 Node* generate_hidden_class_guard(Node* kls, RegionNode* region);
217
218 Node* generate_array_guard(Node* kls, RegionNode* region, Node** obj = nullptr) {
219 return generate_array_guard_common(kls, region, AnyArray, obj);
220 }
221 Node* generate_non_array_guard(Node* kls, RegionNode* region, Node** obj = nullptr) {
222 return generate_array_guard_common(kls, region, NonArray, obj);
223 }
224 Node* generate_refArray_guard(Node* kls, RegionNode* region, Node** obj = nullptr) {
225 return generate_array_guard_common(kls, region, RefArray, obj);
226 }
227 Node* generate_non_refArray_guard(Node* kls, RegionNode* region, Node** obj = nullptr) {
228 return generate_array_guard_common(kls, region, NonRefArray, obj);
229 }
230 Node* generate_typeArray_guard(Node* kls, RegionNode* region, Node** obj = nullptr) {
231 return generate_array_guard_common(kls, region, TypeArray, obj);
232 }
233 Node* generate_array_guard_common(Node* kls, RegionNode* region, ArrayKind kind, Node** obj = nullptr);
234 Node* generate_virtual_guard(Node* obj_klass, RegionNode* slow_region);
235 CallJavaNode* generate_method_call(vmIntrinsicID method_id, bool is_virtual, bool is_static, bool res_not_null);
236 CallJavaNode* generate_method_call_static(vmIntrinsicID method_id, bool res_not_null) {
237 return generate_method_call(method_id, false, true, res_not_null);
238 }
239 Node* load_field_from_object(Node* fromObj, const char* fieldName, const char* fieldTypeString, DecoratorSet decorators = IN_HEAP, bool is_static = false, ciInstanceKlass* fromKls = nullptr);
240 Node* field_address_from_object(Node* fromObj, const char* fieldName, const char* fieldTypeString, bool is_exact = true, bool is_static = false, ciInstanceKlass* fromKls = nullptr);
241
242 Node* make_string_method_node(int opcode, Node* str1_start, Node* cnt1, Node* str2_start, Node* cnt2, StrIntrinsicNode::ArgEnc ae);
243 bool inline_string_compareTo(StrIntrinsicNode::ArgEnc ae);
244 bool inline_string_indexOf(StrIntrinsicNode::ArgEnc ae);
245 bool inline_string_indexOfI(StrIntrinsicNode::ArgEnc ae);
246 Node* make_indexOf_node(Node* src_start, Node* src_count, Node* tgt_start, Node* tgt_count,
247 RegionNode* region, Node* phi, StrIntrinsicNode::ArgEnc ae);
248 bool inline_string_indexOfChar(StrIntrinsicNode::ArgEnc ae);
249 bool inline_string_equals(StrIntrinsicNode::ArgEnc ae);
250 bool inline_vectorizedHashCode();
251 bool inline_string_toBytesU();
252 bool inline_string_getCharsU();
253 bool inline_string_copy(bool compress);
262 bool inline_math_mathExact(Node* math, Node* test);
263 bool inline_math_addExactI(bool is_increment);
264 bool inline_math_addExactL(bool is_increment);
265 bool inline_math_multiplyExactI();
266 bool inline_math_multiplyExactL();
267 bool inline_math_multiplyHigh();
268 bool inline_math_unsignedMultiplyHigh();
269 bool inline_math_negateExactI();
270 bool inline_math_negateExactL();
271 bool inline_math_subtractExactI(bool is_decrement);
272 bool inline_math_subtractExactL(bool is_decrement);
273 bool inline_min_max(vmIntrinsics::ID id);
274 bool inline_notify(vmIntrinsics::ID id);
275 // This returns Type::AnyPtr, RawPtr, or OopPtr.
276 int classify_unsafe_addr(Node* &base, Node* &offset, BasicType type);
277 Node* make_unsafe_address(Node*& base, Node* offset, BasicType type = T_ILLEGAL, bool can_cast = false);
278
279 typedef enum { Relaxed, Opaque, Volatile, Acquire, Release } AccessKind;
280 DecoratorSet mo_decorator_for_access_kind(AccessKind kind);
281 bool inline_unsafe_access(bool is_store, BasicType type, AccessKind kind, bool is_unaligned);
282 bool inline_unsafe_flat_access(bool is_store, AccessKind kind);
283 static bool klass_needs_init_guard(Node* kls);
284 bool inline_unsafe_allocate();
285 bool inline_unsafe_newArray(bool uninitialized);
286 bool inline_newArray(bool null_free, bool atomic);
287 typedef enum { IsFlat, IsNullRestricted, IsAtomic } ArrayPropertiesCheck;
288 bool inline_getArrayProperties(ArrayPropertiesCheck check);
289 bool inline_unsafe_writeback0();
290 bool inline_unsafe_writebackSync0(bool is_pre);
291 bool inline_unsafe_copyMemory();
292 bool inline_unsafe_setMemory();
293
294 bool inline_native_currentCarrierThread();
295 bool inline_native_currentThread();
296 bool inline_native_setCurrentThread();
297
298 bool inline_native_scopedValueCache();
299 const Type* scopedValueCache_type();
300 Node* scopedValueCache_helper();
301 bool inline_native_setScopedValueCache();
302 bool inline_native_Continuation_pinning(bool unpin);
303
304 bool inline_native_time_funcs(address method, const char* funcName);
305
306 bool inline_native_vthread_start_transition(address funcAddr, const char* funcName, bool is_final_transition);
307 bool inline_native_vthread_end_transition(address funcAddr, const char* funcName, bool is_first_transition);
308
309 #if INCLUDE_JVMTI
310 bool inline_native_notify_jvmti_sync();
311 #endif
312
313 #ifdef JFR_HAVE_INTRINSICS
314 bool inline_native_classID();
315 bool inline_native_getEventWriter();
316 bool inline_native_jvm_commit();
317 void extend_setCurrentThread(Node* jt, Node* thread);
318 #endif
319 bool inline_native_Class_query(vmIntrinsics::ID id);
320 bool inline_primitive_Class_conversion(vmIntrinsics::ID id);
321 bool inline_native_subtype_check();
322 bool inline_native_getLength();
323 bool inline_array_copyOf(bool is_copyOfRange);
324 bool inline_array_equals(StrIntrinsicNode::ArgEnc ae);
325 bool inline_preconditions_checkIndex(BasicType bt);
326 void copy_to_clone(Node* obj, Node* alloc_obj, Node* obj_size, bool is_array);
327 bool inline_native_clone(bool is_virtual);
328 bool inline_native_Reflection_getCallerClass();
329 // Helper function for inlining native object hash method
330 bool inline_native_hashcode(bool is_virtual, bool is_static);
331 bool inline_native_getClass();
332
333 // Helper functions for inlining arraycopy
334 bool inline_arraycopy();
335 AllocateArrayNode* tightly_coupled_allocation(Node* ptr);
336 static CallStaticJavaNode* get_uncommon_trap_from_success_proj(Node* node);
337 SafePointNode* create_safepoint_with_state_before_array_allocation(const AllocateArrayNode* alloc) const;
338 void replace_unrelated_uncommon_traps_with_alloc_state(AllocateArrayNode* alloc, JVMState* saved_jvms_before_guards);
339 void replace_unrelated_uncommon_traps_with_alloc_state(JVMState* saved_jvms_before_guards);
340 void create_new_uncommon_trap(CallStaticJavaNode* uncommon_trap_call);
341 JVMState* arraycopy_restore_alloc_state(AllocateArrayNode* alloc, int& saved_reexecute_sp);
342 void arraycopy_move_allocation_here(AllocateArrayNode* alloc, Node* dest, JVMState* saved_jvms_before_guards, int saved_reexecute_sp,
343 uint new_idx);
344 bool check_array_sort_arguments(Node* elementType, Node* obj, BasicType& bt);
345 bool inline_array_sort();
346 bool inline_array_partition();
347 typedef enum { LS_get_add, LS_get_set, LS_cmp_swap, LS_cmp_swap_weak, LS_cmp_exchange } LoadStoreKind;
348 bool inline_unsafe_load_store(BasicType type, LoadStoreKind kind, AccessKind access_kind);
349 bool inline_unsafe_fence(vmIntrinsics::ID id);
350 bool inline_arrayInstanceBaseOffset();
351 bool inline_arrayInstanceIndexScale();
352 bool inline_arrayLayout();
353 bool inline_getFieldMap();
354 bool inline_onspinwait();
355 bool inline_fp_conversions(vmIntrinsics::ID id);
356 bool inline_fp_range_check(vmIntrinsics::ID id);
357 bool inline_fp16_operations(vmIntrinsics::ID id, int num_args);
358 Node* unbox_fp16_value(const TypeInstPtr* box_class, ciField* field, Node* box);
359 Node* box_fp16_value(const TypeInstPtr* box_class, ciField* field, Node* value);
360 bool inline_number_methods(vmIntrinsics::ID id);
361 bool inline_bitshuffle_methods(vmIntrinsics::ID id);
362 bool inline_compare_unsigned(vmIntrinsics::ID id);
363 bool inline_divmod_methods(vmIntrinsics::ID id);
364 bool inline_reference_get0();
365 bool inline_reference_refersTo0(bool is_phantom);
366 bool inline_reference_clear0(bool is_phantom);
367 bool inline_Class_cast();
368 bool inline_aescrypt_Block(vmIntrinsics::ID id);
369 bool inline_cipherBlockChaining_AESCrypt(vmIntrinsics::ID id);
370 bool inline_electronicCodeBook_AESCrypt(vmIntrinsics::ID id);
371 bool inline_counterMode_AESCrypt(vmIntrinsics::ID id);
372 Node* inline_cipherBlockChaining_AESCrypt_predicate(bool decrypting);
373 Node* inline_electronicCodeBook_AESCrypt_predicate(bool decrypting);
|