8162540: Crash in C2 escape analysis with assert: "node should be registered"
Summary: GetAndSet, CompareAndExchange and CompareAndSwap intrinsics emit unsafe accesses to oop fields.
Reviewed-by: kvn
--- a/hotspot/src/share/vm/opto/escape.cpp Thu Jul 28 09:57:49 2016 -0400
+++ b/hotspot/src/share/vm/opto/escape.cpp Fri Jul 29 08:36:13 2016 +0200
@@ -2067,7 +2067,9 @@
bt = field->layout_type();
} else {
// Check for unsafe oop field access
- if (n->has_out_with(Op_StoreP, Op_LoadP, Op_StoreN, Op_LoadN)) {
+ if (n->has_out_with(Op_StoreP, Op_LoadP, Op_StoreN, Op_LoadN) ||
+ n->has_out_with(Op_GetAndSetP, Op_GetAndSetN, Op_CompareAndExchangeP, Op_CompareAndExchangeN) ||
+ n->has_out_with(Op_CompareAndSwapP, Op_CompareAndSwapN, Op_WeakCompareAndSwapP, Op_WeakCompareAndSwapN)) {
bt = T_OBJECT;
(*unsafe) = true;
}
@@ -2083,7 +2085,9 @@
}
} else if (adr_type->isa_rawptr() || adr_type->isa_klassptr()) {
// Allocation initialization, ThreadLocal field access, unsafe access
- if (n->has_out_with(Op_StoreP, Op_LoadP, Op_StoreN, Op_LoadN)) {
+ if (n->has_out_with(Op_StoreP, Op_LoadP, Op_StoreN, Op_LoadN) ||
+ n->has_out_with(Op_GetAndSetP, Op_GetAndSetN, Op_CompareAndExchangeP, Op_CompareAndExchangeN) ||
+ n->has_out_with(Op_CompareAndSwapP, Op_CompareAndSwapN, Op_WeakCompareAndSwapP, Op_WeakCompareAndSwapN)) {
bt = T_OBJECT;
}
}