comparison src/share/vm/oops/objArrayOop.hpp @ 7745:6dc8db7164d2

Added tag jdk9-b49 for changeset 360cd1fc42f1
author katleman
date Thu, 05 Feb 2015 11:43:29 -0800
parents b188e2fd26d7
children 6a5be7f00868
comparison
equal deleted inserted replaced
14:6f61366df0e8 15:aa6f80f8e1ef
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.