A small favor if you can PrintAssembly on non x86?
David Holmes - Sun Microsystems
David.Holmes at Sun.COM
Fri Nov 27 22:00:28 UTC 2009
Dennis,
You may both be running different versions of VM - and your version
doesn't have the same optimizations to remove unnecessary fences. Also
the mfence has fallen out of favour as it's more expensive than
alternatives. See Dave Dice's blog on this (and other related topics):
http://blogs.sun.com/dave/resource/NHM-Pipeline-Blog-V2.txt
Cheers,
David Holmes
Dennis Byrne said the following on 11/28/09 04:09:
> Thank you very much Christian. I find it interesting that you have
> one full fence for the write method while I get two on an x86. The
> write method performs two writes, so the VM must separate both writes
> with a StoreStore barrier. According to the "Here's how these
> processors support barriers" section in the cookbook [1] these are no
> ops on both platforms. This explains why your compiler is not putting
> a fence between both writes, so I am curious why mine still does.
>
> Yours w/ one fence (on sparc)
>
> 0xfa8eceac: mov 0x2a, %l0 ;...a010202a
> 0xfa8eceb0: st %l0, [ %l1 + 0x150 ] ;...e0246150
> 0xfa8eceb4: mov 1, %l2 ;...a4102001
> 0xfa8eceb8: stb %l2, [ %l1 + 0x154 ] ;...e42c6154
> 0xfa8ecebc: membar #StoreLoad ;...8143e002
>
> Mine with two fences (on x86)
>
> 0x00f7801d: mov $0x95ba53c0,%esi ;...bec053ba 95
> ; {oop()}
> 0x00f78022: mov $0x2a,%edi ;...bf2a0000 00
> 0x00f78027: mov %edi,0x148(%esi) ;...89be4801 0000
> 0x00f7802d: mfence ;...0faef0
> 0x00f78030: mov $0x1,%edi ;...bf010000 00
> 0x00f78035: mov %edi,%ebx ;...8bdf
> 0x00f78037: mov %bl,0x14c(%esi) ;...889e4c01 0000
> 0x00f7803d: mfence ;...0faef0
>
>
>
> [1] http://gee.cs.oswego.edu/dl/jmm/cookbook.html
>
> Dennis
>
> On Fri, Nov 27, 2009 at 10:30 AM, Christian Thalinger
> <Christian.Thalinger at sun.com> wrote:
>> On Fri, 2009-11-27 at 06:42 -0900, Dennis Byrne wrote:
>>> $ wget http://people.apache.org/~dennisbyrne/memory/WriterReader.java
>>> $ javac WriterReader.java
>>> $ java -XX:+UnlockDiagnosticVMOptions
>>> -XX:PrintAssemblyOptions=hsdis-print-bytes
>>> -XX:CompileCommand=print,WriterReader.write WriterReader > write.txt
>>> $ java -XX:+UnlockDiagnosticVMOptions
>>> -XX:PrintAssemblyOptions=hsdis-print-bytes
>>> -XX:CompileCommand=print,WriterReader.read WriterReader > read.txt
>>>
>>> Ideal would be Itanium or PPC output. These memory models are much
>>> different and would give me more examples to write about. The weaker
>>> the better. Sparc would still be interesting also.
>>>
>>> Getting a hold of a non-x86 system has been more difficult than
>>> writing the article itself. Any help you can give me is greatly
>>> appreciated.
>> I did a run on SPARC for you (had to increase the loop length a little).
>>
>> -- Christian
>>
>
>
>
More information about the discuss
mailing list