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. This CR covers the replacement of MemBarAcquire/MemBarRelease nodes on the monitor enter/exit code paths with new MemBarAcquireLock/MemBarReleaseLock nodes. It makes it straightforward to distinguish between MemBarAcquire/MemBarRelease on the monitor enter/exit code paths and other code paths without the need for the MemBarAcquire/MemBarRelease machinery.
|