comparison src/share/vm/oops/objArrayOop.hpp @ 20578:f31986da9319

8054530: C2: assert(res == old_res) failed: Inconsistency between old and new Summary: Fixed signedness problem with assertion. Reviewed-by: kvn
author morris
date Wed, 13 Aug 2014 13:00:53 -0700
parents b9a9ed0f8eeb
children
comparison
equal deleted inserted replaced
20577:5a0b89f8d29a 20578:f31986da9319
43 } 43 }
44 44
45 private: 45 private:
46 // Give size of objArrayOop in HeapWords minus the header 46 // Give size of objArrayOop in HeapWords minus the header
47 static int array_size(int length) { 47 static int array_size(int length) {
48 const int OopsPerHeapWord = HeapWordSize/heapOopSize; 48 const uint OopsPerHeapWord = HeapWordSize/heapOopSize;
49 assert(OopsPerHeapWord >= 1 && (HeapWordSize % heapOopSize == 0), 49 assert(OopsPerHeapWord >= 1 && (HeapWordSize % heapOopSize == 0),
50 "Else the following (new) computation would be in error"); 50 "Else the following (new) computation would be in error");
51 uint res = ((uint)length + OopsPerHeapWord - 1)/OopsPerHeapWord;
51 #ifdef ASSERT 52 #ifdef ASSERT
52 // The old code is left in for sanity-checking; it'll 53 // The old code is left in for sanity-checking; it'll
53 // go away pretty soon. XXX 54 // go away pretty soon. XXX
54 // Without UseCompressedOops, this is simply: 55 // Without UseCompressedOops, this is simply:
55 // oop->length() * HeapWordsPerOop; 56 // oop->length() * HeapWordsPerOop;
56 // With narrowOops, HeapWordsPerOop is 1/2 or equal 0 as an integer. 57 // With narrowOops, HeapWordsPerOop is 1/2 or equal 0 as an integer.
57 // The oop elements are aligned up to wordSize 58 // The oop elements are aligned up to wordSize
58 const int HeapWordsPerOop = heapOopSize/HeapWordSize; 59 const uint HeapWordsPerOop = heapOopSize/HeapWordSize;
59 int old_res; 60 uint old_res;
60 if (HeapWordsPerOop > 0) { 61 if (HeapWordsPerOop > 0) {
61 old_res = length * HeapWordsPerOop; 62 old_res = length * HeapWordsPerOop;
62 } else { 63 } else {
63 old_res = align_size_up(length, OopsPerHeapWord)/OopsPerHeapWord; 64 old_res = align_size_up((uint)length, OopsPerHeapWord)/OopsPerHeapWord;
64 } 65 }
66 assert(res == old_res, "Inconsistency between old and new.");
65 #endif // ASSERT 67 #endif // ASSERT
66 int res = ((uint)length + OopsPerHeapWord - 1)/OopsPerHeapWord;
67 assert(res == old_res, "Inconsistency between old and new.");
68 return res; 68 return res;
69 } 69 }
70 70
71 public: 71 public:
72 // Returns the offset of the first element. 72 // Returns the offset of the first element.