Aarch64 port for ZGC, so far
Stuart Monteith
stuart.monteith at linaro.org
Thu Nov 29 19:14:43 UTC 2018
Hello,
This latest patch changes the arraycopy_prologue to pass the source
as well as the destination, and for the ZGC array_copy prologue to use
the source instead:
http://cr.openjdk.java.net/~smonteith/zgc/webrev-20181129/
I'm running a long test with the C1 compiler, so I'll see whether that
removes the rarer failures.
BR,
Stuart
On Thu, 29 Nov 2018 at 18:01, Stuart Monteith
<stuart.monteith at linaro.org> wrote:
>
> Thanks for pointing that out Ma Chunhui,
>
> What you suggest can't be done as ZGC isn't just a compile time
> option, it is also a run-time option. You are quite right though - the
> array prologue needs to take the src and dest and decide what it needs
> to do.
>
> I'll incorporate this into the aarch64 specific code by adding the
> source too the method signature and the other dependencies in a manner
> that will be correct for with/without ZGC.
>
> This will explain some of the rarer problems I 'm seeing.
>
> On Thu, 29 Nov 2018 at 06:13, machunhui (C) <machunhui2 at huawei.com> wrote:
> >
> > Hi, Stuart
> >
> > With your latest patch, It seems that Interpreter and C1 works fine on my machine and my case. But there is a crash when using C2.
> >
> >
> >
> > My Option is: -XX:+UseZGC -XX:-TieredCompilation -XX:ParallelGCThreads=1 -XX:ConcGCThreads=1 -XX:+Use64BitLiteralOops
> >
> > And the crash happens only when java main thread is exited, after DestroyJavaVM.
> >
> >
> >
> > The crash stack:
> >
> > 30 V [libjvm.so+0x121b968] ZPage::is_active() const+0xc
> >
> > 31 V [libjvm.so+0x123b180] ZMark::try_mark_object(ZMarkCache*, unsigned long, bool)+0x48
> >
> > 32 V [libjvm.so+0x123b28c] ZMark::mark_and_follow(ZMarkCache*, ZMarkStackEntry)+0x6c
> >
> > 33 V [libjvm.so+0x123e6d4] bool ZMark::drain<ZMarkNoTimeout>(ZMarkStripe*, ZMarkThreadLocalStacks*, ZMarkCache*, ZMarkNoTimeout*)+0x7c
> >
> >
> >
> > The crash is because when trying to mark object, it failed to find page for the given object address, which is 0xbaadbabe. And the reason is because in StubGenerator:: generate_disjoint_copy, when trying to add load-barrier in aarch64, the barrier is wrongly added to dest, not src.
> >
> > So the fix is quite simple, when using ZGC, add load-barrier to src instead of dest.
> >
> >
> >
> > diff --git a/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp b/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp
> >
> > index a1fd069c7b..fc7f209d62 100644
> >
> > --- a/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp
> >
> > +++ b/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp
> >
> > @@ -1377,7 +1377,11 @@ class StubGenerator: public StubCodeGenerator {
> >
> > }
> >
> >
> >
> > BarrierSetAssembler *bs = BarrierSet::barrier_set()->barrier_set_assembler();
> >
> > +#if INCLUDE_ZGC
> >
> > + bs->arraycopy_prologue(_masm, decorators, is_oop, s, count, saved_reg);
> >
> > +#else
> >
> > bs->arraycopy_prologue(_masm, decorators, is_oop, d, count, saved_reg);
> >
> > +#endif
> >
> >
> >
> > if (is_oop) {
> >
> > // save regs before copy_memory
> >
> > @@ -1451,7 +1455,11 @@ class StubGenerator: public StubCodeGenerator {
> >
> > }
> >
> >
> >
> > BarrierSetAssembler *bs = BarrierSet::barrier_set()->barrier_set_assembler();
> >
> > +#if INCLUDE_ZGC
> >
> > + bs->arraycopy_prologue(_masm, decorators, is_oop, s, count, saved_regs);
> >
> > +#else
> >
> > bs->arraycopy_prologue(_masm, decorators, is_oop, d, count, saved_regs);
> >
> > +#endif
> >
> >
> >
> > if (is_oop) {
> >
> > // save regs before copy_memory
> >
> >
> >
> > Thanks.
> >
> >
> >
> > --------------------------------------------------
> > 马春辉 Ma Chunhui
> > Mail: machunhui2 at huawei.com
> > 2012实验室-语言虚拟机实验室
> > 2012 Laboratories-Language VM Lab,2012Labs
> >
> >
More information about the zgc-dev
mailing list