United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6822204 volatile fences should prefer lock:addl to actual mfence instructions
JDK-6822204 : volatile fences should prefer lock:addl to actual mfence instructions

Details
Type:
Bug
Submit Date:
2009-03-25
Status:
Resolved
Updated Date:
2010-04-02
Project Name:
JDK
Resolved Date:
2009-04-08
Component:
hotspot
OS:
solaris_9
Sub-Component:
compiler
CPU:
x86
Priority:
P3
Resolution:
Fixed
Affected Versions:
hs15
Fixed Versions:
hs15 (b05)

Related Reports
Backport:
Backport:
Relates:

Sub Tasks

Description
When generating code for volatile memory accesses on x86 we currently use the mfence instruction if it is available and fall back to a lock:addl [esp], 0 when it's not.  For the purposes of volatile synchronization they are equivalent in power but on some processors the mfence is more expensive so we should prefer the lock:addl idiom.

                                    

Comments
EVALUATION

The fix is to put the logic for using lock:addl into membar and use membar in the appropriate places.  mfence should always generate mfence.
                                     
2009-03-25
EVALUATION

http://hg.openjdk.java.net/jdk7/hotspot-comp/hotspot/rev/d0994e5bebce
                                     
2009-03-27



Hardware and Software, Engineered to Work Together