src/share/vm/oops/objArrayOop.hpp

changeset 7292
f31986da9319
parent 4153
b9a9ed0f8eeb
child 7535
7ae4e26cb1e0
     1.1 --- a/src/share/vm/oops/objArrayOop.hpp	Fri Oct 24 21:25:40 2014 +0000
     1.2 +++ b/src/share/vm/oops/objArrayOop.hpp	Wed Aug 13 13:00:53 2014 -0700
     1.3 @@ -45,9 +45,10 @@
     1.4  private:
     1.5    // Give size of objArrayOop in HeapWords minus the header
     1.6    static int array_size(int length) {
     1.7 -    const int OopsPerHeapWord = HeapWordSize/heapOopSize;
     1.8 +    const uint OopsPerHeapWord = HeapWordSize/heapOopSize;
     1.9      assert(OopsPerHeapWord >= 1 && (HeapWordSize % heapOopSize == 0),
    1.10             "Else the following (new) computation would be in error");
    1.11 +    uint res = ((uint)length + OopsPerHeapWord - 1)/OopsPerHeapWord;
    1.12  #ifdef ASSERT
    1.13      // The old code is left in for sanity-checking; it'll
    1.14      // go away pretty soon. XXX
    1.15 @@ -55,16 +56,15 @@
    1.16      // oop->length() * HeapWordsPerOop;
    1.17      // With narrowOops, HeapWordsPerOop is 1/2 or equal 0 as an integer.
    1.18      // The oop elements are aligned up to wordSize
    1.19 -    const int HeapWordsPerOop = heapOopSize/HeapWordSize;
    1.20 -    int old_res;
    1.21 +    const uint HeapWordsPerOop = heapOopSize/HeapWordSize;
    1.22 +    uint old_res;
    1.23      if (HeapWordsPerOop > 0) {
    1.24        old_res = length * HeapWordsPerOop;
    1.25      } else {
    1.26 -      old_res = align_size_up(length, OopsPerHeapWord)/OopsPerHeapWord;
    1.27 +      old_res = align_size_up((uint)length, OopsPerHeapWord)/OopsPerHeapWord;
    1.28      }
    1.29 +    assert(res == old_res, "Inconsistency between old and new.");
    1.30  #endif  // ASSERT
    1.31 -    int res = ((uint)length + OopsPerHeapWord - 1)/OopsPerHeapWord;
    1.32 -    assert(res == old_res, "Inconsistency between old and new.");
    1.33      return res;
    1.34    }
    1.35  

mercurial