8329797: Shenandoah: Default case invoked for: "MaxL" (bad AD file)
Reviewed-by: shade, thartmann
This commit is contained in:
parent
ccc0d0f7b1
commit
d32f109219
@ -624,6 +624,7 @@ Compile::Compile( ciEnv* ci_env, ciMethod* target, int osr_bci,
|
|||||||
_stub_entry_point(nullptr),
|
_stub_entry_point(nullptr),
|
||||||
_max_node_limit(MaxNodeLimit),
|
_max_node_limit(MaxNodeLimit),
|
||||||
_post_loop_opts_phase(false),
|
_post_loop_opts_phase(false),
|
||||||
|
_allow_macro_nodes(true),
|
||||||
_inlining_progress(false),
|
_inlining_progress(false),
|
||||||
_inlining_incrementally(false),
|
_inlining_incrementally(false),
|
||||||
_do_cleanup(false),
|
_do_cleanup(false),
|
||||||
@ -915,6 +916,7 @@ Compile::Compile( ciEnv* ci_env,
|
|||||||
_stub_entry_point(nullptr),
|
_stub_entry_point(nullptr),
|
||||||
_max_node_limit(MaxNodeLimit),
|
_max_node_limit(MaxNodeLimit),
|
||||||
_post_loop_opts_phase(false),
|
_post_loop_opts_phase(false),
|
||||||
|
_allow_macro_nodes(true),
|
||||||
_inlining_progress(false),
|
_inlining_progress(false),
|
||||||
_inlining_incrementally(false),
|
_inlining_incrementally(false),
|
||||||
_has_reserved_stack_access(false),
|
_has_reserved_stack_access(false),
|
||||||
|
@ -318,6 +318,7 @@ class Compile : public Phase {
|
|||||||
uintx _max_node_limit; // Max unique node count during a single compilation.
|
uintx _max_node_limit; // Max unique node count during a single compilation.
|
||||||
|
|
||||||
bool _post_loop_opts_phase; // Loop opts are finished.
|
bool _post_loop_opts_phase; // Loop opts are finished.
|
||||||
|
bool _allow_macro_nodes; // True if we allow creation of macro nodes.
|
||||||
|
|
||||||
int _major_progress; // Count of something big happening
|
int _major_progress; // Count of something big happening
|
||||||
bool _inlining_progress; // progress doing incremental inlining?
|
bool _inlining_progress; // progress doing incremental inlining?
|
||||||
@ -787,6 +788,9 @@ private:
|
|||||||
void set_post_loop_opts_phase() { _post_loop_opts_phase = true; }
|
void set_post_loop_opts_phase() { _post_loop_opts_phase = true; }
|
||||||
void reset_post_loop_opts_phase() { _post_loop_opts_phase = false; }
|
void reset_post_loop_opts_phase() { _post_loop_opts_phase = false; }
|
||||||
|
|
||||||
|
bool allow_macro_nodes() { return _allow_macro_nodes; }
|
||||||
|
void reset_allow_macro_nodes() { _allow_macro_nodes = false; }
|
||||||
|
|
||||||
void record_for_post_loop_opts_igvn(Node* n);
|
void record_for_post_loop_opts_igvn(Node* n);
|
||||||
void remove_from_post_loop_opts_igvn(Node* n);
|
void remove_from_post_loop_opts_igvn(Node* n);
|
||||||
void process_for_post_loop_opts_igvn(PhaseIterGVN& igvn);
|
void process_for_post_loop_opts_igvn(PhaseIterGVN& igvn);
|
||||||
|
@ -2448,6 +2448,8 @@ void PhaseMacroExpand::eliminate_macro_nodes() {
|
|||||||
//------------------------------expand_macro_nodes----------------------
|
//------------------------------expand_macro_nodes----------------------
|
||||||
// Returns true if a failure occurred.
|
// Returns true if a failure occurred.
|
||||||
bool PhaseMacroExpand::expand_macro_nodes() {
|
bool PhaseMacroExpand::expand_macro_nodes() {
|
||||||
|
// Do not allow new macro nodes once we started to expand
|
||||||
|
C->reset_allow_macro_nodes();
|
||||||
if (StressMacroExpansion) {
|
if (StressMacroExpansion) {
|
||||||
C->shuffle_macro_nodes();
|
C->shuffle_macro_nodes();
|
||||||
}
|
}
|
||||||
|
@ -200,9 +200,8 @@ CMoveNode *CMoveNode::make(Node *c, Node *bol, Node *left, Node *right, const Ty
|
|||||||
|
|
||||||
// Try to identify min/max patterns in CMoves
|
// Try to identify min/max patterns in CMoves
|
||||||
Node* CMoveNode::Ideal_minmax(PhaseGVN* phase, CMoveNode* cmove) {
|
Node* CMoveNode::Ideal_minmax(PhaseGVN* phase, CMoveNode* cmove) {
|
||||||
// If we're post loop opts then don't attempt to match the min/max pattern, as this node might have been a
|
// Only create MinL/MaxL if we are allowed to create macro nodes.
|
||||||
// MinL or MaxL that was already expanded during macro expansion.
|
if (!phase->C->allow_macro_nodes()) {
|
||||||
if (phase->C->post_loop_opts_phase()) {
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,12 +30,12 @@ import jdk.test.lib.Utils;
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* @test
|
* @test
|
||||||
|
* @bug 8324655 8329797
|
||||||
* @key randomness
|
* @key randomness
|
||||||
* @bug 8324655
|
|
||||||
* @summary Test that if expressions are properly folded into min/max nodes
|
* @summary Test that if expressions are properly folded into min/max nodes
|
||||||
* @requires os.arch != "riscv64"
|
* @requires os.arch != "riscv64"
|
||||||
* @library /test/lib /
|
* @library /test/lib /
|
||||||
* @run main compiler.c2.irTests.TestIfMinMax
|
* @run driver compiler.c2.irTests.TestIfMinMax
|
||||||
*/
|
*/
|
||||||
public class TestIfMinMax {
|
public class TestIfMinMax {
|
||||||
private static final Random RANDOM = Utils.getRandomInstance();
|
private static final Random RANDOM = Utils.getRandomInstance();
|
||||||
@ -140,6 +140,42 @@ public class TestIfMinMax {
|
|||||||
return a <= b ? b : a;
|
return a <= b ? b : a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class Dummy {
|
||||||
|
long l;
|
||||||
|
public Dummy(long l) { this.l = l; }
|
||||||
|
}
|
||||||
|
|
||||||
|
@Setup
|
||||||
|
Object[] setupDummyArray() {
|
||||||
|
Dummy[] arr = new Dummy[512];
|
||||||
|
for (int i = 0; i < 512; i++) {
|
||||||
|
arr[i] = new Dummy(RANDOM.nextLong());
|
||||||
|
}
|
||||||
|
return new Object[] { arr };
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Arguments(setup = "setupDummyArray")
|
||||||
|
@IR(failOn = { IRNode.MAX_L })
|
||||||
|
public long testMaxLAndBarrierInLoop(Dummy[] arr) {
|
||||||
|
long result = 0;
|
||||||
|
for (int i = 0; i < arr.length; ++i) {
|
||||||
|
result += Math.max(arr[i].l, 1);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Arguments(setup = "setupDummyArray")
|
||||||
|
@IR(failOn = { IRNode.MIN_L })
|
||||||
|
public long testMinLAndBarrierInLoop(Dummy[] arr) {
|
||||||
|
long result = 0;
|
||||||
|
for (int i = 0; i < arr.length; ++i) {
|
||||||
|
result += Math.min(arr[i].l, 1);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
@Setup
|
@Setup
|
||||||
static Object[] setupIntArrays() {
|
static Object[] setupIntArrays() {
|
||||||
int[] a = new int[512];
|
int[] a = new int[512];
|
||||||
|
Loading…
Reference in New Issue
Block a user