RFR: 8239001: Hotspot build broken on linux-sparc after 8238281

John Paul Adrian Glaubitz glaubitz at physik.fu-berlin.de
Sat Feb 15 18:06:38 UTC 2020


On 2/13/20 8:35 PM, Kim Barrett wrote:
> I don't think this is the right way to address this problem.
> 
> I think the JDK-8238281 change to offset_of and the associated
> addition of -Wno-invalid-offsetof to the build configuration was a
> mistake, and should be reverted.  Those changes seem unrelated to the
> purpose of JDK-8238281, which was to raise the minimum acceptable gcc
> version.

Alternatively, this works as well:

glaubitz at gcc202:~/jdk-hg$ hg diff
diff -r 274a0bcce99d src/hotspot/cpu/sparc/macroAssembler_sparc.hpp
--- a/src/hotspot/cpu/sparc/macroAssembler_sparc.hpp    Sat Feb 15 17:35:57 2020 +0800
+++ b/src/hotspot/cpu/sparc/macroAssembler_sparc.hpp    Sat Feb 15 21:05:10 2020 +0300
@@ -485,12 +485,12 @@
 
   void print(outputStream* s);
 
-  static int i_offset(int j) { return offset_of(RegistersForDebugging, i[j]); }
-  static int l_offset(int j) { return offset_of(RegistersForDebugging, l[j]); }
-  static int o_offset(int j) { return offset_of(RegistersForDebugging, o[j]); }
-  static int g_offset(int j) { return offset_of(RegistersForDebugging, g[j]); }
-  static int f_offset(int j) { return offset_of(RegistersForDebugging, f[j]); }
-  static int d_offset(int j) { return offset_of(RegistersForDebugging, d[j / 2]); }
+  static int i_offset(int j) { return offset_of(RegistersForDebugging, i) + j * sizeof(((RegistersForDebugging*)16)->i[0]); }
+  static int l_offset(int j) { return offset_of(RegistersForDebugging, l) + j * sizeof(((RegistersForDebugging*)16)->l[0]); }
+  static int o_offset(int j) { return offset_of(RegistersForDebugging, o) + j * sizeof(((RegistersForDebugging*)16)->o[0]); }
+  static int g_offset(int j) { return offset_of(RegistersForDebugging, g) + j * sizeof(((RegistersForDebugging*)16)->g[0]); }
+  static int f_offset(int j) { return offset_of(RegistersForDebugging, f) + j * sizeof(((RegistersForDebugging*)16)->f[0]); }
+  static int d_offset(int j) { return offset_of(RegistersForDebugging, d) + (j / 2) * sizeof(((RegistersForDebugging*)16)->d[0]); }
 
   // gen asm code to save regs
   static void save_registers(MacroAssembler* a);

What about this approach?

Alternatively, with C++11, this should work as well:

#include <utility>

static int i_offset(int j) { return offset_of(RegistersForDebugging, i) + j * sizeof(std::declval<RegistersForDebugging>().i[0]); }

Comments?

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaubitz at debian.org
`. `'   Freie Universitaet Berlin - glaubitz at physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913



More information about the build-dev mailing list