RFR (S) CR 8014886: @Contended fields can overrun oop maps

Vladimir Kozlov vladimir.kozlov at oracle.com
Mon May 20 20:58:12 PDT 2013


Aleksey,

Is not has_nonstatic_fields also wrong?

Rename: max_oop_maps -> max_nonstatic_oop_maps.

For FieldsAllocationStyle=2 (default) we do special oop fields layout 
for super and subclass to have only one oopmap. You need to add non-oop 
fields (class in your test has only oop fields) to test different layouts.

Next added mess to already complicated code:

3188   unsigned int nonstatic_double_count = 
fac->count[NONSTATIC_DOUBLE] - fac_contended.count[NONSTATIC_DOUBLE];
3189   unsigned int nonstatic_word_count   = fac->count[NONSTATIC_WORD] 
   - fac_contended.count[NONSTATIC_WORD];
3190   unsigned int nonstatic_short_count  = fac->count[NONSTATIC_SHORT] 
  - fac_contended.count[NONSTATIC_SHORT];
3191   unsigned int nonstatic_byte_count   = fac->count[NONSTATIC_BYTE] 
   - fac_contended.count[NONSTATIC_BYTE];
3192   unsigned int nonstatic_oop_count    = fac->count[NONSTATIC_OOP] 
   - fac_contended.count[NONSTATIC_OOP];


At least add comment that these counts are for not contended fields.

Vladimir

On 5/20/13 9:11 AM, Aleksey Shipilev wrote:
> Hi again,
>
> This is a simple, but potentially disruptive issue found during the code
> review. We messed up calculating the oop maps with @Contended classes,
> and so we can corrupt something adjacent.
>
> The fix is here:
>    http://cr.openjdk.java.net/~shade/8014886/webrev.01/
>
> The issue is about nonstatic_oop_count counting only non- at Contended
> fields. The fix is pretty straight-forward, although entire *_count
> handling requires more refactoring, which is to be handled elsewhere,
> during the class field layout cleanup.
>
> I also put a few asserts as the range-checks, and those asserts are
> failing when the max_oop_maps are calculated as before.
>
> Testing:
>    - new regression test added, fails on new asserts
>    - Linux x86_64/fastdebug runtime/contended/ tests
>    - full JPRT cycle against hotspot-rt
>
> Please review!
>
> -Aleksey.
>


More information about the hotspot-dev mailing list