proposed membar simplification in c2

Roland Westrelin roland.westrelin at
Tue Jul 19 03:39:34 PDT 2011

To implement the java memory model, on a monitor operation, c2 currently adds a MemBarAcquire/MemBarRelease node after/before the monitor enter/exit. No membar instruction is emitted for these MemBarAcquire/MemBarRelease: in the ad file, Matcher::prior_fast_lock()/Matcher::post_fast_unlock() is used to detect a MemBarAcquire/MemBarRelease associated with a monitor enter/exit and to use an empty encoding.

Matcher::post_fast_unlock() is broken with UseOptoBiasInlining: it never returns true.

Rather than fix it, I suggest we use MemBarCPUOrder nodes instead of MemBarAcquire/MemBarRelease nodes on the monitor enter/exit code paths. That would have the same effect as MemBarAcquire/MemBarRelease with empty encodings and is straightforward.


More information about the hotspot-compiler-dev mailing list