Aarch64 port for ZGC, so far

machunhui (C) machunhui2 at huawei.com
Thu Nov 29 06:13:02 UTC 2018


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<mailto:machunhui2 at huawei.com>
2012<tel:2012>实验室-语言虚拟机实验室
2012<tel:2012> Laboratories-Language VM Lab,2012<tel:2012>Labs



More information about the zgc-dev mailing list