RFR: Refactor asm acmp

Aleksey Shipilev shade at redhat.com
Tue Jul 18 14:23:57 UTC 2017


On 07/18/2017 04:18 PM, Roman Kennke wrote:
> This bugs me since a while. Wherever we do compare objects in assembly
> code (i.e. interpreter and C1), we use to write something like:
> 
> __ cmpptr(o1, o2)
> 
> oopDesc::bs()->asm_acmp_barrier(o1, o2)
> 
> 
> where the asm_acmp_barrier() would *expect* to be preceded by cmpptr,
> and pick up its condition flags, etc, and produce the same condition flags.
> 
> It all seems brittle and not very obvious.
> 
> I propose to change that to:
> 
> __ cmp_objects(o1, o2);
> 
> and call the acmp barrier from there. This makes consuming code much
> more obvious, and the call to the barrier set more contained.

The patch looks fine, but this makes me thinking if we should instead reuse
cmpoop(), by implementing it at _LP64:

2643 #ifdef _LP64
2644           __ movoop(rscratch1, o);
2645           __ cmp_objects(reg1, rscratch1);

2646 #else
2647           __ cmpoop(reg1, c->as_jobject());
2648 #endif // _LP64

That would make a good upstream patch too :)

-Aleksey



More information about the shenandoah-dev mailing list