Skip to content

Commit 02b53cb

Browse files
author
Datadog Syncup Service
committed
Merge branch 'upstream-master'
2 parents b4e9e4f + 0fbf10a commit 02b53cb

31 files changed

+624
-241
lines changed

src/hotspot/share/gc/parallel/psAdaptiveSizePolicy.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -947,12 +947,10 @@ uint PSAdaptiveSizePolicy::compute_survivor_space_size_and_threshold(
947947
// Finally, increment or decrement the tenuring threshold, as decided above.
948948
// We test for decrementing first, as we might have hit the target size
949949
// limit.
950-
if (decr_tenuring_threshold && !(AlwaysTenure || NeverTenure)) {
951-
if (tenuring_threshold > 1) {
950+
if (!(AlwaysTenure || NeverTenure)) {
951+
if (decr_tenuring_threshold && tenuring_threshold > 1) {
952952
tenuring_threshold--;
953-
}
954-
} else if (incr_tenuring_threshold && !(AlwaysTenure || NeverTenure)) {
955-
if (tenuring_threshold < MaxTenuringThreshold) {
953+
} else if (incr_tenuring_threshold && tenuring_threshold < MaxTenuringThreshold) {
956954
tenuring_threshold++;
957955
}
958956
}

src/hotspot/share/gc/serial/serialHeap.hpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ class SerialHeap : public CollectedHeap {
111111

112112
bool is_young_gc_safe() const;
113113

114+
void gc_prologue(bool full);
115+
void gc_epilogue(bool full);
116+
114117
public:
115118
// Returns JNI_OK on success
116119
jint initialize() override;
@@ -226,10 +229,6 @@ class SerialHeap : public CollectedHeap {
226229
SO_ScavengeCodeCache = 0x10
227230
};
228231

229-
protected:
230-
virtual void gc_prologue(bool full);
231-
virtual void gc_epilogue(bool full);
232-
233232
public:
234233
// Apply closures on various roots in Young GC or marking/adjust phases of Full GC.
235234
void process_roots(ScanningOption so,

src/hotspot/share/opto/loopTransform.cpp

Lines changed: 57 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -1424,11 +1424,13 @@ void PhaseIdealLoop::insert_pre_post_loops(IdealLoopTree *loop, Node_List &old_n
14241424
_igvn.hash_delete(outer_main_head);
14251425
outer_main_head->set_req(LoopNode::EntryControl, min_taken);
14261426
set_idom(outer_main_head, min_taken, dd_main_head);
1427+
assert(post_head->in(1)->is_IfProj(), "must be zero-trip guard If node projection of the post loop");
14271428

14281429
VectorSet visited;
14291430
Node_Stack clones(main_head->back_control()->outcnt());
14301431
// Step B3: Make the fall-in values to the main-loop come from the
14311432
// fall-out values of the pre-loop.
1433+
const uint last_node_index_in_pre_loop_body = Compile::current()->unique() - 1;
14321434
for (DUIterator i2 = main_head->outs(); main_head->has_out(i2); i2++) {
14331435
Node* main_phi = main_head->out(i2);
14341436
if (main_phi->is_Phi() && main_phi->in(0) == main_head && main_phi->outcnt() > 0) {
@@ -1441,21 +1443,13 @@ void PhaseIdealLoop::insert_pre_post_loops(IdealLoopTree *loop, Node_List &old_n
14411443
main_phi->set_req(LoopNode::EntryControl, fallpre);
14421444
}
14431445
}
1446+
DEBUG_ONLY(const uint last_node_index_from_backedge_goo = Compile::current()->unique() - 1);
14441447

1445-
// Nodes inside the loop may be control dependent on a predicate
1446-
// that was moved before the preloop. If the back branch of the main
1447-
// or post loops becomes dead, those nodes won't be dependent on the
1448-
// test that guards that loop nest anymore which could lead to an
1449-
// incorrect array access because it executes independently of the
1450-
// test that was guarding the loop nest. We add a special CastII on
1451-
// the if branch that enters the loop, between the input induction
1452-
// variable value and the induction variable Phi to preserve correct
1453-
// dependencies.
1454-
1455-
assert(post_head->in(1)->is_IfProj(), "must be zero-trip guard If node projection of the post loop");
14561448
DEBUG_ONLY(ensure_zero_trip_guard_proj(outer_main_head->in(LoopNode::EntryControl), true);)
14571449
if (UseLoopPredicate) {
1458-
initialize_assertion_predicates_for_main_loop(pre_head, main_head, first_node_index_in_pre_loop_body, old_new);
1450+
initialize_assertion_predicates_for_main_loop(pre_head, main_head, first_node_index_in_pre_loop_body,
1451+
last_node_index_in_pre_loop_body,
1452+
DEBUG_ONLY(last_node_index_from_backedge_goo COMMA) old_new);
14591453
}
14601454

14611455
// Step B4: Shorten the pre-loop to run only 1 iteration (for now).
@@ -1729,10 +1723,15 @@ void PhaseIdealLoop::initialize_assertion_predicates_for_peeled_loop(CountedLoop
17291723
// Target Loop: Original - main_loop_head
17301724
void PhaseIdealLoop::initialize_assertion_predicates_for_main_loop(CountedLoopNode* pre_loop_head,
17311725
CountedLoopNode* main_loop_head,
1732-
const uint first_node_index_in_cloned_loop_body,
1726+
const uint first_node_index_in_pre_loop_body,
1727+
const uint last_node_index_in_pre_loop_body,
1728+
DEBUG_ONLY(const uint last_node_index_from_backedge_goo COMMA)
17331729
const Node_List& old_new) {
1734-
const NodeInOriginalLoopBody node_in_original_loop_body(first_node_index_in_cloned_loop_body, old_new);
1735-
create_assertion_predicates_at_loop(pre_loop_head, main_loop_head, node_in_original_loop_body, true);
1730+
assert(first_node_index_in_pre_loop_body < last_node_index_in_pre_loop_body, "cloned some nodes");
1731+
const NodeInMainLoopBody node_in_main_loop_body(first_node_index_in_pre_loop_body,
1732+
last_node_index_in_pre_loop_body,
1733+
DEBUG_ONLY(last_node_index_from_backedge_goo COMMA) old_new);
1734+
create_assertion_predicates_at_main_or_post_loop(pre_loop_head, main_loop_head, node_in_main_loop_body, true);
17361735
}
17371736

17381737
// Source Loop: Original - main_loop_head
@@ -1741,7 +1740,7 @@ void PhaseIdealLoop::initialize_assertion_predicates_for_post_loop(CountedLoopNo
17411740
CountedLoopNode* post_loop_head,
17421741
const uint first_node_index_in_cloned_loop_body) {
17431742
const NodeInClonedLoopBody node_in_cloned_loop_body(first_node_index_in_cloned_loop_body);
1744-
create_assertion_predicates_at_loop(main_loop_head, post_loop_head, node_in_cloned_loop_body, false);
1743+
create_assertion_predicates_at_main_or_post_loop(main_loop_head, post_loop_head, node_in_cloned_loop_body, false);
17451744
}
17461745

17471746
void PhaseIdealLoop::create_assertion_predicates_at_loop(CountedLoopNode* source_loop_head,
@@ -1754,6 +1753,47 @@ void PhaseIdealLoop::create_assertion_predicates_at_loop(CountedLoopNode* source
17541753
PredicateIterator predicate_iterator(source_loop_entry);
17551754
predicate_iterator.for_each(create_assertion_predicates_visitor);
17561755
}
1756+
1757+
void PhaseIdealLoop::create_assertion_predicates_at_main_or_post_loop(CountedLoopNode* source_loop_head,
1758+
CountedLoopNode* target_loop_head,
1759+
const NodeInLoopBody& _node_in_loop_body,
1760+
bool clone_template) {
1761+
Node* old_target_loop_head_entry = target_loop_head->skip_strip_mined()->in(LoopNode::EntryControl);
1762+
const uint node_index_before_new_assertion_predicate_nodes = C->unique();
1763+
const bool need_to_rewire_old_target_loop_entry_dependencies = old_target_loop_head_entry->outcnt() > 1;
1764+
create_assertion_predicates_at_loop(source_loop_head, target_loop_head, _node_in_loop_body, clone_template);
1765+
if (need_to_rewire_old_target_loop_entry_dependencies) {
1766+
rewire_old_target_loop_entry_dependency_to_new_entry(target_loop_head, old_target_loop_head_entry,
1767+
node_index_before_new_assertion_predicate_nodes);
1768+
}
1769+
}
1770+
1771+
// Rewire any control dependent nodes on the old target loop entry before adding Assertion Predicate related nodes.
1772+
// These have been added by PhaseIdealLoop::clone_up_backedge_goo() and assume to be ending up at the target loop entry
1773+
// which is no longer the case when adding additional Assertion Predicates. Fix this by rewiring these nodes to the new
1774+
// target loop entry which corresponds to the tail of the last Assertion Predicate before the target loop. This is safe
1775+
// to do because these control dependent nodes on the old target loop entry created by clone_up_backedge_goo() were
1776+
// pinned on the loop backedge before. The Assertion Predicates are not control dependent on these nodes in any way.
1777+
void PhaseIdealLoop::rewire_old_target_loop_entry_dependency_to_new_entry(
1778+
LoopNode* target_loop_head, const Node* old_target_loop_entry,
1779+
const uint node_index_before_new_assertion_predicate_nodes) {
1780+
Node* new_main_loop_entry = target_loop_head->skip_strip_mined()->in(LoopNode::EntryControl);
1781+
if (new_main_loop_entry == old_target_loop_entry) {
1782+
// No Assertion Predicates added.
1783+
return;
1784+
}
1785+
1786+
for (DUIterator_Fast imax, i = old_target_loop_entry->fast_outs(imax); i < imax; i++) {
1787+
Node* out = old_target_loop_entry->fast_out(i);
1788+
if (!out->is_CFG() && out->_idx < node_index_before_new_assertion_predicate_nodes) {
1789+
_igvn.replace_input_of(out, 0, new_main_loop_entry);
1790+
set_ctrl(out, new_main_loop_entry);
1791+
--i;
1792+
--imax;
1793+
}
1794+
}
1795+
}
1796+
17571797
//------------------------------do_unroll--------------------------------------
17581798
// Unroll the loop body one step - make each trip do 2 iterations.
17591799
void PhaseIdealLoop::do_unroll(IdealLoopTree *loop, Node_List &old_new, bool adjust_min_trip) {

src/hotspot/share/opto/loopnode.hpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -951,12 +951,20 @@ class PhaseIdealLoop : public PhaseTransform {
951951
const Node_List& old_new);
952952
void initialize_assertion_predicates_for_main_loop(CountedLoopNode* pre_loop_head,
953953
CountedLoopNode* main_loop_head,
954-
uint first_node_index_in_cloned_loop_body,
954+
uint first_node_index_in_pre_loop_body,
955+
uint last_node_index_in_pre_loop_body,
956+
DEBUG_ONLY(uint last_node_index_from_backedge_goo COMMA)
955957
const Node_List& old_new);
956958
void initialize_assertion_predicates_for_post_loop(CountedLoopNode* main_loop_head, CountedLoopNode* post_loop_head,
957959
uint first_node_index_in_cloned_loop_body);
958960
void create_assertion_predicates_at_loop(CountedLoopNode* source_loop_head, CountedLoopNode* target_loop_head,
959961
const NodeInLoopBody& _node_in_loop_body, bool clone_template);
962+
void create_assertion_predicates_at_main_or_post_loop(CountedLoopNode* source_loop_head,
963+
CountedLoopNode* target_loop_head,
964+
const NodeInLoopBody& _node_in_loop_body, bool clone_template);
965+
void rewire_old_target_loop_entry_dependency_to_new_entry(LoopNode* target_loop_head,
966+
const Node* old_target_loop_entry,
967+
uint node_index_before_new_assertion_predicate_nodes);
960968
void insert_loop_limit_check_predicate(ParsePredicateSuccessProj* loop_limit_check_parse_proj, Node* cmp_limit,
961969
Node* bol);
962970
void log_loop_tree();

src/hotspot/share/opto/predicates.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ void TemplateAssertionPredicate::rewire_loop_data_dependencies(IfTrueNode* targe
154154
PhaseIdealLoop* phase) const {
155155
for (DUIterator i = _success_proj->outs(); _success_proj->has_out(i); i++) {
156156
Node* output = _success_proj->out(i);
157-
if (!output->is_CFG() && data_in_loop_body.check(output)) {
157+
if (!output->is_CFG() && data_in_loop_body.check_node_in_loop_body(output)) {
158158
phase->igvn().replace_input_of(output, 0, target_predicate);
159159
--i; // account for the just deleted output
160160
}

src/hotspot/share/opto/predicates.hpp

Lines changed: 45 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -248,7 +248,7 @@ class PredicateVisitor : public StackObj {
248248
// Interface to check whether a node is in a loop body or not.
249249
class NodeInLoopBody : public StackObj {
250250
public:
251-
virtual bool check(Node* node) const = 0;
251+
virtual bool check_node_in_loop_body(Node* node) const = 0;
252252
};
253253

254254
// Class to represent Assertion Predicates (i.e. either Initialized and/or Template Assertion Predicates).
@@ -963,13 +963,52 @@ class NodeInOriginalLoopBody : public NodeInLoopBody {
963963

964964
// Check if 'node' is not a cloned node (i.e. "< _first_node_index_in_cloned_loop_body") and if we've created a
965965
// clone from 'node' (i.e. _old_new entry is non-null). Then we know that 'node' belongs to the original loop body.
966-
bool check(Node* node) const override {
966+
bool check_node_in_loop_body(Node* node) const override {
967967
if (node->_idx < _first_node_index_in_cloned_loop_body) {
968968
Node* cloned_node = _old_new[node->_idx];
969+
// Check that the clone is actually part of the cloned loop body and not from some earlier cloning.
969970
return cloned_node != nullptr && cloned_node->_idx >= _first_node_index_in_cloned_loop_body;
970-
} else {
971-
return false;
972971
}
972+
return false;
973+
}
974+
};
975+
976+
// This class checks whether a node is in the main loop body and not the pre loop body. We cannot use the
977+
// NodeInOriginalLoopBody class because PhaseIdealLoop::clone_up_backedge_goo() could clone additional nodes that
978+
// should be pinned at the main loop body entry. The check in NodeInOriginalLoopBody will ignore these.
979+
class NodeInMainLoopBody : public NodeInLoopBody {
980+
const uint _first_node_index_in_pre_loop_body;
981+
const uint _last_node_index_in_pre_loop_body;
982+
DEBUG_ONLY(const uint _last_node_index_from_backedge_goo;)
983+
const Node_List& _old_new;
984+
985+
public:
986+
NodeInMainLoopBody(const uint first_node_index_in_pre_loop_body, const uint last_node_index_in_pre_loop_body,
987+
DEBUG_ONLY(const uint last_node_index_from_backedge_goo COMMA) const Node_List& old_new)
988+
: _first_node_index_in_pre_loop_body(first_node_index_in_pre_loop_body),
989+
_last_node_index_in_pre_loop_body(last_node_index_in_pre_loop_body),
990+
DEBUG_ONLY(_last_node_index_from_backedge_goo(last_node_index_from_backedge_goo) COMMA)
991+
_old_new(old_new) {}
992+
NONCOPYABLE(NodeInMainLoopBody);
993+
994+
// Check if 'node' is not a cloned node (i.e. "< _first_node_index_in_cloned_loop_body") and if we've created a
995+
// clone from 'node' (i.e. _old_new entry is non-null). Then we know that 'node' belongs to the original loop body.
996+
// Additionally check if a node was cloned after the pre loop was created. This indicates that it was created by
997+
// PhaseIdealLoop::clone_up_backedge_goo(). These nodes should also be pinned at the main loop entry.
998+
bool check_node_in_loop_body(Node* node) const override {
999+
if (node->_idx < _first_node_index_in_pre_loop_body) {
1000+
Node* cloned_node = _old_new[node->_idx];
1001+
// Check that the clone is actually part of the cloned loop body and not from some earlier cloning.
1002+
bool cloned_node_in_pre_loop_body = cloned_node != nullptr && cloned_node->_idx >= _first_node_index_in_pre_loop_body;
1003+
assert(!cloned_node_in_pre_loop_body || cloned_node->_idx <= _last_node_index_in_pre_loop_body,
1004+
"clone must be part of pre loop body");
1005+
return cloned_node_in_pre_loop_body;
1006+
}
1007+
// Created in PhaseIdealLoop::clone_up_backedge_goo()?
1008+
bool node_created_by_backedge_goo = node->_idx > _last_node_index_in_pre_loop_body;
1009+
assert(!node_created_by_backedge_goo || node->_idx <= _last_node_index_from_backedge_goo,
1010+
"cloned node must have been created in PhaseIdealLoop::clone_up_backedge_goo()");
1011+
return node_created_by_backedge_goo;
9731012
}
9741013
};
9751014

@@ -984,7 +1023,7 @@ class NodeInClonedLoopBody : public NodeInLoopBody {
9841023

9851024
// Check if 'node' is a clone. This can easily be achieved by comparing its node index to the first node index
9861025
// inside the cloned loop body (all of them are clones).
987-
bool check(Node* node) const override {
1026+
bool check_node_in_loop_body(Node* node) const override {
9881027
return node->_idx >= _first_node_index_in_cloned_loop_body;
9891028
}
9901029
};

src/hotspot/share/runtime/vmThread.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -401,17 +401,17 @@ void VMThread::inner_execute(VM_Operation* op) {
401401
HandleMark hm(VMThread::vm_thread());
402402

403403
const char* const cause = op->cause();
404-
EventMarkVMOperation em("Executing %sVM operation: %s%s%s%s",
405-
prev_vm_operation != nullptr ? "nested " : "",
406-
op->name(),
407-
cause != nullptr ? " (" : "",
408-
cause != nullptr ? cause : "",
409-
cause != nullptr ? ")" : "");
410-
411-
log_debug(vmthread)("Evaluating %s %s VM operation: %s",
412-
prev_vm_operation != nullptr ? "nested" : "",
413-
_cur_vm_operation->evaluate_at_safepoint() ? "safepoint" : "non-safepoint",
414-
_cur_vm_operation->name());
404+
stringStream ss;
405+
ss.print("Executing%s%s VM operation: %s",
406+
prev_vm_operation != nullptr ? " nested" : "",
407+
op->evaluate_at_safepoint() ? " safepoint" : " non-safepoint",
408+
op->name());
409+
if (cause != nullptr) {
410+
ss.print(" (%s)", cause);
411+
}
412+
413+
EventMarkVMOperation em("%s", ss.freeze());
414+
log_debug(vmthread)("%s", ss.freeze());
415415

416416
bool end_safepoint = false;
417417
bool has_timeout_task = (_timeout_task != nullptr);

src/java.desktop/share/classes/javax/swing/text/html/CSS.java

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3088,27 +3088,15 @@ else if (value.equals("smaller")) {
30883088
}
30893089

30903090
float getValue(boolean w3cLengthUnits) {
3091-
Hashtable<String, Float> mapping = (w3cLengthUnits) ? w3cLengthMapping : lengthMapping;
3092-
float scale = 1;
3093-
if (units != null) {
3094-
Float scaleFloat = mapping.get(units);
3095-
if (scaleFloat != null) {
3096-
scale = scaleFloat.floatValue();
3097-
}
3098-
}
3099-
return this.value * scale;
3100-
3091+
return getValue(value, units, w3cLengthUnits);
31013092
}
31023093

3103-
static float getValue(float value, String units, Boolean w3cLengthUnits) {
3104-
Hashtable<String, Float> mapping = (w3cLengthUnits) ? w3cLengthMapping : lengthMapping;
3105-
float scale = 1;
3106-
if (units != null) {
3107-
Float scaleFloat = mapping.get(units);
3108-
if (scaleFloat != null) {
3109-
scale = scaleFloat.floatValue();
3110-
}
3094+
static float getValue(float value, String units, boolean w3cLengthUnits) {
3095+
if (units == null) {
3096+
return value;
31113097
}
3098+
Hashtable<String, Float> mapping = (w3cLengthUnits) ? w3cLengthMapping : lengthMapping;
3099+
float scale = mapping.getOrDefault(units, 1f);
31123100
return value * scale;
31133101
}
31143102

0 commit comments

Comments
 (0)