diff --git a/src/hotspot/cpu/aarch64/c1_MacroAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/c1_MacroAssembler_aarch64.cpp index 49c90c0b4bc..2020a7e38a0 100644 --- a/src/hotspot/cpu/aarch64/c1_MacroAssembler_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/c1_MacroAssembler_aarch64.cpp @@ -33,6 +33,7 @@ #include "interpreter/interpreter.hpp" #include "oops/arrayOop.hpp" #include "oops/markWord.hpp" +#include "runtime/arguments.hpp" #include "runtime/basicLock.hpp" #include "runtime/os.hpp" #include "runtime/sharedRuntime.hpp" @@ -101,7 +102,7 @@ void C1_MacroAssembler::try_allocate(Register obj, Register var_size_in_bytes, i void C1_MacroAssembler::initialize_header(Register obj, Register klass, Register len, Register t1, Register t2) { assert_different_registers(obj, klass, len); - if (UseCompactObjectHeaders || EnableValhalla) { + if (UseCompactObjectHeaders || Arguments::is_valhalla_enabled()) { // COH: Markword contains class pointer which is only known at runtime. // Valhalla: Could have value class which has a different prototype header to a normal object. // In both cases, we need to fetch dynamically. diff --git a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp index 13ef76c784a..bfd62dac8b0 100644 --- a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp @@ -49,6 +49,7 @@ #include "oops/compressedOops.inline.hpp" #include "oops/klass.inline.hpp" #include "oops/resolvedFieldEntry.hpp" +#include "runtime/arguments.hpp" #include "runtime/continuation.hpp" #include "runtime/globals.hpp" #include "runtime/icache.hpp" @@ -5727,7 +5728,7 @@ void MacroAssembler::allocate_instance(Register klass, Register new_obj, bind(initialize_header); pop(klass); Register mark_word = t2; - if (UseCompactObjectHeaders || EnableValhalla) { + if (UseCompactObjectHeaders || Arguments::is_valhalla_enabled()) { ldr(mark_word, Address(klass, Klass::prototype_header_offset())); str(mark_word, Address(new_obj, oopDesc::mark_offset_in_bytes())); } else { diff --git a/src/hotspot/cpu/aarch64/templateTable_aarch64.cpp b/src/hotspot/cpu/aarch64/templateTable_aarch64.cpp index 62367f1042a..a561914f2be 100644 --- a/src/hotspot/cpu/aarch64/templateTable_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/templateTable_aarch64.cpp @@ -43,6 +43,7 @@ #include "oops/resolvedMethodEntry.hpp" #include "prims/jvmtiExport.hpp" #include "prims/methodHandles.hpp" +#include "runtime/arguments.hpp" #include "runtime/frame.inline.hpp" #include "runtime/sharedRuntime.hpp" #include "runtime/stubRoutines.hpp" @@ -1183,7 +1184,7 @@ void TemplateTable::aastore() { // Have a null in r0, r3=array, r2=index. Store null at ary[idx] __ bind(is_null); - if (EnableValhalla) { + if (Arguments::is_valhalla_enabled()) { Label is_null_into_value_array_npe, store_null; if (UseArrayFlattening) { @@ -2031,7 +2032,7 @@ void TemplateTable::if_acmp(Condition cc) { Register is_inline_type_mask = rscratch1; __ mov(is_inline_type_mask, markWord::inline_type_pattern); - if (EnableValhalla) { + if (Arguments::is_valhalla_enabled()) { __ cmp(r1, r0); __ br(Assembler::EQ, (cc == equal) ? taken : not_taken); @@ -2782,7 +2783,7 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr __ cmp(tos_state, (u1)atos); __ br(Assembler::NE, notObj); // atos - if (!EnableValhalla) { + if (!Arguments::is_valhalla_enabled()) { do_oop_load(_masm, field, r0, IN_HEAP); __ push(atos); if (rc == may_rewrite) { @@ -3036,7 +3037,7 @@ void TemplateTable::putfield_or_static(int byte_no, bool is_static, RewriteContr // atos { - if (!EnableValhalla) { + if (!Arguments::is_valhalla_enabled()) { __ pop(atos); if (!is_static) pop_and_check_object(obj); // Store into the field diff --git a/src/hotspot/cpu/x86/c1_MacroAssembler_x86.cpp b/src/hotspot/cpu/x86/c1_MacroAssembler_x86.cpp index 67db0f4b411..17eaa0045f7 100644 --- a/src/hotspot/cpu/x86/c1_MacroAssembler_x86.cpp +++ b/src/hotspot/cpu/x86/c1_MacroAssembler_x86.cpp @@ -33,6 +33,7 @@ #include "interpreter/interpreter.hpp" #include "oops/arrayOop.hpp" #include "oops/markWord.hpp" +#include "runtime/arguments.hpp" #include "runtime/basicLock.hpp" #include "runtime/frame.inline.hpp" #include "runtime/globals.hpp" @@ -83,7 +84,7 @@ void C1_MacroAssembler::try_allocate(Register obj, Register var_size_in_bytes, i void C1_MacroAssembler::initialize_header(Register obj, Register klass, Register len, Register t1, Register t2) { assert_different_registers(obj, klass, len, t1, t2); - if (UseCompactObjectHeaders || EnableValhalla) { + if (UseCompactObjectHeaders || Arguments::is_valhalla_enabled()) { // COH: Markword contains class pointer which is only known at runtime. // Valhalla: Could have value class which has a different prototype header to a normal object. // In both cases, we need to fetch dynamically. diff --git a/src/hotspot/cpu/x86/gc/g1/g1BarrierSetAssembler_x86.cpp b/src/hotspot/cpu/x86/gc/g1/g1BarrierSetAssembler_x86.cpp index f824f84714c..3f768f6843b 100644 --- a/src/hotspot/cpu/x86/gc/g1/g1BarrierSetAssembler_x86.cpp +++ b/src/hotspot/cpu/x86/gc/g1/g1BarrierSetAssembler_x86.cpp @@ -30,6 +30,7 @@ #include "gc/g1/g1HeapRegion.hpp" #include "gc/g1/g1ThreadLocalData.hpp" #include "interpreter/interp_masm.hpp" +#include "runtime/arguments.hpp" #include "runtime/sharedRuntime.hpp" #include "utilities/debug.hpp" #include "utilities/macros.hpp" @@ -235,7 +236,7 @@ void G1BarrierSetAssembler::g1_write_barrier_pre(MacroAssembler* masm, __ bind(runtime); - if (EnableValhalla && InlineTypePassFieldsAsArgs) { + if (Arguments::is_valhalla_enabled() && InlineTypePassFieldsAsArgs) { // Barriers might be emitted when converting between (scalarized) calling conventions for inline // types. Save all argument registers before calling into the runtime. // TODO 8366717: use push_set() (see JDK-8283327 push/pop_call_clobbered_registers & aarch64 ) @@ -279,7 +280,7 @@ void G1BarrierSetAssembler::g1_write_barrier_pre(MacroAssembler* masm, __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_field_pre_entry), pre_val, thread); } - if (EnableValhalla && InlineTypePassFieldsAsArgs) { + if (Arguments::is_valhalla_enabled() && InlineTypePassFieldsAsArgs) { // Restore registers __ movdbl(j_farg0, Address(rsp, 0)); __ movdbl(j_farg1, Address(rsp, 8)); diff --git a/src/hotspot/cpu/x86/macroAssembler_x86.cpp b/src/hotspot/cpu/x86/macroAssembler_x86.cpp index 2f5ab26750a..9e077cb63ba 100644 --- a/src/hotspot/cpu/x86/macroAssembler_x86.cpp +++ b/src/hotspot/cpu/x86/macroAssembler_x86.cpp @@ -46,6 +46,7 @@ #include "oops/klass.inline.hpp" #include "oops/resolvedFieldEntry.hpp" #include "prims/methodHandles.hpp" +#include "runtime/arguments.hpp" #include "runtime/continuation.hpp" #include "runtime/interfaceSupport.inline.hpp" #include "runtime/javaThread.hpp" @@ -3647,7 +3648,7 @@ void MacroAssembler::allocate_instance(Register klass, Register new_obj, // initialize object header only. bind(initialize_header); - if (UseCompactObjectHeaders || EnableValhalla) { + if (UseCompactObjectHeaders || Arguments::is_valhalla_enabled()) { pop(klass); Register mark_word = t2; movptr(mark_word, Address(klass, Klass::prototype_header_offset())); diff --git a/src/hotspot/cpu/x86/templateTable_x86.cpp b/src/hotspot/cpu/x86/templateTable_x86.cpp index 5b11edbda1e..aae158fc668 100644 --- a/src/hotspot/cpu/x86/templateTable_x86.cpp +++ b/src/hotspot/cpu/x86/templateTable_x86.cpp @@ -42,6 +42,7 @@ #include "oops/resolvedMethodEntry.hpp" #include "prims/jvmtiExport.hpp" #include "prims/methodHandles.hpp" +#include "runtime/arguments.hpp" #include "runtime/frame.inline.hpp" #include "runtime/safepointMechanism.hpp" #include "runtime/sharedRuntime.hpp" @@ -1131,7 +1132,7 @@ void TemplateTable::aastore() { // Have a null in rax, rdx=array, ecx=index. Store null at ary[idx] __ bind(is_null); - if (EnableValhalla) { + if (Arguments::is_valhalla_enabled()) { Label write_null_to_null_free_array, store_null; // Move array class to rdi @@ -1957,7 +1958,7 @@ void TemplateTable::if_acmp(Condition cc) { __ profile_acmp(rbx, rdx, rax, rcx); const int is_inline_type_mask = markWord::inline_type_pattern; - if (EnableValhalla) { + if (Arguments::is_valhalla_enabled()) { __ cmpoop(rdx, rax); __ jcc(Assembler::equal, (cc == equal) ? taken : not_taken); @@ -2679,7 +2680,7 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr __ cmpl(tos_state, atos); __ jcc(Assembler::notEqual, notObj); // atos - if (!EnableValhalla) { + if (!Arguments::is_valhalla_enabled()) { if (!is_static) pop_and_check_object(obj); do_oop_load(_masm, field, rax); __ push(atos); @@ -2957,7 +2958,7 @@ void TemplateTable::putfield_or_static_helper(int byte_no, bool is_static, Rewri // atos { - if (!EnableValhalla) { + if (!Arguments::is_valhalla_enabled()) { __ pop(atos); if (!is_static) pop_and_check_object(obj); // Store into the field diff --git a/src/hotspot/share/c1/c1_GraphBuilder.cpp b/src/hotspot/share/c1/c1_GraphBuilder.cpp index 258e95a0fa3..c169e84b055 100644 --- a/src/hotspot/share/c1/c1_GraphBuilder.cpp +++ b/src/hotspot/share/c1/c1_GraphBuilder.cpp @@ -42,6 +42,7 @@ #include "interpreter/bytecode.hpp" #include "jfr/jfrEvents.hpp" #include "memory/resourceArea.hpp" +#include "runtime/arguments.hpp" #include "runtime/sharedRuntime.hpp" #include "utilities/checkedCast.hpp" #include "utilities/macros.hpp" @@ -1362,7 +1363,7 @@ void GraphBuilder::if_node(Value x, If::Condition cond, Value y, ValueStack* sta bool is_bb = tsux->bci() < stream()->cur_bci() || fsux->bci() < stream()->cur_bci(); bool subst_check = false; - if (EnableValhalla && (stream()->cur_bc() == Bytecodes::_if_acmpeq || stream()->cur_bc() == Bytecodes::_if_acmpne)) { + if (Arguments::is_valhalla_enabled() && (stream()->cur_bc() == Bytecodes::_if_acmpeq || stream()->cur_bc() == Bytecodes::_if_acmpne)) { ValueType* left_vt = x->type(); ValueType* right_vt = y->type(); if (left_vt->is_object()) { @@ -2566,7 +2567,7 @@ void GraphBuilder::monitorenter(Value x, int bci) { #endif } else { // We are compiling a monitorenter bytecode - if (EnableValhalla) { + if (Arguments::is_valhalla_enabled()) { ciType* obj_type = x->declared_type(); if (obj_type == nullptr || obj_type->as_klass()->can_be_inline_klass()) { // If we're (possibly) locking on an inline type, check for markWord::always_locked_pattern @@ -4301,7 +4302,7 @@ bool GraphBuilder::try_inline_full(ciMethod* callee, bool holder_known, bool ign // Check if we need a membar at the beginning of the java.lang.Object // constructor to satisfy the memory model for strict fields. - if (EnableValhalla && method()->intrinsic_id() == vmIntrinsics::_Object_init) { + if (Arguments::is_valhalla_enabled() && method()->intrinsic_id() == vmIntrinsics::_Object_init) { Value receiver = state()->local_at(0); ciType* klass = receiver->exact_type(); if (klass == nullptr) { diff --git a/src/hotspot/share/c1/c1_LIRGenerator.cpp b/src/hotspot/share/c1/c1_LIRGenerator.cpp index 6df80d904c0..c9511ba2d40 100644 --- a/src/hotspot/share/c1/c1_LIRGenerator.cpp +++ b/src/hotspot/share/c1/c1_LIRGenerator.cpp @@ -42,6 +42,7 @@ #include "gc/shared/c1/barrierSetC1.hpp" #include "oops/klass.inline.hpp" #include "oops/methodCounters.hpp" +#include "runtime/arguments.hpp" #include "runtime/sharedRuntime.hpp" #include "runtime/stubRoutines.hpp" #include "runtime/vm_version.hpp" @@ -3008,7 +3009,7 @@ void LIRGenerator::do_Base(Base* x) { // Check if we need a membar at the beginning of the java.lang.Object // constructor to satisfy the memory model for strict fields. - if (EnableValhalla && method()->intrinsic_id() == vmIntrinsics::_Object_init) { + if (Arguments::is_valhalla_enabled() && method()->intrinsic_id() == vmIntrinsics::_Object_init) { __ membar_storestore(); } diff --git a/src/hotspot/share/cds/aotMappedHeapWriter.cpp b/src/hotspot/share/cds/aotMappedHeapWriter.cpp index 6436b6aaf0b..b6edff11427 100644 --- a/src/hotspot/share/cds/aotMappedHeapWriter.cpp +++ b/src/hotspot/share/cds/aotMappedHeapWriter.cpp @@ -43,6 +43,7 @@ #include "oops/oopHandle.inline.hpp" #include "oops/typeArrayKlass.hpp" #include "oops/typeArrayOop.hpp" +#include "runtime/arguments.hpp" #include "runtime/java.hpp" #include "runtime/mutexLocker.hpp" #include "utilities/bitMap.inline.hpp" @@ -300,7 +301,7 @@ objArrayOop AOTMappedHeapWriter::allocate_root_segment(size_t offset, int elemen if (UseCompactObjectHeaders) { oopDesc::release_set_mark(mem, Universe::objectArrayKlass()->prototype_header()); } else { - assert(!EnableValhalla || Universe::objectArrayKlass()->prototype_header() == markWord::prototype(), "should be the same"); + assert(!Arguments::is_valhalla_enabled() || Universe::objectArrayKlass()->prototype_header() == markWord::prototype(), "should be the same"); oopDesc::set_mark(mem, markWord::prototype()); oopDesc::release_set_klass(mem, Universe::objectArrayKlass()); } @@ -475,7 +476,7 @@ HeapWord* AOTMappedHeapWriter::init_filler_array_at_buffer_top(int array_length, if (UseCompactObjectHeaders) { oopDesc::release_set_mark(mem, markWord::prototype().set_narrow_klass(nk)); } else { - assert(!EnableValhalla || Universe::objectArrayKlass()->prototype_header() == markWord::prototype(), "should be the same"); + assert(!Arguments::is_valhalla_enabled() || Universe::objectArrayKlass()->prototype_header() == markWord::prototype(), "should be the same"); oopDesc::set_mark(mem, markWord::prototype()); cast_to_oop(mem)->set_narrow_klass(nk); } @@ -741,11 +742,11 @@ void AOTMappedHeapWriter::update_header_for_requested_obj(oop requested_obj, oop } // We need to retain the identity_hash, because it may have been used by some hashtables // in the shared heap. - if (!src_obj->fast_no_hash_check() && (!(EnableValhalla && src_obj->mark().is_inline_type()))) { + if (!src_obj->fast_no_hash_check() && (!(Arguments::is_valhalla_enabled() && src_obj->mark().is_inline_type()))) { intptr_t src_hash = src_obj->identity_hash(); if (UseCompactObjectHeaders) { fake_oop->set_mark(fake_oop->mark().copy_set_hash(src_hash)); - } else if (EnableValhalla) { + } else if (Arguments::is_valhalla_enabled()) { fake_oop->set_mark(src_klass->prototype_header().copy_set_hash(src_hash)); } else { fake_oop->set_mark(markWord::prototype().copy_set_hash(src_hash)); diff --git a/src/hotspot/share/cds/aotMetaspace.cpp b/src/hotspot/share/cds/aotMetaspace.cpp index 78c0b3e186f..7c58390c3c4 100644 --- a/src/hotspot/share/cds/aotMetaspace.cpp +++ b/src/hotspot/share/cds/aotMetaspace.cpp @@ -1373,7 +1373,7 @@ bool AOTMetaspace::try_link_class(JavaThread* current, InstanceKlass* ik) { } void VM_PopulateDumpSharedSpace::dump_java_heap_objects() { - if (CDSConfig::is_valhalla_preview()) { + if (Arguments::is_valhalla_enabled()) { log_info(cds)("Archived java heap is not yet supported with Valhalla preview"); return; } diff --git a/src/hotspot/share/cds/cdsConfig.cpp b/src/hotspot/share/cds/cdsConfig.cpp index d630dfff480..f86c0d27dd3 100644 --- a/src/hotspot/share/cds/cdsConfig.cpp +++ b/src/hotspot/share/cds/cdsConfig.cpp @@ -147,7 +147,7 @@ const char* CDSConfig::default_archive_path() { tmp.print_raw("_coh"); } #endif - if (is_valhalla_preview()) { + if (Arguments::is_valhalla_enabled()) { tmp.print_raw("_valhalla"); } tmp.print_raw(".jsa"); @@ -975,7 +975,7 @@ bool CDSConfig::are_vm_options_incompatible_with_dumping_heap() { } bool CDSConfig::is_dumping_heap() { - if (is_valhalla_preview()) { + if (Arguments::is_valhalla_enabled()) { // Not working yet -- e.g., HeapShared::oop_hash() needs to be implemented for value oops return false; } diff --git a/src/hotspot/share/cds/cdsConfig.hpp b/src/hotspot/share/cds/cdsConfig.hpp index 6ea5bfccd97..5924896e978 100644 --- a/src/hotspot/share/cds/cdsConfig.hpp +++ b/src/hotspot/share/cds/cdsConfig.hpp @@ -207,10 +207,6 @@ class CDSConfig : public AllStatic { static void stop_dumping_full_module_graph(const char* reason = nullptr) NOT_CDS_JAVA_HEAP_RETURN; static void stop_using_full_module_graph(const char* reason = nullptr) NOT_CDS_JAVA_HEAP_RETURN; - static bool is_valhalla_preview() { - return Arguments::enable_preview() && EnableValhalla; - } - // --- AOT code static bool is_dumping_aot_code() NOT_CDS_RETURN_(false); diff --git a/src/hotspot/share/cds/filemap.cpp b/src/hotspot/share/cds/filemap.cpp index 948e1fad40d..3bb6175eb0d 100644 --- a/src/hotspot/share/cds/filemap.cpp +++ b/src/hotspot/share/cds/filemap.cpp @@ -313,7 +313,7 @@ void FileMapHeader::populate(FileMapInfo *info, size_t core_region_alignment, _use_optimized_module_handling = CDSConfig::is_using_optimized_module_handling(); _has_aot_linked_classes = CDSConfig::is_dumping_aot_linked_classes(); _has_full_module_graph = CDSConfig::is_dumping_full_module_graph(); - _has_valhalla_patched_classes = CDSConfig::is_valhalla_preview(); + _has_valhalla_patched_classes = Arguments::is_valhalla_enabled(); // The following fields are for sanity checks for whether this archive // will function correctly with this JVM and the bootclasspath it's @@ -1993,7 +1993,7 @@ bool FileMapHeader::validate() { if (is_static()) { const char* err = nullptr; - if (CDSConfig::is_valhalla_preview()) { + if (Arguments::is_valhalla_enabled()) { if (!_has_valhalla_patched_classes) { err = "not created"; } @@ -2003,7 +2003,7 @@ bool FileMapHeader::validate() { } } if (err != nullptr) { - log_warning(cds)("This archive was %s with --enable-preview -XX:+EnableValhalla. It is " + log_warning(cds)("This archive was %s with --enable-preview. It is " "incompatible with the current JVM setting", err); return false; } diff --git a/src/hotspot/share/cds/filemap.hpp b/src/hotspot/share/cds/filemap.hpp index af678bc0936..3545e701f77 100644 --- a/src/hotspot/share/cds/filemap.hpp +++ b/src/hotspot/share/cds/filemap.hpp @@ -101,7 +101,6 @@ class FileMapRegion: private CDSFileMapRegion { }; #define CDS_MUST_MATCH_FLAGS_DO(f) \ - f(EnableValhalla) \ f(UseArrayFlattening) \ f(UseFieldFlattening) \ f(InlineTypePassFieldsAsArgs) \ @@ -173,7 +172,7 @@ class FileMapHeader: private CDSFileMapHeaderBase { // some expensive operations. bool _has_aot_linked_classes; // Was the CDS archive created with -XX:+AOTClassLinking bool _has_full_module_graph; // Does this CDS archive contain the full archived module graph? - bool _has_valhalla_patched_classes; // Is this archived dumped with --enable-preview -XX:+EnableValhalla? + bool _has_valhalla_patched_classes; // Is this archived dumped with --enable-preview CDSMustMatchFlags _must_match; // These flags must be the same between dumptime and runtime size_t _rw_ptrmap_start_pos; // The first bit in the ptrmap corresponds to this position in the rw region size_t _ro_ptrmap_start_pos; // The first bit in the ptrmap corresponds to this position in the ro region diff --git a/src/hotspot/share/cds/heapShared.cpp b/src/hotspot/share/cds/heapShared.cpp index 679d99754b1..9be1b6eacd2 100644 --- a/src/hotspot/share/cds/heapShared.cpp +++ b/src/hotspot/share/cds/heapShared.cpp @@ -2260,7 +2260,7 @@ void HeapShared::archive_object_subgraphs(ArchivableStaticFieldInfo fields[], ArchivableStaticFieldInfo* info = &fields[i]; const char* klass_name = info->klass_name; - if (CDSConfig::is_valhalla_preview() && strcmp(klass_name, "jdk/internal/module/ArchivedModuleGraph") == 0) { + if (Arguments::is_valhalla_enabled() && strcmp(klass_name, "jdk/internal/module/ArchivedModuleGraph") == 0) { // FIXME -- ArchivedModuleGraph doesn't work when java.base is patched with valhalla classes. i++; continue; diff --git a/src/hotspot/share/ci/ciInstanceKlass.cpp b/src/hotspot/share/ci/ciInstanceKlass.cpp index 368a9b2c900..3d319f5f3f5 100644 --- a/src/hotspot/share/ci/ciInstanceKlass.cpp +++ b/src/hotspot/share/ci/ciInstanceKlass.cpp @@ -38,6 +38,7 @@ #include "oops/instanceKlass.inline.hpp" #include "oops/klass.inline.hpp" #include "oops/oop.inline.hpp" +#include "runtime/arguments.hpp" #include "runtime/fieldDescriptor.inline.hpp" #include "runtime/handles.inline.hpp" #include "runtime/jniHandles.inline.hpp" @@ -726,7 +727,7 @@ ciInstanceKlass* ciInstanceKlass::implementor() { } bool ciInstanceKlass::can_be_inline_klass(bool is_exact) { - if (!EnableValhalla) { + if (!Arguments::is_valhalla_enabled()) { return false; } if (!is_loaded() || is_inlinetype()) { diff --git a/src/hotspot/share/ci/ciKlass.hpp b/src/hotspot/share/ci/ciKlass.hpp index 711adc56544..95f15f0d2dd 100644 --- a/src/hotspot/share/ci/ciKlass.hpp +++ b/src/hotspot/share/ci/ciKlass.hpp @@ -27,6 +27,7 @@ #include "ci/ciType.hpp" #include "oops/klass.hpp" +#include "runtime/arguments.hpp" // ciKlass // @@ -111,7 +112,7 @@ class ciKlass : public ciType { } virtual bool can_be_inline_array_klass() { - return EnableValhalla && is_java_lang_Object(); + return Arguments::is_valhalla_enabled() && is_java_lang_Object(); } bool is_in_encoding_range() { diff --git a/src/hotspot/share/classfile/classFileParser.cpp b/src/hotspot/share/classfile/classFileParser.cpp index 0d14f7828b7..e14d8f6dfe4 100644 --- a/src/hotspot/share/classfile/classFileParser.cpp +++ b/src/hotspot/share/classfile/classFileParser.cpp @@ -2267,7 +2267,7 @@ Method* ClassFileParser::parse_method(const ClassFileStream* const cfs, return nullptr; } - if (EnableValhalla) { + if (Arguments::is_valhalla_enabled()) { if (((flags & JVM_ACC_SYNCHRONIZED) == JVM_ACC_SYNCHRONIZED) && ((flags & JVM_ACC_STATIC) == 0 ) && !_access_flags.is_identity_class()) { @@ -3786,7 +3786,7 @@ void ClassFileParser::parse_classfile_attributes(const ClassFileStream* const cf permitted_subclasses_attribute_start = cfs->current(); permitted_subclasses_attribute_length = attribute_length; } - if (EnableValhalla && tag == vmSymbols::tag_loadable_descriptors()) { + if (Arguments::is_valhalla_enabled() && tag == vmSymbols::tag_loadable_descriptors()) { if (parsed_loadable_descriptors_attribute) { classfile_parse_error("Multiple LoadableDescriptors attributes in class file %s", CHECK); return; @@ -5542,7 +5542,7 @@ void ClassFileParser::fill_instance_klass(InstanceKlass* ik, vk->initialize_calling_convention(CHECK); } - if (EnableValhalla && !access_flags().is_identity_class() && !access_flags().is_interface() + if (Arguments::is_valhalla_enabled() && !access_flags().is_identity_class() && !access_flags().is_interface() && _class_name != vmSymbols::java_lang_Object() && UseAltSubstitutabilityMethod) { // Both abstract and concrete value classes need a field map for acmp ik->set_acmp_maps_offset(_layout_info->_acmp_maps_offset); @@ -6143,7 +6143,7 @@ void ClassFileParser::post_process_parsed_stream(const ClassFileStream* const st return; } - if (EnableValhalla) { + if (Arguments::is_valhalla_enabled()) { check_identity_and_value_modifiers(this, _super_klass, CHECK); } @@ -6159,7 +6159,7 @@ void ClassFileParser::post_process_parsed_stream(const ClassFileStream* const st } // Determining is the class allows tearing or not (default is not) - if (EnableValhalla && !_access_flags.is_identity_class()) { + if (Arguments::is_valhalla_enabled() && !_access_flags.is_identity_class()) { if (_parsed_annotations->has_annotation(ClassAnnotationCollector::_jdk_internal_LooselyConsistentValue) && (_super_klass == vmClasses::Object_klass() || !_super_klass->must_be_atomic())) { // Conditions above are not sufficient to determine atomicity requirements, @@ -6212,7 +6212,7 @@ void ClassFileParser::post_process_parsed_stream(const ClassFileStream* const st interf->class_in_module_of_loader())); } - if (EnableValhalla) { + if (Arguments::is_valhalla_enabled()) { // Check modifiers and set carries_identity_modifier/carries_value_modifier flags check_identity_and_value_modifiers(this, InstanceKlass::cast(interf), CHECK); } @@ -6257,7 +6257,7 @@ void ClassFileParser::post_process_parsed_stream(const ClassFileStream* const st assert(_parsed_annotations != nullptr, "invariant"); - if (EnableValhalla) { + if (Arguments::is_valhalla_enabled()) { _inline_layout_info_array = MetadataFactory::new_array(_loader_data, java_fields_count(), CHECK); diff --git a/src/hotspot/share/classfile/classLoader.cpp b/src/hotspot/share/classfile/classLoader.cpp index 0d32701815b..9422bd31b56 100644 --- a/src/hotspot/share/classfile/classLoader.cpp +++ b/src/hotspot/share/classfile/classLoader.cpp @@ -1119,12 +1119,12 @@ InstanceKlass* ClassLoader::load_class(Symbol* name, PackageEntry* pkg_entry, bo // appear in the _patch_mod_entries. The runtime shared class visibility // check will determine if a shared class is visible based on the runtime // environment, including the runtime --patch-module setting. - if (!CDSConfig::is_valhalla_preview()) { + if (!Arguments::is_valhalla_enabled()) { // Dynamic dumping requires UseSharedSpaces to be enabled. Since --patch-module // is not supported with UseSharedSpaces, we can never come here during dynamic dumping. assert(!CDSConfig::is_dumping_archive(), "CDS doesn't support --patch-module during dumping"); } - if (CDSConfig::is_valhalla_preview() || !CDSConfig::is_dumping_static_archive()) { + if (Arguments::is_valhalla_enabled() || !CDSConfig::is_dumping_static_archive()) { stream = search_module_entries(THREAD, _patch_mod_entries, pkg_entry, file_name); if (stream != nullptr) { is_patched = true; diff --git a/src/hotspot/share/gc/shared/memAllocator.cpp b/src/hotspot/share/gc/shared/memAllocator.cpp index e1a4062761c..99af3bd9524 100644 --- a/src/hotspot/share/gc/shared/memAllocator.cpp +++ b/src/hotspot/share/gc/shared/memAllocator.cpp @@ -33,6 +33,7 @@ #include "oops/arrayOop.hpp" #include "oops/oop.inline.hpp" #include "prims/jvmtiExport.hpp" +#include "runtime/arguments.hpp" #include "runtime/continuationJavaClasses.inline.hpp" #include "runtime/handles.inline.hpp" #include "runtime/javaThread.hpp" @@ -380,7 +381,7 @@ oop MemAllocator::finish(HeapWord* mem) const { if (UseCompactObjectHeaders) { oopDesc::release_set_mark(mem, _klass->prototype_header()); } else { - if (EnableValhalla) { + if (Arguments::is_valhalla_enabled()) { oopDesc::set_mark(mem, _klass->prototype_header()); } else { oopDesc::set_mark(mem, markWord::prototype()); diff --git a/src/hotspot/share/gc/z/zObjArrayAllocator.cpp b/src/hotspot/share/gc/z/zObjArrayAllocator.cpp index 6eff34e183d..21c3c06eb7a 100644 --- a/src/hotspot/share/gc/z/zObjArrayAllocator.cpp +++ b/src/hotspot/share/gc/z/zObjArrayAllocator.cpp @@ -26,6 +26,7 @@ #include "gc/z/zThreadLocalData.hpp" #include "gc/z/zUtils.inline.hpp" #include "oops/arrayKlass.hpp" +#include "runtime/arguments.hpp" #include "runtime/interfaceSupport.inline.hpp" #include "utilities/debug.hpp" #include "utilities/globalDefinitions.hpp" @@ -67,7 +68,7 @@ oop ZObjArrayAllocator::initialize(HeapWord* mem) const { if (UseCompactObjectHeaders) { oopDesc::release_set_mark(mem, _klass->prototype_header().set_marked()); } else { - if (EnableValhalla) { + if (Arguments::is_valhalla_enabled()) { arrayOopDesc::set_mark(mem, _klass->prototype_header().set_marked()); } else { arrayOopDesc::set_mark(mem, markWord::prototype().set_marked()); @@ -161,7 +162,7 @@ oop ZObjArrayAllocator::initialize(HeapWord* mem) const { ZThreadLocalData::clear_invisible_root(_thread); // Signal to the ZIterator that this is no longer an invisible root - if (UseCompactObjectHeaders || EnableValhalla) { + if (UseCompactObjectHeaders || Arguments::is_valhalla_enabled()) { oopDesc::release_set_mark(mem, _klass->prototype_header()); } else { oopDesc::release_set_mark(mem, markWord::prototype()); diff --git a/src/hotspot/share/interpreter/abstractInterpreter.cpp b/src/hotspot/share/interpreter/abstractInterpreter.cpp index 68b596b807d..854aaaeca7c 100644 --- a/src/hotspot/share/interpreter/abstractInterpreter.cpp +++ b/src/hotspot/share/interpreter/abstractInterpreter.cpp @@ -41,6 +41,7 @@ #include "oops/oop.inline.hpp" #include "prims/jvmtiExport.hpp" #include "prims/methodHandles.hpp" +#include "runtime/arguments.hpp" #include "runtime/handles.inline.hpp" #include "runtime/sharedRuntime.hpp" #include "runtime/stubRoutines.hpp" @@ -156,7 +157,7 @@ AbstractInterpreter::MethodKind AbstractInterpreter::method_kind(const methodHan // No need to use the method kind with a memory barrier on entry // because the method is empty and already has a memory barrier on return return zerolocals; - } else if (EnableValhalla) { + } else if (Arguments::is_valhalla_enabled()) { // For non-empty Object constructors, we need a memory barrier // when entering the method to ensure correctness of strict fields return object_init; diff --git a/src/hotspot/share/oops/arrayOop.hpp b/src/hotspot/share/oops/arrayOop.hpp index 5e2c9397005..86f7ee523e5 100644 --- a/src/hotspot/share/oops/arrayOop.hpp +++ b/src/hotspot/share/oops/arrayOop.hpp @@ -56,7 +56,7 @@ class arrayOopDesc : public oopDesc { // Given a type, return true if elements of that type must be aligned to 64-bit. static bool element_type_should_be_aligned(BasicType type) { - if (EnableValhalla && type == T_FLAT_ELEMENT) { + if (type == T_FLAT_ELEMENT) { return true; //CMH: tighten the alignment when removing T_FLAT_ELEMENT } #ifdef _LP64 diff --git a/src/hotspot/share/oops/flatArrayKlass.cpp b/src/hotspot/share/oops/flatArrayKlass.cpp index e348e7ec7bc..225f5318bd4 100644 --- a/src/hotspot/share/oops/flatArrayKlass.cpp +++ b/src/hotspot/share/oops/flatArrayKlass.cpp @@ -372,7 +372,7 @@ u2 FlatArrayKlass::compute_modifier_flags() const { // With the addition of ACC_IDENTITY u2 element_flags = element_klass()->compute_modifier_flags(); - u2 identity_flag = (Arguments::enable_preview()) ? JVM_ACC_IDENTITY : 0; + u2 identity_flag = (Arguments::is_valhalla_enabled()) ? JVM_ACC_IDENTITY : 0; return (element_flags & (JVM_ACC_PUBLIC | JVM_ACC_PRIVATE | JVM_ACC_PROTECTED)) | (identity_flag | JVM_ACC_ABSTRACT | JVM_ACC_FINAL); diff --git a/src/hotspot/share/oops/instanceKlass.cpp b/src/hotspot/share/oops/instanceKlass.cpp index fae170b8dbf..c3afcc3325b 100644 --- a/src/hotspot/share/oops/instanceKlass.cpp +++ b/src/hotspot/share/oops/instanceKlass.cpp @@ -1099,7 +1099,7 @@ bool InstanceKlass::link_class_impl(TRAPS) { interk->link_class_impl(CHECK_false); } - if (EnableValhalla) { + if (Arguments::is_valhalla_enabled()) { // Aggressively preloading all classes from the LoadableDescriptors attribute // so inline classes can be scalarized in the calling conventions computed below load_classes_from_loadable_descriptors_attribute(this, THREAD); diff --git a/src/hotspot/share/oops/markWord.hpp b/src/hotspot/share/oops/markWord.hpp index 8aa79fb4449..8f9e157dcde 100644 --- a/src/hotspot/share/oops/markWord.hpp +++ b/src/hotspot/share/oops/markWord.hpp @@ -131,7 +131,7 @@ class markWord { static const int self_fwd_bits = 1; // instance state static const int age_bits = 4; - // EnableValhalla: static prototype header bits (fast path instead of klass layout_helper) + // prototype header bits (fast path instead of klass layout_helper) static const int inline_type_bits = 1; static const int null_free_array_bits = LP64_ONLY(1) NOT_LP64(0); static const int flat_array_bits = LP64_ONLY(1) NOT_LP64(0); @@ -246,8 +246,7 @@ class markWord { // Should this header be preserved during GC? bool must_be_preserved() const { - return (!is_unlocked() || !has_no_hash() || - (EnableValhalla && (is_larval_state() || is_inline_type() || is_flat_array() || is_null_free_array()))); + return (!is_unlocked() || !has_no_hash() || is_larval_state() || is_inline_type() || is_flat_array() || is_null_free_array()); } // WARNING: The following routines are used EXCLUSIVELY by diff --git a/src/hotspot/share/oops/method.cpp b/src/hotspot/share/oops/method.cpp index 1cf256fbdc1..d5b2799b1a6 100644 --- a/src/hotspot/share/oops/method.cpp +++ b/src/hotspot/share/oops/method.cpp @@ -407,7 +407,7 @@ Symbol* Method::klass_name() const { void Method::metaspace_pointers_do(MetaspaceClosure* it) { log_trace(aot)("Iter(Method): %p", this); - if (!method_holder()->is_rewritten() || CDSConfig::is_valhalla_preview()) { + if (!method_holder()->is_rewritten() || Arguments::is_valhalla_enabled()) { it->push(&_constMethod, MetaspaceClosure::_writable); } else { it->push(&_constMethod); diff --git a/src/hotspot/share/oops/objArrayKlass.cpp b/src/hotspot/share/oops/objArrayKlass.cpp index f00f46b7703..761d06320e8 100644 --- a/src/hotspot/share/oops/objArrayKlass.cpp +++ b/src/hotspot/share/oops/objArrayKlass.cpp @@ -376,7 +376,7 @@ u2 ObjArrayKlass::compute_modifier_flags() const { // Return the flags of the bottom element type. u2 element_flags = bottom_klass()->compute_modifier_flags(); - int identity_flag = (Arguments::enable_preview()) ? JVM_ACC_IDENTITY : 0; + int identity_flag = (Arguments::is_valhalla_enabled()) ? JVM_ACC_IDENTITY : 0; return (element_flags & (JVM_ACC_PUBLIC | JVM_ACC_PRIVATE | JVM_ACC_PROTECTED)) | (identity_flag | JVM_ACC_ABSTRACT | JVM_ACC_FINAL); diff --git a/src/hotspot/share/oops/oop.inline.hpp b/src/hotspot/share/oops/oop.inline.hpp index 4d775b6973f..5c9e7cb74cd 100644 --- a/src/hotspot/share/oops/oop.inline.hpp +++ b/src/hotspot/share/oops/oop.inline.hpp @@ -37,6 +37,7 @@ #include "oops/markWord.inline.hpp" #include "oops/objLayout.inline.hpp" #include "oops/oopsHierarchy.hpp" +#include "runtime/arguments.hpp" #include "runtime/atomicAccess.hpp" #include "runtime/globals.hpp" #include "utilities/align.hpp" @@ -83,7 +84,7 @@ markWord oopDesc::cas_set_mark(markWord new_mark, markWord old_mark, atomic_memo } markWord oopDesc::prototype_mark() const { - if (UseCompactObjectHeaders || EnableValhalla) { + if (UseCompactObjectHeaders || Arguments::is_valhalla_enabled()) { return klass()->prototype_header(); } else { return markWord::prototype(); diff --git a/src/hotspot/share/oops/typeArrayKlass.cpp b/src/hotspot/share/oops/typeArrayKlass.cpp index baf479e906d..23a4b207b4f 100644 --- a/src/hotspot/share/oops/typeArrayKlass.cpp +++ b/src/hotspot/share/oops/typeArrayKlass.cpp @@ -76,7 +76,7 @@ TypeArrayKlass* TypeArrayKlass::allocate_klass(ClassLoaderData* loader_data, Bas } u2 TypeArrayKlass::compute_modifier_flags() const { - u2 identity_flag = (Arguments::enable_preview()) ? JVM_ACC_IDENTITY : 0; + u2 identity_flag = (Arguments::is_valhalla_enabled()) ? JVM_ACC_IDENTITY : 0; return JVM_ACC_ABSTRACT | JVM_ACC_FINAL | JVM_ACC_PUBLIC | identity_flag; diff --git a/src/hotspot/share/opto/callnode.cpp b/src/hotspot/share/opto/callnode.cpp index 9dbe17f7400..fb6431b716b 100644 --- a/src/hotspot/share/opto/callnode.cpp +++ b/src/hotspot/share/opto/callnode.cpp @@ -44,6 +44,7 @@ #include "opto/regmask.hpp" #include "opto/rootnode.hpp" #include "opto/runtime.hpp" +#include "runtime/arguments.hpp" #include "runtime/sharedRuntime.hpp" #include "runtime/stubRoutines.hpp" #include "utilities/powerOfTwo.hpp" @@ -1123,7 +1124,7 @@ bool CallJavaNode::validate_symbolic_info() const { return true; // call into runtime or uncommon trap } Bytecodes::Code bc = jvms()->method()->java_code_at_bci(jvms()->bci()); - if (EnableValhalla && (bc == Bytecodes::_if_acmpeq || bc == Bytecodes::_if_acmpne)) { + if (Arguments::is_valhalla_enabled() && (bc == Bytecodes::_if_acmpeq || bc == Bytecodes::_if_acmpne)) { return true; } ciMethod* symbolic_info = jvms()->method()->get_method_at_bci(jvms()->bci()); @@ -1940,11 +1941,12 @@ void AllocateNode::compute_MemBar_redundancy(ciMethod* initializer) Node* AllocateNode::make_ideal_mark(PhaseGVN* phase, Node* control, Node* mem) { Node* mark_node = nullptr; - if (UseCompactObjectHeaders || EnableValhalla) { + if (UseCompactObjectHeaders || Arguments::is_valhalla_enabled()) { Node* klass_node = in(AllocateNode::KlassNode); Node* proto_adr = phase->transform(new AddPNode(klass_node, klass_node, phase->MakeConX(in_bytes(Klass::prototype_header_offset())))); mark_node = LoadNode::make(*phase, control, mem, proto_adr, TypeRawPtr::BOTTOM, TypeX_X, TypeX_X->basic_type(), MemNode::unordered); - if (EnableValhalla) { + // EnavleValhalla legacy + if (Arguments::is_valhalla_enabled()) { mark_node = phase->transform(mark_node); // Avoid returning a constant (old node) here because this method is used by LoadNode::Ideal mark_node = new OrXNode(mark_node, phase->MakeConX(_larval ? markWord::larval_bit_in_place : 0)); diff --git a/src/hotspot/share/opto/cfgnode.hpp b/src/hotspot/share/opto/cfgnode.hpp index 913e15de2af..5d6c788db01 100644 --- a/src/hotspot/share/opto/cfgnode.hpp +++ b/src/hotspot/share/opto/cfgnode.hpp @@ -29,6 +29,7 @@ #include "opto/node.hpp" #include "opto/opcodes.hpp" #include "opto/predicates_enums.hpp" +#include "runtime/arguments.hpp" #include "opto/type.hpp" // Portions of code courtesy of Clifford Click @@ -260,7 +261,7 @@ class PhiNode : public TypeNode { } bool can_be_inline_type() const { - return EnableValhalla && _type->isa_instptr() && _type->is_instptr()->can_be_inline_type(); + return Arguments::is_valhalla_enabled() && _type->isa_instptr() && _type->is_instptr()->can_be_inline_type(); } Node* try_push_inline_types_down(PhaseGVN* phase, bool can_reshape); diff --git a/src/hotspot/share/opto/compile.cpp b/src/hotspot/share/opto/compile.cpp index 6517e0a61e2..b5e062e5075 100644 --- a/src/hotspot/share/opto/compile.cpp +++ b/src/hotspot/share/opto/compile.cpp @@ -82,6 +82,7 @@ #include "opto/type.hpp" #include "opto/vector.hpp" #include "opto/vectornode.hpp" +#include "runtime/arguments.hpp" #include "runtime/globals_extension.hpp" #include "runtime/sharedRuntime.hpp" #include "runtime/signature.hpp" @@ -5578,7 +5579,7 @@ void Compile::remove_speculative_types(PhaseIterGVN &igvn) { Node* Compile::optimize_acmp(PhaseGVN* phase, Node* a, Node* b) { const TypeInstPtr* ta = phase->type(a)->isa_instptr(); const TypeInstPtr* tb = phase->type(b)->isa_instptr(); - if (!EnableValhalla || ta == nullptr || tb == nullptr || + if (!Arguments::is_valhalla_enabled() || ta == nullptr || tb == nullptr || ta->is_zero_type() || tb->is_zero_type() || !ta->can_be_inline_type() || !tb->can_be_inline_type()) { // Use old acmp if one operand is null or not an inline type diff --git a/src/hotspot/share/opto/graphKit.cpp b/src/hotspot/share/opto/graphKit.cpp index 69cd035d015..3389a13f829 100644 --- a/src/hotspot/share/opto/graphKit.cpp +++ b/src/hotspot/share/opto/graphKit.cpp @@ -50,6 +50,7 @@ #include "opto/runtime.hpp" #include "opto/subtypenode.hpp" #include "runtime/deoptimization.hpp" +#include "runtime/arguments.hpp" #include "runtime/sharedRuntime.hpp" #include "runtime/stubRoutines.hpp" #include "utilities/bitMap.inline.hpp" @@ -1921,7 +1922,7 @@ Node* GraphKit::load_array_element(Node* ary, Node* idx, const TypeAryPtr* aryty // Arguments (pre-popped from the stack) are taken from the JVMS. void GraphKit::set_arguments_for_java_call(CallJavaNode* call, bool is_late_inline) { PreserveReexecuteState preexecs(this); - if (EnableValhalla) { + if (Arguments::is_valhalla_enabled()) { // Make sure the call is "re-executed", if buffering of inline type arguments triggers deoptimization. // At this point, the call hasn't been executed yet, so we will only ever execute the call once. jvms()->set_should_reexecute(true); @@ -3742,7 +3743,7 @@ Node* GraphKit::gen_checkcast(Node* obj, Node* superklass, Node* *failure_contro bool not_inline = !toop->can_be_inline_type(); bool not_flat_in_array = !UseArrayFlattening || not_inline || (toop->is_inlinetypeptr() && !toop->inline_klass()->maybe_flat_in_array()); - if (EnableValhalla && (not_inline || not_flat_in_array)) { + if (Arguments::is_valhalla_enabled() && (not_inline || not_flat_in_array)) { // Check if obj has been loaded from an array obj = obj->isa_DecodeN() ? obj->in(1) : obj; Node* array = nullptr; diff --git a/src/hotspot/share/opto/memnode.cpp b/src/hotspot/share/opto/memnode.cpp index 87574d3c097..6e6ee62ac16 100644 --- a/src/hotspot/share/opto/memnode.cpp +++ b/src/hotspot/share/opto/memnode.cpp @@ -54,6 +54,7 @@ #include "opto/rootnode.hpp" #include "opto/traceMergeStoresTag.hpp" #include "opto/vectornode.hpp" +#include "runtime/arguments.hpp" #include "utilities/align.hpp" #include "utilities/copy.hpp" #include "utilities/globalDefinitions.hpp" @@ -2420,7 +2421,7 @@ const Type* LoadNode::Value(PhaseGVN* phase) const { if (!UseCompactObjectHeaders) { Node* alloc = is_new_object_mark_load(); if (alloc != nullptr) { - if (EnableValhalla) { + if (Arguments::is_valhalla_enabled()) { // The mark word may contain property bits (inline, flat, null-free) Node* klass_node = alloc->in(AllocateNode::KlassNode); const TypeKlassPtr* tkls = phase->type(klass_node)->isa_klassptr(); diff --git a/src/hotspot/share/opto/parse1.cpp b/src/hotspot/share/opto/parse1.cpp index 4309e0deaf4..9fe7e3f1971 100644 --- a/src/hotspot/share/opto/parse1.cpp +++ b/src/hotspot/share/opto/parse1.cpp @@ -39,6 +39,7 @@ #include "opto/rootnode.hpp" #include "opto/runtime.hpp" #include "opto/type.hpp" +#include "runtime/arguments.hpp" #include "runtime/handles.inline.hpp" #include "runtime/safepointMechanism.hpp" #include "runtime/sharedRuntime.hpp" @@ -1285,7 +1286,7 @@ void Parse::do_method_entry() { // Check if we need a membar at the beginning of the java.lang.Object // constructor to satisfy the memory model for strict fields. - if (EnableValhalla && method()->intrinsic_id() == vmIntrinsics::_Object_init) { + if (Arguments::is_valhalla_enabled() && method()->intrinsic_id() == vmIntrinsics::_Object_init) { Node* receiver_obj = local(0); const TypeInstPtr* receiver_type = _gvn.type(receiver_obj)->isa_instptr(); // If there's no exact type, check if the declared type has no implementors and add a dependency diff --git a/src/hotspot/share/opto/parse2.cpp b/src/hotspot/share/opto/parse2.cpp index 20e8d1fbf65..4f6466a8e87 100644 --- a/src/hotspot/share/opto/parse2.cpp +++ b/src/hotspot/share/opto/parse2.cpp @@ -45,6 +45,7 @@ #include "opto/opaquenode.hpp" #include "opto/parse.hpp" #include "opto/runtime.hpp" +#include "runtime/arguments.hpp" #include "runtime/deoptimization.hpp" #include "runtime/sharedRuntime.hpp" @@ -2103,7 +2104,7 @@ void Parse::do_acmp(BoolTest::mask btest, Node* left, Node* right) { record_profile_for_speculation(right, right_type, right_ptr); } - if (!EnableValhalla) { + if (!Arguments::is_valhalla_enabled()) { Node* cmp = CmpP(left, right); cmp = optimize_cmp_with_klass(cmp); do_if(btest, cmp); diff --git a/src/hotspot/share/opto/subnode.cpp b/src/hotspot/share/opto/subnode.cpp index 12e726dca10..8023f282c59 100644 --- a/src/hotspot/share/opto/subnode.cpp +++ b/src/hotspot/share/opto/subnode.cpp @@ -38,6 +38,7 @@ #include "opto/opcodes.hpp" #include "opto/phaseX.hpp" #include "opto/subnode.hpp" +#include "runtime/arguments.hpp" #include "runtime/sharedRuntime.hpp" #include "utilities/reverse_bits.hpp" @@ -945,7 +946,7 @@ bool CmpLNode::is_double_null_check(PhaseGVN* phase, Node*& a, Node*& b) const { in(1)->in(1)->Opcode() == Op_CastP2X && in(1)->in(2)->Opcode() == Op_CastP2X && in(2)->bottom_type()->is_zero_type()) { - assert(EnableValhalla, "unexpected double null check"); + assert(Arguments::is_valhalla_enabled(), "unexpected double null check"); a = in(1)->in(1)->in(1); b = in(1)->in(2)->in(1); return true; diff --git a/src/hotspot/share/prims/jvm.cpp b/src/hotspot/share/prims/jvm.cpp index 76c0b374d84..096a96b2d5c 100644 --- a/src/hotspot/share/prims/jvm.cpp +++ b/src/hotspot/share/prims/jvm.cpp @@ -760,7 +760,7 @@ JVM_ENTRY(jint, JVM_IHashCode(JNIEnv* env, jobject handle)) return 0; } oop obj = JNIHandles::resolve_non_null(handle); - if (EnableValhalla && obj->klass()->is_inline_klass()) { + if (Arguments::is_valhalla_enabled() && obj->klass()->is_inline_klass()) { JavaValue result(T_INT); JavaCallArguments args; Handle ho(THREAD, obj); @@ -3376,7 +3376,7 @@ JVM_LEAF(jboolean, JVM_IsPreviewEnabled(void)) JVM_END JVM_LEAF(jboolean, JVM_IsValhallaEnabled(void)) - return EnableValhalla ? JNI_TRUE : JNI_FALSE; + return Arguments::is_valhalla_enabled() ? JNI_TRUE : JNI_FALSE; JVM_END JVM_LEAF(jboolean, JVM_IsContinuationsSupported(void)) diff --git a/src/hotspot/share/runtime/arguments.cpp b/src/hotspot/share/runtime/arguments.cpp index 51852f2b6c2..5d7cbad04c1 100644 --- a/src/hotspot/share/runtime/arguments.cpp +++ b/src/hotspot/share/runtime/arguments.cpp @@ -549,6 +549,7 @@ static SpecialFlag const special_jvm_flags[] = { { "RequireSharedSpaces", JDK_Version::jdk(18), JDK_Version::jdk(19), JDK_Version::undefined() }, { "UseSharedSpaces", JDK_Version::jdk(18), JDK_Version::jdk(19), JDK_Version::undefined() }, { "LockingMode", JDK_Version::jdk(24), JDK_Version::jdk(26), JDK_Version::jdk(27) }, + { "EnableValhalla", JDK_Version::jdk(25), JDK_Version::jdk(26), JDK_Version::undefined() }, #ifdef _LP64 { "UseCompressedClassPointers", JDK_Version::jdk(25), JDK_Version::jdk(27), JDK_Version::undefined() }, #endif @@ -2115,8 +2116,8 @@ bool Arguments::disable_preview_patching() { // Finalize --patch-module args and --enable-preview related to value class module patches. // Create all numbered properties passing module patches. int Arguments::finalize_patch_module() { - // If --enable-preview and EnableValhalla is true, modules may have preview mode resources. - bool enable_valhalla_preview = enable_preview() && EnableValhalla; + // If --enable-preview is true, modules may have preview mode resources. + bool enable_valhalla_preview = is_valhalla_enabled(); // Whether to use module patching, or the new preview mode feature for preview resources. bool disable_patching = disable_preview_patching(); @@ -2459,10 +2460,6 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, JVMFlagOrigin // --enable_preview } else if (match_option(option, "--enable-preview")) { set_enable_preview(); - // --enable-preview enables Valhalla, EnableValhalla VM option will eventually be removed before integration - if (FLAG_SET_CMDLINE(EnableValhalla, true) != JVMFlag::SUCCESS) { - return JNI_EINVAL; - } // -Xnoclassgc } else if (match_option(option, "-Xnoclassgc")) { if (FLAG_SET_CMDLINE(ClassUnloading, false) != JVMFlag::SUCCESS) { @@ -4005,7 +4002,7 @@ jint Arguments::apply_ergo() { log_info(verification)("Turning on remote verification because local verification is on"); FLAG_SET_DEFAULT(BytecodeVerificationRemote, true); } - if (!EnableValhalla || (is_interpreter_only() && !CDSConfig::is_dumping_archive() && !UseSharedSpaces)) { + if (is_valhalla_enabled() || (is_interpreter_only() && !CDSConfig::is_dumping_archive() && !UseSharedSpaces)) { // Disable calling convention optimizations if inline types are not supported. // Also these aren't useful in -Xint. However, don't disable them when dumping or using // the CDS archive, as the values must match between dumptime and runtime. diff --git a/src/hotspot/share/runtime/arguments.hpp b/src/hotspot/share/runtime/arguments.hpp index bef969f1c44..2b8b2532461 100644 --- a/src/hotspot/share/runtime/arguments.hpp +++ b/src/hotspot/share/runtime/arguments.hpp @@ -518,6 +518,10 @@ class Arguments : AllStatic { // preview features static void set_enable_preview() { _enable_preview = true; } static bool enable_preview() { return _enable_preview; } + static bool is_valhalla_enabled() { + // Valhalla is a feature opted-in by --enable-preview + return enable_preview(); + } // jdwp static bool has_jdwp_agent() { return _has_jdwp_agent; } diff --git a/src/hotspot/share/runtime/globals.hpp b/src/hotspot/share/runtime/globals.hpp index 083ddeca5ec..a695e9d44c7 100644 --- a/src/hotspot/share/runtime/globals.hpp +++ b/src/hotspot/share/runtime/globals.hpp @@ -1975,9 +1975,6 @@ const int ObjectAlignmentInBytes = 8; product(bool, UseFastUnorderedTimeStamps, false, EXPERIMENTAL, \ "Use platform unstable time where supported for timestamps only") \ \ - product(bool, EnableValhalla, true, \ - "Enable experimental Valhalla features") \ - \ product_pd(bool, InlineTypePassFieldsAsArgs, \ "Pass each inline type field as an argument at calls") \ \ diff --git a/src/hotspot/share/runtime/jniHandles.cpp b/src/hotspot/share/runtime/jniHandles.cpp index bd9e51aeb9c..a8f812ab24a 100644 --- a/src/hotspot/share/runtime/jniHandles.cpp +++ b/src/hotspot/share/runtime/jniHandles.cpp @@ -31,6 +31,7 @@ #include "memory/universe.hpp" #include "oops/access.inline.hpp" #include "oops/oop.inline.hpp" +#include "runtime/arguments.hpp" #include "runtime/handles.inline.hpp" #include "runtime/javaCalls.hpp" #include "runtime/javaThread.inline.hpp" @@ -290,7 +291,7 @@ bool JNIHandles::is_same_object(jobject handle1, jobject handle2) { bool ret = obj1 == obj2; - if (EnableValhalla) { + if (Arguments::is_valhalla_enabled()) { if (!ret && obj1 != nullptr && obj2 != nullptr && obj1->klass() == obj2->klass() && obj1->klass()->is_inline_klass()) { // The two references are different, they are not null and they are both inline types, // a full substitutability test is required, calling ValueObjectMethods.isSubstitutable() diff --git a/test/hotspot/jtreg/TEST.groups b/test/hotspot/jtreg/TEST.groups index b7ccfaeb978..cc075589b4e 100644 --- a/test/hotspot/jtreg/TEST.groups +++ b/test/hotspot/jtreg/TEST.groups @@ -651,6 +651,10 @@ tier1_serviceability = \ -serviceability/sa/TestJmapCore.java \ -serviceability/sa/TestJmapCoreMetaspace.java +tier1_serviceability_no_valhalla = \ + :tier1_serviceability \ + -serviceability/jvmti/valhalla + tier1 = \ :tier1_common \ :tier1_compiler \ diff --git a/test/hotspot/jtreg/runtime/valhalla/inlinetypes/UnsafeTest.java b/test/hotspot/jtreg/runtime/valhalla/inlinetypes/UnsafeTest.java index 2982c8907b3..968bb139015 100644 --- a/test/hotspot/jtreg/runtime/valhalla/inlinetypes/UnsafeTest.java +++ b/test/hotspot/jtreg/runtime/valhalla/inlinetypes/UnsafeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,7 +36,9 @@ * @enablePreview * @requires vm.flagless * @compile Point.java UnsafeTest.java - * @run main/othervm -Xint -XX:+UseNullableValueFlattening -XX:+UseArrayFlattening -XX:+UseFieldFlattening -XX:+PrintInlineLayout runtime.valhalla.inlinetypes.UnsafeTest + * @run main/othervm -Xint -XX:+UnlockDiagnosticVMOptions + -XX:+UseNullableValueFlattening -XX:+UseArrayFlattening -XX:+UseFieldFlattening + -XX:+PrintInlineLayout runtime.valhalla.inlinetypes.UnsafeTest */ // TODO 8350865 Implement unsafe intrinsics for nullable flat fields/arrays in C2 diff --git a/test/hotspot/jtreg/serviceability/jvmti/valhalla/FieldAccessModify/FieldAccessModify.java b/test/hotspot/jtreg/serviceability/jvmti/valhalla/FieldAccessModify/FieldAccessModify.java index cb108fe2fb0..06a3a77c293 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/valhalla/FieldAccessModify/FieldAccessModify.java +++ b/test/hotspot/jtreg/serviceability/jvmti/valhalla/FieldAccessModify/FieldAccessModify.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,7 +27,7 @@ are generated for value classes. * @requires vm.jvmti * @enablePreview - * @run main/othervm/native -agentlib:FieldAccessModify -XX:+EnableValhalla FieldAccessModify + * @run main/othervm/native -agentlib:FieldAccessModify FieldAccessModify */ import java.lang.reflect.Field; diff --git a/test/hotspot/jtreg/serviceability/jvmti/valhalla/ForceEarlyReturn/ValueForceEarlyReturn.java b/test/hotspot/jtreg/serviceability/jvmti/valhalla/ForceEarlyReturn/ValueForceEarlyReturn.java index 48d7f80cf7c..1e68af0f838 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/valhalla/ForceEarlyReturn/ValueForceEarlyReturn.java +++ b/test/hotspot/jtreg/serviceability/jvmti/valhalla/ForceEarlyReturn/ValueForceEarlyReturn.java @@ -27,7 +27,7 @@ * @requires vm.jvmti * @modules java.base/jdk.internal.vm.annotation * @enablePreview - * @run main/othervm/native -agentlib:ValueForceEarlyReturn -XX:+EnableValhalla ValueForceEarlyReturn + * @run main/othervm/native -agentlib:ValueForceEarlyReturn ValueForceEarlyReturn */ import java.util.Objects; diff --git a/test/hotspot/jtreg/serviceability/jvmti/valhalla/GetClassFields/ValueGetClassFields.java b/test/hotspot/jtreg/serviceability/jvmti/valhalla/GetClassFields/ValueGetClassFields.java index 727fdd8af4c..36db9cfb651 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/valhalla/GetClassFields/ValueGetClassFields.java +++ b/test/hotspot/jtreg/serviceability/jvmti/valhalla/GetClassFields/ValueGetClassFields.java @@ -27,7 +27,7 @@ * @requires vm.jvmti * @modules java.base/jdk.internal.vm.annotation * @enablePreview - * @run main/othervm/native -agentlib:ValueGetClassFields -XX:+EnableValhalla ValueGetClassFields + * @run main/othervm/native -agentlib:ValueGetClassFields ValueGetClassFields */ import jdk.internal.vm.annotation.LooselyConsistentValue; diff --git a/test/hotspot/jtreg/serviceability/jvmti/valhalla/GetObjectMonitorUsage/ValueGetObjectMonitorUsage.java b/test/hotspot/jtreg/serviceability/jvmti/valhalla/GetObjectMonitorUsage/ValueGetObjectMonitorUsage.java index 91be5e20872..85e1e1122a6 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/valhalla/GetObjectMonitorUsage/ValueGetObjectMonitorUsage.java +++ b/test/hotspot/jtreg/serviceability/jvmti/valhalla/GetObjectMonitorUsage/ValueGetObjectMonitorUsage.java @@ -27,7 +27,7 @@ * @requires vm.jvmti * @modules java.base/jdk.internal.vm.annotation * @enablePreview - * @run main/othervm/native -agentlib:ValueGetObjectMonitorUsage -XX:+EnableValhalla ValueGetObjectMonitorUsage + * @run main/othervm/native -agentlib:ValueGetObjectMonitorUsage ValueGetObjectMonitorUsage */ import jdk.internal.vm.annotation.LooselyConsistentValue; diff --git a/test/hotspot/jtreg/serviceability/jvmti/valhalla/GetObjectSize/ValueGetObjectSize.java b/test/hotspot/jtreg/serviceability/jvmti/valhalla/GetObjectSize/ValueGetObjectSize.java index 356cf3db097..59e4db06a6e 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/valhalla/GetObjectSize/ValueGetObjectSize.java +++ b/test/hotspot/jtreg/serviceability/jvmti/valhalla/GetObjectSize/ValueGetObjectSize.java @@ -27,7 +27,7 @@ * @requires vm.jvmti * @modules java.base/jdk.internal.vm.annotation * @enablePreview - * @run main/othervm/native -agentlib:ValueGetObjectSize -XX:+EnableValhalla ValueGetObjectSize + * @run main/othervm/native -agentlib:ValueGetObjectSize ValueGetObjectSize */ import jdk.internal.vm.annotation.LooselyConsistentValue; diff --git a/test/hotspot/jtreg/serviceability/jvmti/valhalla/GetSetLocal/ValueGetSetLocal.java b/test/hotspot/jtreg/serviceability/jvmti/valhalla/GetSetLocal/ValueGetSetLocal.java index 299b65ae498..29956e14c36 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/valhalla/GetSetLocal/ValueGetSetLocal.java +++ b/test/hotspot/jtreg/serviceability/jvmti/valhalla/GetSetLocal/ValueGetSetLocal.java @@ -27,7 +27,7 @@ * @requires vm.jvmti * @modules java.base/jdk.internal.vm.annotation * @enablePreview - * @run main/othervm/native -agentlib:ValueGetSetLocal -XX:+EnableValhalla ValueGetSetLocal + * @run main/othervm/native -agentlib:ValueGetSetLocal ValueGetSetLocal */ import java.util.Objects; diff --git a/test/hotspot/jtreg/serviceability/jvmti/valhalla/HeapDump/HeapDump.java b/test/hotspot/jtreg/serviceability/jvmti/valhalla/HeapDump/HeapDump.java index 0b2ec0ad503..64e5cee8804 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/valhalla/HeapDump/HeapDump.java +++ b/test/hotspot/jtreg/serviceability/jvmti/valhalla/HeapDump/HeapDump.java @@ -23,6 +23,7 @@ /** * @test + * @requires vm.debug * @modules java.base/jdk.internal.value * @library /test/lib * @modules java.base/jdk.internal.vm.annotation java.base/jdk.internal.value @@ -149,9 +150,9 @@ public static void main(String[] args) throws Throwable { try { theApp = new HeapDumpTarg(); - LingeredApp.startApp(theApp, "--enable-preview", - "-XX:+UnlockDiagnosticVMOptions", - "-XX:+PrintInlineLayout", "-XX:+PrintFlatArrayLayout", + // -XX:+PrintInlineLayout is debug-only arg + LingeredApp.startApp(theApp, "--enable-preview", "-XX:+UnlockDiagnosticVMOptions", + "-XX:+PrintInlineLayout", "-XX:+PrintFlatArrayLayout", "--add-modules=java.base", "--add-exports=java.base/jdk.internal.value=ALL-UNNAMED"); diff --git a/test/jdk/TEST.groups b/test/jdk/TEST.groups index 3bdcb837e9e..fb37c4f0d9a 100644 --- a/test/jdk/TEST.groups +++ b/test/jdk/TEST.groups @@ -45,9 +45,17 @@ tier1 = \ tier1_part1 = \ :jdk_lang +tier1_part1_no_valhalla = \ + :tier1_part1 \ + -:jdk_valhalla + tier1_part2 = \ :jdk_util +tier1_part2_no_valhalla = \ + :tier1_part2 \ + -:jdk_valhalla + tier1_part3 = \ :jdk_math \ :jdk_svc_sanity \ @@ -58,6 +66,14 @@ tier1_part3 = \ jdk/classfile \ sun/nio/cs/ISO8859x.java +tier1_part3_no_valhalla = \ + :tier1_part3 \ + -:jdk_valhalla + +tier1_no_valhalla = \ + :tier1 \ + -:jdk_valhalla + # When adding tests to tier2, make sure they end up in one of the tier2_partX groups tier2 = \ :tier2_part1 \ @@ -145,7 +161,8 @@ jdk_lang = \ jdk_valhalla = \ java/lang/invoke \ valhalla \ - java/lang/instrument/valhalla + java/lang/instrument/valhalla \ + java/lang/reflect/valhalla # All of the java.util package diff --git a/test/langtools/TEST.groups b/test/langtools/TEST.groups index e290a1431a3..43f0fa1d84c 100644 --- a/test/langtools/TEST.groups +++ b/test/langtools/TEST.groups @@ -1,4 +1,4 @@ -# Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -88,6 +88,10 @@ tier1 = \ -:langtools_jshell_unstable \ -:langtools_slow +tier1_no_valhalla = \ + :tier1 \ + -tools/javac/valhalla + # (Almost) no langtools tests are tier 2. tier2 = \ :langtools_jshell_unstable \