Skip to content

Commit e1280b3

Browse files
committed
8355299: [lworld] C2 compilation fails with "unexpected yanked node"
1 parent ad591c5 commit e1280b3

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/hotspot/share/opto/inlinetypenode.cpp

+5-3
Original file line numberDiff line numberDiff line change
@@ -617,10 +617,12 @@ void InlineTypeNode::convert_from_payload(GraphKit* kit, BasicType bt, Node* pay
617617
}
618618
value = gvn->transform(new CastI2NNode(kit->control(), value));
619619
value = gvn->transform(new DecodeNNode(value, val_type->make_narrowoop()));
620-
// TODO 8350865 Should we add the membar to the CastI2N and give it a type?
621620
value = gvn->transform(new CastPPNode(kit->control(), value, val_type, ConstraintCastNode::UnconditionalDependency));
622-
// Prevent the CastI2N from floating below a safepoint
623-
kit->insert_mem_bar(Op_MemBarVolatile, value);
621+
622+
// Similar to CheckCastPP nodes with raw input, CastI2N nodes require special handling in 'PhaseCFG::schedule_late' to ensure the
623+
// register allocator does not move the CastI2N below a safepoint. This is necessary to avoid having the raw pointer span a safepoint,
624+
// making it opaque to the GC. Unlike CheckCastPPs, which need extra handling in 'Scheduling::ComputeRegisterAntidependencies' due to
625+
// scalarization, CastI2N nodes are always used by a load if scalarization happens which inherently keeps them pinned above the safepoint.
624626

625627
if (ft->is_inlinetype()) {
626628
GrowableArray<ciType*> visited;

test/hotspot/jtreg/compiler/valhalla/inlinetypes/TestGenerated.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
/**
2525
* @test
26-
* @bug 8260034 8260225 8260283 8261037 8261874 8262128 8262831 8306986
26+
* @bug 8260034 8260225 8260283 8261037 8261874 8262128 8262831 8306986 8355299
2727
* @summary A selection of generated tests that triggered bugs not covered by other tests.
2828
* @enablePreview
2929
* @modules java.base/jdk.internal.value
@@ -32,6 +32,8 @@
3232
* compiler.valhalla.inlinetypes.TestGenerated
3333
* @run main/othervm -Xbatch -XX:-UseArrayFlattening
3434
* compiler.valhalla.inlinetypes.TestGenerated
35+
* @run main/othervm -Xbatch -XX:+UseNullableValueFlattening -XX:+UseAtomicValueFlattening -XX:+UseNonAtomicValueFlattening
36+
* compiler.valhalla.inlinetypes.TestGenerated
3537
*/
3638

3739
package compiler.valhalla.inlinetypes;

0 commit comments

Comments
 (0)