From ca21bf088f39d2db2ce093fa9cf2e266cb058ca1 Mon Sep 17 00:00:00 2001 From: xin liu Date: Thu, 11 Jan 2024 16:26:37 -0800 Subject: [PATCH] JVM-2568: compilation of Nodes::flatten in ForkJoin framework. (#88) This patch fixed a bug for loop. PEA marks live objects 'Escaped' at loop headers right before Parse mounts phi nodes. The bug is introduced in the refactor of alias. We skipped aliasing the trivial phi with its single input. Co-authored-by: Xin Liu --- src/hotspot/share/opto/parse1.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/hotspot/share/opto/parse1.cpp b/src/hotspot/share/opto/parse1.cpp index d0367f82a429f..b4919043f52ff 100644 --- a/src/hotspot/share/opto/parse1.cpp +++ b/src/hotspot/share/opto/parse1.cpp @@ -706,6 +706,11 @@ void Parse::do_all_blocks() { progress = true; if (block->is_loop_head() || block->is_handler() || (has_irreducible && !block->is_ready())) { + // mark live objects 'Escaped' in map before mounting phi nodes. + if (DoPartialEscapeAnalysis && block->is_loop_head()) { + PEAState& as = jvms()->alloc_state(); + as.mark_all_live_objects_escaped(PEA(), map()); + } // Not all preds have been parsed. We must build phis everywhere. // (Note that dead locals do not get phis built, ever.) ensure_phis_everywhere(); @@ -734,11 +739,6 @@ void Parse::do_all_blocks() { // Leave behind an undisturbed copy of the map, for future merges. set_map(clone_map()); - - if (DoPartialEscapeAnalysis && block->is_loop_head()) { - PEAState& as = jvms()->alloc_state(); - as.mark_all_live_objects_escaped(PEA(), block->start_map()); - } } if (control()->is_Region() && !block->is_loop_head() && !has_irreducible && !block->is_handler()) {