6644928: Internal Error (src/share/vm/code/relocInfo.hpp:1089)

Fri, 11 Apr 2008 06:18:44 -0700

author
sgoldman
date
Fri, 11 Apr 2008 06:18:44 -0700
changeset 552
deadee49286e
parent 544
9f4457a14b58
child 553
fb75a7673531

6644928: Internal Error (src/share/vm/code/relocInfo.hpp:1089)
Summary: Cardtable base can be zero, ExternalAddress can't take a NULL.

src/cpu/x86/vm/assembler_x86_32.cpp file | annotate | diff | comparison | revisions
src/cpu/x86/vm/assembler_x86_64.cpp file | annotate | diff | comparison | revisions
     1.1 --- a/src/cpu/x86/vm/assembler_x86_32.cpp	Wed Apr 09 15:10:22 2008 -0700
     1.2 +++ b/src/cpu/x86/vm/assembler_x86_32.cpp	Fri Apr 11 06:18:44 2008 -0700
     1.3 @@ -3405,10 +3405,16 @@
     1.4    assert(bs->kind() == BarrierSet::CardTableModRef, "Wrong barrier set kind");
     1.5    CardTableModRefBS* ct = (CardTableModRefBS*)bs;
     1.6    assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code");
     1.7 -  ExternalAddress cardtable((address)ct->byte_map_base);
     1.8 -  Address index(noreg, obj, Address::times_1);
     1.9 -
    1.10 -  movb(as_Address(ArrayAddress(cardtable, index)), 0);
    1.11 +
    1.12 +  // The calculation for byte_map_base is as follows:
    1.13 +  // byte_map_base = _byte_map - (uintptr_t(low_bound) >> card_shift);
    1.14 +  // So this essentially converts an address to a displacement and
    1.15 +  // it will never need to be relocated. On 64bit however the value may be too
    1.16 +  // large for a 32bit displacement
    1.17 +
    1.18 +  intptr_t disp = (intptr_t) ct->byte_map_base;
    1.19 +  Address cardtable(noreg, obj, Address::times_1, disp);
    1.20 +  movb(cardtable, 0);
    1.21  }
    1.22  
    1.23  
     2.1 --- a/src/cpu/x86/vm/assembler_x86_64.cpp	Wed Apr 09 15:10:22 2008 -0700
     2.2 +++ b/src/cpu/x86/vm/assembler_x86_64.cpp	Fri Apr 11 06:18:44 2008 -0700
     2.3 @@ -4427,9 +4427,32 @@
     2.4    assert(bs->kind() == BarrierSet::CardTableModRef, "Wrong barrier set kind");
     2.5    CardTableModRefBS* ct = (CardTableModRefBS*)bs;
     2.6    assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code");
     2.7 -  ExternalAddress cardtable((address)ct->byte_map_base);
     2.8 -  Address index(noreg, obj, Address::times_1);
     2.9 -  movb(as_Address(ArrayAddress(cardtable, index)), 0);
    2.10 +
    2.11 +  // The calculation for byte_map_base is as follows:
    2.12 +  // byte_map_base = _byte_map - (uintptr_t(low_bound) >> card_shift);
    2.13 +  // So this essentially converts an address to a displacement and
    2.14 +  // it will never need to be relocated. On 64bit however the value may be too
    2.15 +  // large for a 32bit displacement
    2.16 +
    2.17 +  intptr_t disp = (intptr_t) ct->byte_map_base;
    2.18 +  if (is_simm32(disp)) {
    2.19 +    Address cardtable(noreg, obj, Address::times_1, disp);
    2.20 +    movb(cardtable, 0);
    2.21 +  } else {
    2.22 +    // By doing it as an ExternalAddress disp could be converted to a rip-relative
    2.23 +    // displacement and done in a single instruction given favorable mapping and
    2.24 +    // a smarter version of as_Address. Worst case it is two instructions which
    2.25 +    // is no worse off then loading disp into a register and doing as a simple
    2.26 +    // Address() as above.
    2.27 +    // We can't do as ExternalAddress as the only style since if disp == 0 we'll
    2.28 +    // assert since NULL isn't acceptable in a reloci (see 6644928). In any case
    2.29 +    // in some cases we'll get a single instruction version.
    2.30 +
    2.31 +    ExternalAddress cardtable((address)disp);
    2.32 +    Address index(noreg, obj, Address::times_1);
    2.33 +    movb(as_Address(ArrayAddress(cardtable, index)), 0);
    2.34 +  }
    2.35 +
    2.36  }
    2.37  
    2.38  void MacroAssembler::c2bool(Register x) {

mercurial