src/share/vm/oops/objArrayOop.hpp

changeset 1530
7bfd295ec074
parent 1526
6aa7255741f3
child 1907
c18cbe5936b8
     1.1 --- a/src/share/vm/oops/objArrayOop.hpp	Mon Dec 07 14:22:34 2009 -0500
     1.2 +++ b/src/share/vm/oops/objArrayOop.hpp	Tue Dec 08 15:12:17 2009 -0800
     1.3 @@ -58,7 +58,7 @@
     1.4        old_res = align_size_up(length, OopsPerHeapWord)/OopsPerHeapWord;
     1.5      }
     1.6  #endif  // ASSERT
     1.7 -    int res = (length + OopsPerHeapWord - 1)/OopsPerHeapWord;
     1.8 +    int res = ((uint)length + OopsPerHeapWord - 1)/OopsPerHeapWord;
     1.9      assert(res == old_res, "Inconsistency between old and new.");
    1.10      return res;
    1.11    }
    1.12 @@ -96,7 +96,11 @@
    1.13  
    1.14    static int object_size(int length) {
    1.15      // This returns the object size in HeapWords.
    1.16 -    return align_object_size(header_size() + array_size(length));
    1.17 +    uint asz = array_size(length);
    1.18 +    uint osz = align_object_size(header_size() + asz);
    1.19 +    assert(osz >= asz,   "no overflow");
    1.20 +    assert((int)osz > 0, "no overflow");
    1.21 +    return (int)osz;
    1.22    }
    1.23  
    1.24    // special iterators for index ranges, returns size of object

mercurial