Skip to content

Commit

Permalink
Merge branch 'openjdk:master' into jbs8346866
Browse files Browse the repository at this point in the history
  • Loading branch information
sendaoYan authored Jan 7, 2025
2 parents d5a205c + f119663 commit e986d41
Show file tree
Hide file tree
Showing 89 changed files with 800 additions and 1,412 deletions.
2 changes: 1 addition & 1 deletion doc/hotspot-unit-tests.html
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ <h3 id="error-messages">Error messages</h3>
<p>All GoogleTest asserts print compared expressions and their values,
so there is no need to have them in error messages. Asserts print only
compared values, they do not print any of interim variables, e.g.
<code>ASSERT_TRUE((val1 == val2 &amp;&amp; isFail(foo(8)) || i == 18)</code>
<code>ASSERT_TRUE((val1 == val2 &amp;&amp; isFail(foo(8))) || i == 18)</code>
prints only one value. If you use some complex predicates, please
consider <code>EXPECT_PRED*</code> or <code>EXPECT_FORMAT_PRED</code>
assertions family, they check that a predicate returns true/success and
Expand Down
2 changes: 1 addition & 1 deletion doc/hotspot-unit-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ Provide informative, but not too verbose error messages.
All GoogleTest asserts print compared expressions and their values, so
there is no need to have them in error messages. Asserts print only
compared values, they do not print any of interim variables, e.g.
`ASSERT_TRUE((val1 == val2 && isFail(foo(8)) || i == 18)` prints only
`ASSERT_TRUE((val1 == val2 && isFail(foo(8))) || i == 18)` prints only
one value. If you use some complex predicates, please consider
`EXPECT_PRED*` or `EXPECT_FORMAT_PRED` assertions family, they check that
a predicate returns true/success and print out all parameters values.
Expand Down
4 changes: 1 addition & 3 deletions make/test/BuildMicrobenchmark.gmk
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -96,8 +96,6 @@ $(eval $(call SetupJavaCompilation, BUILD_JDK_MICROBENCHMARK, \
--add-exports java.base/jdk.internal.foreign=ALL-UNNAMED \
--add-exports java.base/jdk.internal.misc=ALL-UNNAMED \
--add-exports java.base/jdk.internal.util=ALL-UNNAMED \
--add-exports java.base/jdk.internal.org.objectweb.asm.tree=ALL-UNNAMED \
--add-exports java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED \
--add-exports java.base/jdk.internal.vm=ALL-UNNAMED \
--add-exports java.base/sun.invoke.util=ALL-UNNAMED \
--add-exports java.base/sun.security.util=ALL-UNNAMED \
Expand Down
7 changes: 1 addition & 6 deletions src/hotspot/cpu/riscv/compressedKlass_riscv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ char* CompressedKlassPointers::reserve_address_space_for_compressed_classes(size

char* result = nullptr;

// RiscV loads a 64-bit immediate in up to four separate steps, splitting it into four different sections
// RISC-V loads a 64-bit immediate in up to four separate steps, splitting it into four different sections
// (two 32-bit sections, each split into two subsections of 20/12 bits).
//
// 63 ....... 44 43 ... 32 31 ....... 12 11 ... 0
Expand All @@ -51,11 +51,6 @@ char* CompressedKlassPointers::reserve_address_space_for_compressed_classes(size
// with one instruction (2)
result = reserve_address_space_for_unscaled_encoding(size, aslr);

// Failing that, attempt to reserve for base=zero shift>0
if (result == nullptr && optimize_for_zero_base) {
result = reserve_address_space_for_zerobased_encoding(size, aslr);
}

// Failing that, optimize for case (3) - a base with only bits set between [32-44)
if (result == nullptr) {
const uintptr_t from = nth_bit(32);
Expand Down
14 changes: 7 additions & 7 deletions src/hotspot/cpu/riscv/templateInterpreterGenerator_riscv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ address TemplateInterpreterGenerator::generate_math_entry(AbstractInterpreter::M
} else {
fn = CAST_FROM_FN_PTR(address, StubRoutines::dsin());
}
__ call(fn);
__ rt_call(fn);
__ mv(ra, x9);
break;
case Interpreter::java_lang_math_cos :
Expand All @@ -202,7 +202,7 @@ address TemplateInterpreterGenerator::generate_math_entry(AbstractInterpreter::M
} else {
fn = CAST_FROM_FN_PTR(address, StubRoutines::dcos());
}
__ call(fn);
__ rt_call(fn);
__ mv(ra, x9);
break;
case Interpreter::java_lang_math_tan :
Expand All @@ -215,7 +215,7 @@ address TemplateInterpreterGenerator::generate_math_entry(AbstractInterpreter::M
} else {
fn = CAST_FROM_FN_PTR(address, StubRoutines::dtan());
}
__ call(fn);
__ rt_call(fn);
__ mv(ra, x9);
break;
case Interpreter::java_lang_math_log :
Expand All @@ -228,7 +228,7 @@ address TemplateInterpreterGenerator::generate_math_entry(AbstractInterpreter::M
} else {
fn = CAST_FROM_FN_PTR(address, StubRoutines::dlog());
}
__ call(fn);
__ rt_call(fn);
__ mv(ra, x9);
break;
case Interpreter::java_lang_math_log10 :
Expand All @@ -241,7 +241,7 @@ address TemplateInterpreterGenerator::generate_math_entry(AbstractInterpreter::M
} else {
fn = CAST_FROM_FN_PTR(address, StubRoutines::dlog10());
}
__ call(fn);
__ rt_call(fn);
__ mv(ra, x9);
break;
case Interpreter::java_lang_math_exp :
Expand All @@ -254,7 +254,7 @@ address TemplateInterpreterGenerator::generate_math_entry(AbstractInterpreter::M
} else {
fn = CAST_FROM_FN_PTR(address, StubRoutines::dexp());
}
__ call(fn);
__ rt_call(fn);
__ mv(ra, x9);
break;
case Interpreter::java_lang_math_pow :
Expand All @@ -268,7 +268,7 @@ address TemplateInterpreterGenerator::generate_math_entry(AbstractInterpreter::M
} else {
fn = CAST_FROM_FN_PTR(address, StubRoutines::dpow());
}
__ call(fn);
__ rt_call(fn);
__ mv(ra, x9);
break;
case Interpreter::java_lang_math_fmaD :
Expand Down
4 changes: 3 additions & 1 deletion src/hotspot/share/cds/metaspaceShared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -987,8 +987,10 @@ bool MetaspaceShared::try_link_class(JavaThread* current, InstanceKlass* ik) {
ik->external_name());
CLEAR_PENDING_EXCEPTION;
SystemDictionaryShared::set_class_has_failed_verification(ik);
} else {
assert(!SystemDictionaryShared::has_class_failed_verification(ik), "sanity");
ik->compute_has_loops_flag_for_methods();
}
ik->compute_has_loops_flag_for_methods();
BytecodeVerificationLocal = saved;
return true;
} else {
Expand Down
11 changes: 5 additions & 6 deletions src/hotspot/share/compiler/compileBroker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2532,6 +2532,11 @@ void CompileBroker::collect_statistics(CompilerThread* thread, elapsedTimer time
// C1 and C2 counters are counting both successful and unsuccessful compiles
_t_total_compilation.add(time);

// Update compilation times. Used by the implementation of JFR CompilerStatistics
// and java.lang.management.CompilationMXBean.
_perf_total_compilation->inc(time.ticks());
_peak_compilation_time = MAX2(time.milliseconds(), _peak_compilation_time);

if (!success) {
_total_bailout_count++;
if (UsePerfData) {
Expand All @@ -2550,12 +2555,6 @@ void CompileBroker::collect_statistics(CompilerThread* thread, elapsedTimer time
_t_invalidated_compilation.add(time);
} else {
// Compilation succeeded

// update compilation ticks - used by the implementation of
// java.lang.management.CompilationMXBean
_perf_total_compilation->inc(time.ticks());
_peak_compilation_time = time.milliseconds() > _peak_compilation_time ? time.milliseconds() : _peak_compilation_time;

if (CITime) {
int bytes_compiled = method->code_size() + task->num_inlined_bytecodes();
if (is_osr) {
Expand Down
8 changes: 8 additions & 0 deletions src/hotspot/share/gc/g1/g1HeapSizingPolicy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,14 @@ size_t G1HeapSizingPolicy::young_collection_expansion_amount() {
}

static size_t target_heap_capacity(size_t used_bytes, uintx free_ratio) {
assert(free_ratio <= 100, "precondition");
if (free_ratio == 100) {
// If 100 then below calculations will divide by zero and return min of
// resulting infinity and MaxHeapSize. Avoid issues of UB vs is_iec559
// and ubsan warnings, and just immediately return MaxHeapSize.
return MaxHeapSize;
}

const double desired_free_percentage = (double) free_ratio / 100.0;
const double desired_used_percentage = 1.0 - desired_free_percentage;

Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/shenandoah/shenandoahWorkGroup.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2017, 2021, Red Hat, Inc. All rights reserved.
* Copyright (c) 2014, 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
Expand Down Expand Up @@ -73,7 +74,6 @@ ShenandoahPushWorkerScope::~ShenandoahPushWorkerScope() {
}

void ShenandoahWorkerThreads::on_create_worker(WorkerThread* worker) {
ShenandoahThreadLocalData::create(worker);
if (_initialize_gclab) {
ShenandoahThreadLocalData::initialize_gclab(worker);
}
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/jfr/metadata/metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@
$ jfr print dump.jfr
Programmatic access:
try (var rf = new RecordingFile(Path.of("dump.jfr)) {
try (var rf = new RecordingFile(Path.of("dump.jfr"))) {
while (rf.hasMoreEvents()) {
RecordedEvent e = rf.readEvent();
System.out.println(e.getName() + " " + e.getDuration()));
System.out.println(e.getName() + " " + e.getDuration());
}
};
!-->
Expand Down
6 changes: 4 additions & 2 deletions src/hotspot/share/logging/logDecorators.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* 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
Expand Down Expand Up @@ -100,7 +100,9 @@ bool LogDecorators::parse(const char* decorator_args, outputStream* errstream) {
break;
}
tmp_decorators |= mask(d);
token = comma_pos + 1;
if (comma_pos != nullptr) {
token = comma_pos + 1;
}
} while (comma_pos != nullptr);
os::free(args_copy);
if (result) {
Expand Down
6 changes: 4 additions & 2 deletions src/hotspot/share/logging/logSelection.cpp
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -151,7 +151,9 @@ static LogSelection parse_internal(char *str, outputStream* errstream) {
return LogSelection::Invalid;
}
tags[ntags++] = tag;
cur_tag = plus_pos + 1;
if (plus_pos != nullptr) {
cur_tag = plus_pos + 1;
}
} while (plus_pos != nullptr);

for (size_t i = 0; i < ntags; i++) {
Expand Down
8 changes: 6 additions & 2 deletions src/hotspot/share/logging/logSelectionList.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* 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
Expand Down Expand Up @@ -69,7 +69,7 @@ bool LogSelectionList::parse(const char* str, outputStream* errstream) {
}
char* copy = os::strdup_check_oom(str, mtLogging);
// Split string on commas
for (char *comma_pos = copy, *cur = copy; success && comma_pos != nullptr; cur = comma_pos + 1) {
for (char *comma_pos = copy, *cur = copy; success; cur = comma_pos + 1) {
if (_nselections == MaxSelections) {
if (errstream != nullptr) {
errstream->print_cr("Can not have more than " SIZE_FORMAT " log selections in a single configuration.",
Expand All @@ -90,6 +90,10 @@ bool LogSelectionList::parse(const char* str, outputStream* errstream) {
break;
}
_selections[_nselections++] = selection;

if (comma_pos == nullptr) {
break;
}
}

os::free(copy);
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/oops/markWord.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ class markWord {
static markWord INFLATING() { return zero(); } // inflate-in-progress

// Should this header be preserved during GC?
bool must_be_preserved(const oopDesc* obj) const {
bool must_be_preserved() const {
return (!is_unlocked() || !has_no_hash());
}

Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/oops/oop.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ bool oopDesc::mark_must_be_preserved() const {
}

bool oopDesc::mark_must_be_preserved(markWord m) const {
return m.must_be_preserved(this);
return m.must_be_preserved();
}

#endif // SHARE_OOPS_OOP_INLINE_HPP
53 changes: 29 additions & 24 deletions src/hotspot/share/opto/vectornode.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 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
Expand Down Expand Up @@ -666,7 +666,7 @@ VectorNode* VectorNode::make_mask_node(int vopc, Node* n1, Node* n2, uint vlen,
}
}

// Make a vector node for binary operation
// Make a vector node for unary or binary operation
VectorNode* VectorNode::make(int vopc, Node* n1, Node* n2, const TypeVect* vt, bool is_mask, bool is_var_shift, bool is_unsigned) {
// This method should not be called for unimplemented vectors.
guarantee(vopc > 0, "vopc must be > 0");
Expand Down Expand Up @@ -747,6 +747,9 @@ VectorNode* VectorNode::make(int vopc, Node* n1, Node* n2, const TypeVect* vt, b
case Op_URShiftVI: return new URShiftVINode(n1, n2, vt, is_var_shift);
case Op_URShiftVL: return new URShiftVLNode(n1, n2, vt, is_var_shift);

case Op_LShiftCntV: return new LShiftCntVNode(n1, vt);
case Op_RShiftCntV: return new RShiftCntVNode(n1, vt);

case Op_AndV: return new AndVNode(n1, n2, vt);
case Op_OrV: return new OrVNode (n1, n2, vt);
case Op_XorV: return new XorVNode(n1, n2, vt);
Expand All @@ -766,6 +769,18 @@ VectorNode* VectorNode::make(int vopc, Node* n1, Node* n2, const TypeVect* vt, b
case Op_SaturatingAddV: return new SaturatingAddVNode(n1, n2, vt, is_unsigned);
case Op_SaturatingSubV: return new SaturatingSubVNode(n1, n2, vt, is_unsigned);

case Op_VectorCastB2X: return new VectorCastB2XNode(n1, vt);
case Op_VectorCastS2X: return new VectorCastS2XNode(n1, vt);
case Op_VectorCastI2X: return new VectorCastI2XNode(n1, vt);
case Op_VectorCastL2X: return new VectorCastL2XNode(n1, vt);
case Op_VectorCastF2X: return new VectorCastF2XNode(n1, vt);
case Op_VectorCastD2X: return new VectorCastD2XNode(n1, vt);
case Op_VectorUCastB2X: return new VectorUCastB2XNode(n1, vt);
case Op_VectorUCastS2X: return new VectorUCastS2XNode(n1, vt);
case Op_VectorUCastI2X: return new VectorUCastI2XNode(n1, vt);
case Op_VectorCastHF2F: return new VectorCastHF2FNode(n1, vt);
case Op_VectorCastF2HF: return new VectorCastF2HFNode(n1, vt);

default:
fatal("Missed vector creation for '%s'", NodeClassNames[vopc]);
return nullptr;
Expand All @@ -791,6 +806,7 @@ VectorNode* VectorNode::make(int vopc, Node* n1, Node* n2, Node* n3, const TypeV
case Op_SelectFromTwoVector: return new SelectFromTwoVectorNode(n1, n2, n3, vt);
case Op_SignumVD: return new SignumVDNode(n1, n2, n3, vt);
case Op_SignumVF: return new SignumVFNode(n1, n2, n3, vt);
case Op_VectorBlend: return new VectorBlendNode(n1, n2, n3);
default:
fatal("Missed vector creation for '%s'", NodeClassNames[vopc]);
return nullptr;
Expand Down Expand Up @@ -818,22 +834,26 @@ VectorNode* VectorNode::scalar2vector(Node* s, uint vlen, BasicType bt, bool is_
}

VectorNode* VectorNode::shift_count(int opc, Node* cnt, uint vlen, BasicType bt) {
// Match shift count type with shift vector type.
int vopc = VectorNode::shift_count_opcode(opc);
const TypeVect* vt = TypeVect::make(bt, vlen);
return VectorNode::make(vopc, cnt, nullptr, vt);
}

int VectorNode::shift_count_opcode(int opc) {
switch (opc) {
case Op_LShiftI:
case Op_LShiftL:
return new LShiftCntVNode(cnt, vt);
return Op_LShiftCntV;
case Op_RShiftI:
case Op_RShiftL:
case Op_URShiftB:
case Op_URShiftS:
case Op_URShiftI:
case Op_URShiftL:
return new RShiftCntVNode(cnt, vt);
return Op_RShiftCntV;
default:
fatal("Missed vector creation for '%s'", NodeClassNames[opc]);
return nullptr;
fatal("Node class '%s' is not supported for shift count", NodeClassNames[opc]);
return -1;
}
}

Expand Down Expand Up @@ -1412,24 +1432,9 @@ VectorStoreMaskNode* VectorStoreMaskNode::make(PhaseGVN& gvn, Node* in, BasicTyp
return new VectorStoreMaskNode(in, gvn.intcon(elem_size), vt);
}

VectorCastNode* VectorCastNode::make(int vopc, Node* n1, BasicType bt, uint vlen) {
VectorNode* VectorCastNode::make(int vopc, Node* n1, BasicType bt, uint vlen) {
const TypeVect* vt = TypeVect::make(bt, vlen);
switch (vopc) {
case Op_VectorCastB2X: return new VectorCastB2XNode(n1, vt);
case Op_VectorCastS2X: return new VectorCastS2XNode(n1, vt);
case Op_VectorCastI2X: return new VectorCastI2XNode(n1, vt);
case Op_VectorCastL2X: return new VectorCastL2XNode(n1, vt);
case Op_VectorCastF2X: return new VectorCastF2XNode(n1, vt);
case Op_VectorCastD2X: return new VectorCastD2XNode(n1, vt);
case Op_VectorUCastB2X: return new VectorUCastB2XNode(n1, vt);
case Op_VectorUCastS2X: return new VectorUCastS2XNode(n1, vt);
case Op_VectorUCastI2X: return new VectorUCastI2XNode(n1, vt);
case Op_VectorCastHF2F: return new VectorCastHF2FNode(n1, vt);
case Op_VectorCastF2HF: return new VectorCastF2HFNode(n1, vt);
default:
assert(false, "unknown node: %s", NodeClassNames[vopc]);
return nullptr;
}
return VectorNode::make(vopc, n1, nullptr, vt);
}

int VectorCastNode::opcode(int sopc, BasicType bt, bool is_signed) {
Expand Down
Loading

0 comments on commit e986d41

Please sign in to comment.