[aarch64-port-dev ] [RFR 8u]: 8224851: AArch64: fix warnings and errors with Clang and GCC 8.3

Severin Gehwolf sgehwolf at redhat.com
Fri Mar 6 13:36:45 UTC 2020


Hi,

Could I please get a review for this 8u backport of JDK-8224851? We
need this patch for building JDK 8 with GCC 10. GCC 10 particularly
complains about duplicate declaration of
'using MacroAssembler::call_VM_leaf_base;' in
src/cpu/aarch64/vm/interp_masm_aarch64.hpp

While we could backport only the relevant hunk to fix the GCC 10 issue
I've tried a more complete backport as it seems to be fixing a couple
of code issues. If it's preferred, I can do a select backport of [1]
too. Thoughts?

Bug: https://bugs.openjdk.java.net/browse/JDK-8224851
webrev: http://cr.openjdk.java.net/~sgehwolf/webrevs/JDK-8224851/01/webrev/
JDK 11u change: https://hg.openjdk.java.net/jdk-updates/jdk11u/rev/15cc1c8a6371

Unfortunately the JDK 11u patch doesn't apply cleanly. I needed to do
the following modifications:

 src/hotspot/cpu/aarch64/macroAssembler_aarch64_log.cpp
 src/hotspot/cpu/aarch64/macroAssembler_aarch64_trig.cpp
 src/hotspot/os_cpu/linux_aarch64/atomic_linux_aarch64.hpp

-> not present in 8u. Hunks omitted.

src/cpu/aarch64/vm/assembler_aarch64.hpp.rej
--- assembler_aarch64.hpp
+++ assembler_aarch64.hpp
@@ -2580,7 +2580,7 @@
   // RBIT only allows T8B and T16B but encodes them oddly.  Argh...
   void rbit(FloatRegister Vd, SIMD_Arrangement T, FloatRegister Vn) {
     assert((ASSERTION), MSG);
-    _rbit(Vd, SIMD_Arrangement(T & 1 | 0b010), Vn);
+    _rbit(Vd, SIMD_Arrangement((T & 1) | 0b010), Vn);
   }
 #undef ASSERTION

--> JDK-8134869 not present in 8u. Omitted hunk.

src/cpu/aarch64/vm/c1_LIRAssembler_aarch64.cpp

--> Some whitespace differences. Needed to transplant some hunks manually.

src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp

--> Copyright fixed manually.

src/cpu/aarch64/vm/frame_aarch64.cpp.rej
--- frame_aarch64.cpp
+++ frame_aarch64.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2014, Red Hat Inc. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -767,11 +767,13 @@

 extern "C" void pf(unsigned long sp, unsigned long fp, unsigned long pc,
                    unsigned long bcx, unsigned long thread) {
-  RegisterMap map((JavaThread*)thread, false);
   if (!reg_map) {
-    reg_map = (RegisterMap*)os::malloc(sizeof map, mtNone);
+    reg_map = NEW_C_HEAP_OBJ(RegisterMap, mtNone);
+    ::new (reg_map) RegisterMap((JavaThread*)thread, false);
+  } else {
+    *reg_map = RegisterMap((JavaThread*)thread, false);
   }
-  memcpy(reg_map, &map, sizeof map);
+
   {
     CodeBlob *cb = CodeCache::find_blob((address)pc);
     if (cb && cb->frame_size())

--> fixed manually. Context differed.

src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp.rej
--- os_linux_aarch64.cpp
+++ os_linux_aarch64.cpp
@@ -199,23 +195,8 @@
   return frame(fr->link(), fr->link(), fr->sender_pc());
 }

-intptr_t* _get_previous_fp() {
-  register intptr_t **fp __asm__ (SPELL_REG_FP);
-
-  // fp is for this frame (_get_previous_fp). We want the fp for the
-  // caller of os::current_frame*(), so go up two frames. However, for
-  // optimized builds, _get_previous_fp() will be inlined, so only go
-  // up 1 frame in that case.
-  #ifdef _NMT_NOINLINE_
-    return **(intptr_t***)fp;
-  #else
-    return *fp;
-  #endif
-}
-
-
-frame os::current_frame() {
-  intptr_t* fp = _get_previous_fp();
+NOINLINE frame os::current_frame() {
+  intptr_t *fp = *(intptr_t **)__builtin_frame_address(0);
   frame myframe((intptr_t*)os::current_stack_pointer(),
                 (intptr_t*)fp,
                 CAST_FROM_FN_PTR(address, os::current_frame));
@@ -228,12 +209,6 @@
 }

 // Utility functions
-
-// From IA32 System Programming Guide
-enum {
-  trap_page_fault = 0xE
-};
-
 extern "C" JNIEXPORT int
 JVM_handle_linux_signal(int sig,
                         siginfo_t* info,

-> Fixed manually
   - removed 'const' changes as JDK 8u doesn't have:
     8165929: Constify arguments of Copy methods
   - NOINLINE not defined in os_linux_aarch64.cpp
     defined explicitly in that file.

Tested a build with this on aarch64 Fedora here:
https://koji.fedoraproject.org/koji/taskinfo?taskID=42247457

Thoughts?

Thanks,
Severin

[1] https://hg.openjdk.java.net/jdk-updates/jdk11u/rev/15cc1c8a6371#l6.7



More information about the aarch64-port-dev mailing list