src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp

changeset 6493
3205e78d8193
parent 5369
71180a6e5080
child 6513
bbfbe9b06038
     1.1 --- a/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp	Thu Dec 05 15:13:12 2013 -0800
     1.2 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp	Mon Dec 02 10:26:14 2013 +0100
     1.3 @@ -997,6 +997,13 @@
     1.4      if (FreeChunk::indicatesFreeChunk(p)) {
     1.5        volatile FreeChunk* fc = (volatile FreeChunk*)p;
     1.6        size_t res = fc->size();
     1.7 +
     1.8 +      // Bugfix for systems with weak memory model (PPC64/IA64). The
     1.9 +      // block's free bit was set and we have read the size of the
    1.10 +      // block. Acquire and check the free bit again. If the block is
    1.11 +      // still free, the read size is correct.
    1.12 +      OrderAccess::acquire();
    1.13 +
    1.14        // If the object is still a free chunk, return the size, else it
    1.15        // has been allocated so try again.
    1.16        if (FreeChunk::indicatesFreeChunk(p)) {
    1.17 @@ -1010,6 +1017,12 @@
    1.18          assert(k->is_klass(), "Should really be klass oop.");
    1.19          oop o = (oop)p;
    1.20          assert(o->is_oop(true /* ignore mark word */), "Should be an oop.");
    1.21 +
    1.22 +        // Bugfix for systems with weak memory model (PPC64/IA64).
    1.23 +        // The object o may be an array. Acquire to make sure that the array
    1.24 +        // size (third word) is consistent.
    1.25 +        OrderAccess::acquire();
    1.26 +
    1.27          size_t res = o->size_given_klass(k);
    1.28          res = adjustObjectSize(res);
    1.29          assert(res != 0, "Block size should not be 0");
    1.30 @@ -1040,6 +1053,13 @@
    1.31      if (FreeChunk::indicatesFreeChunk(p)) {
    1.32        volatile FreeChunk* fc = (volatile FreeChunk*)p;
    1.33        size_t res = fc->size();
    1.34 +
    1.35 +      // Bugfix for systems with weak memory model (PPC64/IA64). The
    1.36 +      // free bit of the block was set and we have read the size of
    1.37 +      // the block. Acquire and check the free bit again. If the
    1.38 +      // block is still free, the read size is correct.
    1.39 +      OrderAccess::acquire();
    1.40 +
    1.41        if (FreeChunk::indicatesFreeChunk(p)) {
    1.42          assert(res != 0, "Block size should not be 0");
    1.43          assert(loops == 0, "Should be 0");
    1.44 @@ -1055,6 +1075,12 @@
    1.45          assert(k->is_klass(), "Should really be klass oop.");
    1.46          oop o = (oop)p;
    1.47          assert(o->is_oop(), "Should be an oop");
    1.48 +
    1.49 +        // Bugfix for systems with weak memory model (PPC64/IA64).
    1.50 +        // The object o may be an array. Acquire to make sure that the array
    1.51 +        // size (third word) is consistent.
    1.52 +        OrderAccess::acquire();
    1.53 +
    1.54          size_t res = o->size_given_klass(k);
    1.55          res = adjustObjectSize(res);
    1.56          assert(res != 0, "Block size should not be 0");

mercurial