<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<p>We only have <a class="moz-txt-link-freetext" href="https://bugs.openjdk.org/browse/JDK-8300148">https://bugs.openjdk.org/browse/JDK-8300148</a> for
that.</p>
<p>thanks,</p>
<p>dl<br>
</p>
<div class="moz-cite-prefix">On 1/8/24 10:23 PM, Kuai Wei wrote:<br>
</div>
<blockquote type="cite" cite="mid:5e41f867-b31b-4ded-b737-8d0c869c8895.kuaiwei.kw@alibaba-inc.com">
<div class="__aliyun_email_body_block">
<div style="line-height:1.7;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">
<div style="clear:both;"><br>
</div>
<div style="clear:both;">Hi,</div>
<div style="clear:both;"><br>
</div>
<div style="clear:both;"> I made some experiments on object
allocation performance. And I found on aarch64 N1, if object
has final field, the allocation rate is about 75% of normal
allocation.</div>
<div style="clear:both;">The cause is C2 will insert a release
membar in <init> , which will be translated as
"dmb.ish" in aarch64. For normal allocation, a membar
storestore is inserted and</div>
<div style="clear:both;">is emitted as "dmb.ishst", it make
the difference. The test jmh is <span><a href="https://gist.github.com/kuaiwei/f71fba40df29991c93325a8600e34c13" target="_blank" moz-do-not-send="true" class="moz-txt-link-freetext">https://gist.github.com/kuaiwei/f71fba40df29991c93325a8600e34c13</a></span></div>
<div style="clear:both;"><br>
</div>
<div style="clear:both;"><span>java -jar target/benchmarks.jar
-f 1 -wi 5 -w 3 -i 3 -r 3 testAlloc</span></div>
<div style="clear:both;"><span>...</span></div>
<div style="clear:both;"><span><br>
</span></div>
<div style="clear:both;"><span><span>Benchmark
Mode Cnt Score Error Units<br>
</span></span>
<div style="clear:both;">AllocFinal.testAlloc
thrpt 3 1167.903 ± 44.973 ops/s<br>
</div>
<div><span>AllocFinal.testAllocWithFinal thrpt 3
915.330 ± 52.596 ops/s</span></div>
</div>
<div style="clear:both;"><br>
</div>
<div style="clear:both;"><br>
</div>
<div style="clear:both;"> I found only C2 will insert release
membar and C1 just insert storestore for both final and
normal allocation. In Doug Lea's cookbook <span><a href="https://gee.cs.oswego.edu/dl/jmm/cookbook.html" target="_blank" moz-do-not-send="true" class="moz-txt-link-freetext">https://gee.cs.oswego.edu/dl/jmm/cookbook.html</a></span></div>
<div style="clear:both;">Only storesotre is required. Alex has
a great post on this topic <span><a href="https://shipilev.net/blog/2014/all-fields-are-final/" target="_blank" moz-do-not-send="true" class="moz-txt-link-freetext">https://shipilev.net/blog/2014/all-fields-are-final/</a> .
It referred a case why loadstore is needed. </span><span><a href="https://www.hboehm.info/c++mm/no_write_fences.html" target="_blank" moz-do-not-send="true" class="moz-txt-link-freetext">https://www.hboehm.info/c++mm/no_write_fences.html</a></span></div>
<div style="clear:both;">I checked this case and IMO it looks
some legacy architecture may break data dependency and cause
problem. As I know, alpha architecture is an example. I
think it doesn't</div>
<div style="clear:both;">break on modern architecture. Is
there other case I missed?</div>
<div style="clear:both;"><br>
</div>
<div style="clear:both;"> If storestore is enough in this
situation, I will send a PR to loose the barrier. </div>
<div style="clear:both;"><br>
</div>
<div style="clear:both;">Thanks,</div>
<div style="clear:both;">Kuai Wei</div>
</div>
</div>
</blockquote>
</body>
</html>