src/share/vm/oops/objArrayOop.hpp

Print this page

        

*** 43,72 **** } private: // Give size of objArrayOop in HeapWords minus the header static int array_size(int length) { ! const int OopsPerHeapWord = HeapWordSize/heapOopSize; assert(OopsPerHeapWord >= 1 && (HeapWordSize % heapOopSize == 0), "Else the following (new) computation would be in error"); #ifdef ASSERT // The old code is left in for sanity-checking; it'll // go away pretty soon. XXX // Without UseCompressedOops, this is simply: // oop->length() * HeapWordsPerOop; // With narrowOops, HeapWordsPerOop is 1/2 or equal 0 as an integer. // The oop elements are aligned up to wordSize ! const int HeapWordsPerOop = heapOopSize/HeapWordSize; ! int old_res; if (HeapWordsPerOop > 0) { old_res = length * HeapWordsPerOop; } else { ! old_res = align_size_up(length, OopsPerHeapWord)/OopsPerHeapWord; } - #endif // ASSERT - int res = ((uint)length + OopsPerHeapWord - 1)/OopsPerHeapWord; assert(res == old_res, "Inconsistency between old and new."); return res; } public: // Returns the offset of the first element. --- 43,72 ---- } private: // Give size of objArrayOop in HeapWords minus the header static int array_size(int length) { ! const uint OopsPerHeapWord = HeapWordSize/heapOopSize; assert(OopsPerHeapWord >= 1 && (HeapWordSize % heapOopSize == 0), "Else the following (new) computation would be in error"); + uint res = ((uint)length + OopsPerHeapWord - 1)/OopsPerHeapWord; #ifdef ASSERT // The old code is left in for sanity-checking; it'll // go away pretty soon. XXX // Without UseCompressedOops, this is simply: // oop->length() * HeapWordsPerOop; // With narrowOops, HeapWordsPerOop is 1/2 or equal 0 as an integer. // The oop elements are aligned up to wordSize ! const uint HeapWordsPerOop = heapOopSize/HeapWordSize; ! uint old_res; if (HeapWordsPerOop > 0) { old_res = length * HeapWordsPerOop; } else { ! old_res = align_size_up((uint)length, OopsPerHeapWord)/OopsPerHeapWord; } assert(res == old_res, "Inconsistency between old and new."); + #endif // ASSERT return res; } public: // Returns the offset of the first element.