Parallel GC and array object layout: way off the base and laid out in reverse?

Aleksey Shipilev aleksey.shipilev at oracle.com
Wed Sep 4 11:01:11 UTC 2013


Hi Thomas,

On 09/04/2013 02:19 PM, Thomas Schatzl wrote:
>   no, you are tripping over a (well?) known peculiarity of
> java.lang.Integer in the HotSpot VM.

I know about this behavior for the *autoboxing conversion*. The test is
not affected, because it uses new Integer(), which due to object
identity semantics of Java language can not be interned. If you say that
"new Integer(10) == new Integer(10)" due to underlying VM mechanics, I
will say that VM violates the JLS.

Nevertheless, this is the updated test:
  http://cr.openjdk.java.net/~shade/scratch/ArrayLayoutTest.java

See the issue is perfectly reproduced:

$ ~/Install/jdk8b104/bin/java ArrayLayoutTest
Before the GC:
array is at 4120951415 (0 units off base)
  object is at 4120951569, 154 units off base, toString = String0
  object is at 4120951585, 170 units off base, toString = String1
  object is at 4120951601, 186 units off base, toString = String2
  object is at 4120951617, 202 units off base, toString = String3
  object is at 4120951633, 218 units off base, toString = String4
  object is at 4120951649, 234 units off base, toString = String5
  object is at 4120951665, 250 units off base, toString = String6
  object is at 4120951681, 266 units off base, toString = String7
  object is at 4120951697, 282 units off base, toString = String8
  object is at 4120951713, 298 units off base, toString = String9

After the GC:
array is at 3772784643 (0 units off base)
  object is at 3772781056, -3587 units off base, toString = String0
  object is at 3772781112, -3531 units off base, toString = String1
  object is at 3772777074, -7569 units off base, toString = String2
  object is at 3772777081, -7562 units off base, toString = String3
  object is at 3772777088, -7555 units off base, toString = String4
  object is at 3772781367, -3276 units off base, toString = String5
  object is at 3772781374, -3269 units off base, toString = String6
  object is at 3772781381, -3262 units off base, toString = String7
  object is at 3772781535, -3108 units off base, toString = String8
  object is at 3772781549, -3094 units off base, toString = String9

-Aleksey.



More information about the hotspot-gc-dev mailing list