8258894: C2: Forbid GCM to move stores into loops

Prevent GCM from placing memory-writing nodes (such as stores) into loops deeper
than their home loop (determined by their control input). Such placements are
invalid, as they cause memory definitions to interfere, and risk causing
miscompilations. This change complements JDK-8255763, which only addresses
invalid placements in irreducible CFGs.

Add control input to stores in generated stubs to ensure that all memory-writing
nodes have control inputs from which their home block can be derived.

Add a battery of simplified fuzzer test cases where, before this change, GCM
moves stores into deeper loops.

Reviewed-by: thartmann, kvn
This commit is contained in:
Roberto Castañeda Lozano 2021-01-27 15:08:39 +00:00 committed by Tobias Hartmann
parent ac276bb394
commit f353fcf256
7 changed files with 233 additions and 46 deletions

View file

@ -2748,7 +2748,7 @@ void Compile::Code_Gen() {
print_method(PHASE_GLOBAL_CODE_MOTION, 2);
NOT_PRODUCT( verify_graph_edges(); )
debug_only( cfg.verify(); )
cfg.verify();
}
PhaseChaitin regalloc(unique(), cfg, matcher, false);