diff --git a/src/hotspot/share/opto/output.cpp b/src/hotspot/share/opto/output.cpp index 36d42a59948..d10c6f4c208 100644 --- a/src/hotspot/share/opto/output.cpp +++ b/src/hotspot/share/opto/output.cpp @@ -3160,6 +3160,19 @@ void Scheduling::ComputeRegisterAntidependencies(Block *b) { break; } } + + // Do not allow a CheckCastPP node whose input is a raw pointer to + // float past a safepoint. This can occur when a buffered inline + // type is allocated in a loop and the CheckCastPP from that + // allocation is reused outside the loop. If the use inside the + // loop is scalarized the CheckCastPP will no longer be connected + // to the loop safepoint. See JDK-8264340. + if (m->is_Mach() && m->as_Mach()->ideal_Opcode() == Op_CheckCastPP) { + Node *def = m->in(1); + if (def != NULL && def->bottom_type()->base() == Type::RawPtr) { + last_safept_node->add_prec(m); + } + } } if( n->jvms() ) { // Precedence edge from derived to safept