8213411: JDK-8209189 incorrect for Big Endian (JVM crashes)

Doerr, Martin martin.doerr at sap.com
Tue Nov 6 10:56:30 UTC 2018

Hi Erik,

thanks for fixing the issue so quickly. Looks good.

Note that in
  if (state_unloading_cycle == CodeCache::unloading_cycle()) {
    return state_is_unloading;
you could also use "return false" which would be equivalent. Not sure what is better readable. (No need for a new webrev.)

Best regards,

-----Original Message-----
From: Erik Österlund <erik.osterlund at oracle.com> 
Sent: Dienstag, 6. November 2018 11:34
To: hotspot-dev developers <hotspot-dev at openjdk.java.net>
Cc: Doerr, Martin <martin.doerr at sap.com>
Subject: RFR: 8213411: JDK-8209189 incorrect for Big Endian (JVM crashes)


In my patch for 8209189 I assumed that the following struct containing a 
bit field using 3 bits, would be packed to one byte:

struct IsUnloadingStruct {
   unsigned int _is_unloading:1;
   unsigned int _unloading_cycle:2;

Turns out though that the size of this 3 bit bitfield is typically 4 
bytes, causing trouble on big endian machines. The compilers can be 
tamed to turn this to a byte (as expected) by using struct packing.

So the two most obvious solutions are either
1) Make a struct packing macro, and trust the compilers won't mess up then.
2) Do manual bit fiddling because we do not trust compilers.

Martin convinced me to go with #2.



Running a bunch of tests while waiting for review.


More information about the hotspot-dev mailing list