RFR: Fix CAS-obj with expected=NULL

Roman Kennke rkennke at redhat.com
Wed Jul 11 15:53:47 UTC 2018


Am 11.07.2018 um 16:58 schrieb Roland Westrelin:
> 
>> http://cr.openjdk.java.net/~rkennke/fix-cas-obj-null/webrev.00/
> 
> That's not right. Matching introduces Binary nodes:
> 
>       case Op_CompareAndSwapN: {   // Convert trinary to binary-tree
>         Node *newval = n->in(MemNode::ValueIn );
>         Node *oldval  = n->in(LoadStoreConditionalNode::ExpectedIn);
>         Node *pair = new BinaryNode( oldval, newval );
>         n->set_req(MemNode::ValueIn,pair);
>         n->del_req(LoadStoreConditionalNode::ExpectedIn);
> 
> so index of inputs changes and existing code is good.
> 
> Roland.
> 

Do you think a similar optimization can be done for narrowOops? E.g.

diff --git a/src/hotspot/cpu/x86/x86_64.ad b/src/hotspot/cpu/x86/x86_64.ad
--- a/src/hotspot/cpu/x86/x86_64.ad
+++ b/src/hotspot/cpu/x86/x86_64.ad
@@ -7657,7 +7657,7 @@
                           memory mem_ptr,
                           rax_RegN oldval, rRegN newval,
                           rFlagsReg cr) %{
-  predicate(!UseShenandoahGC);
+  predicate(!UseShenandoahGC ||
n->in(3)->in(1)->bottom_type()->isa_narrowoop()->get_ptrtype() ==
TypePtr::NULL_PTR);
   match(Set res (CompareAndSwapN mem_ptr (Binary oldval newval)));
   match(Set res (WeakCompareAndSwapN mem_ptr (Binary oldval newval)));
   effect(KILL cr, KILL oldval);
@@ -7780,7 +7780,7 @@
                           memory mem_ptr,
                           rax_RegN oldval, rRegN newval,
                           rFlagsReg cr) %{
-  predicate(!UseShenandoahGC);
+  predicate(!UseShenandoahGC ||
n->in(3)->in(1)->bottom_type()->isa_narrowoop()->get_ptrtype() ==
TypePtr::NULL_PTR);
   match(Set oldval (CompareAndExchangeN mem_ptr (Binary oldval newval)));
   effect(KILL cr);



?



More information about the shenandoah-dev mailing list