[aarch64-port-dev ] JCStress Failure -WCAS_WCAS
Aleksey Shipilev
shade at redhat.com
Fri Sep 16 15:02:06 UTC 2016
Hi Stuart,
On 09/16/2016 02:52 PM, Stuart Monteith wrote:
> I've have tests-chapter-1a compiling by generating a jar to use
> "--add-patch" against so that @sun.misc.Contended will apparently be
> in the jdk.unsupported module, but of course, that's not the problem
> once you actually try to run.
Yes, but I would prefer to have all these little Jigsaw pummeling
options out, if possible.
> Your changes look good to me, with the exception of the Padding. There
> is an Aarch64 system that requires 128 bytes of padding to avoid
> contention. If I interpret what you've written correctly, the booleans
> you use for padding will be 64 bytes in length. Am I correct in
> thinking booleans are 4 bytes in Hotspot fields?
No. Booleans are 1-byte fields in HotSpot. But Padding plus two classes
generates 16x16 = 256 booleans on each side of the protected field,
which yields 256 bytes around it. See e.g.:
$ java --add-exports java.base/jdk.internal.vm.annotation=ALL-UNNAMED
-jar jol-cli.jar internals -cp tests-custom/target/jcstress.jar
org.openjdk.jcstress.infra.results.CharResult1_jcstress
org.openjdk.jcstress.infra.results.CharResult1_jcstress object internals:
OFFSET SIZE TYPE DESCRIPTION VALUE
0 4 (object header) ...
4 4 (object header) ...
8 4 (object header) ...
12 2 char CharResult1.r1 \00
14 2 (alignment/padding gap) N/A
16 1 boolean CharResult1_jcstress_c2.p000 false
17 1 boolean CharResult1_jcstress_c2.p001 false
18 1 boolean CharResult1_jcstress_c2.p002 false
...
270 1 boolean CharResult1_jcstress_c2.p254 false
271 1 boolean CharResult1_jcstress_c2.p255 false
272 4 int CharResult1_jcstress_c1.trap 0
276 1 boolean CharResult1_jcstress.p000 false
277 1 boolean CharResult1_jcstress.p001 false
...
530 1 boolean CharResult1_jcstress.p254 false
531 1 boolean CharResult1_jcstress.p255 false
532 4 (loss due to the next object alignment)
Instance size: 536 bytes
> The @Contended flag has the correct behaviour as it can query the
> appropriate granule size.
Yes, I know about the benefits of @Contended. Alas, using it in
compatible manner outside JDK is a nuisance. Granted, this is partially
my own fault for not pressing this hard enough during the original
development, but hey, I *was* suggesting java.util.concurrent.Contended
:) Hierarchy trick is the next best thing.
Thanks,
-Aleksey
More information about the aarch64-port-dev
mailing list