< prev index next >

test/hotspot/gtest/oops/test_arrayOop.cpp

Print this page

 65 
 66 TEST_VM(arrayOopDesc, long) {
 67   ASSERT_PRED1(check_max_length_overflow, T_LONG);
 68 }
 69 
 70 TEST_VM(arrayOopDesc, object) {
 71   ASSERT_PRED1(check_max_length_overflow, T_OBJECT);
 72 }
 73 
 74 TEST_VM(arrayOopDesc, array) {
 75   ASSERT_PRED1(check_max_length_overflow, T_ARRAY);
 76 }
 77 
 78 TEST_VM(arrayOopDesc, narrowOop) {
 79   ASSERT_PRED1(check_max_length_overflow, T_NARROWOOP);
 80 }
 81 // T_VOID and T_ADDRESS are not supported by max_array_length()
 82 
 83 TEST_VM(arrayOopDesc, base_offset) {
 84 #ifdef _LP64
 85   if (UseCompressedClassPointers) {
















 86     EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_BOOLEAN), 16);
 87     EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_BYTE),    16);
 88     EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_SHORT),   16);
 89     EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_CHAR),    16);
 90     EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_INT),     16);
 91     EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_FLOAT),   16);
 92     EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_LONG),    16);
 93     EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_DOUBLE),  16);
 94     EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_OBJECT),  16);
 95     EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_ARRAY),   16);
 96   } else {
 97     EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_BOOLEAN), 20);
 98     EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_BYTE),    20);
 99     EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_SHORT),   20);
100     EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_CHAR),    20);
101     EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_INT),     20);
102     EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_FLOAT),   20);
103     EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_LONG),    24);
104     EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_DOUBLE),  24);
105     if (UseCompressedOops) {

 65 
 66 TEST_VM(arrayOopDesc, long) {
 67   ASSERT_PRED1(check_max_length_overflow, T_LONG);
 68 }
 69 
 70 TEST_VM(arrayOopDesc, object) {
 71   ASSERT_PRED1(check_max_length_overflow, T_OBJECT);
 72 }
 73 
 74 TEST_VM(arrayOopDesc, array) {
 75   ASSERT_PRED1(check_max_length_overflow, T_ARRAY);
 76 }
 77 
 78 TEST_VM(arrayOopDesc, narrowOop) {
 79   ASSERT_PRED1(check_max_length_overflow, T_NARROWOOP);
 80 }
 81 // T_VOID and T_ADDRESS are not supported by max_array_length()
 82 
 83 TEST_VM(arrayOopDesc, base_offset) {
 84 #ifdef _LP64
 85   if (UseCompactObjectHeaders) {
 86     EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_BOOLEAN), 12);
 87     EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_BYTE),    12);
 88     EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_SHORT),   12);
 89     EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_CHAR),    12);
 90     EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_INT),     12);
 91     EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_FLOAT),   12);
 92     EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_LONG),    16);
 93     EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_DOUBLE),  16);
 94     if (UseCompressedOops) {
 95       EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_OBJECT), 12);
 96       EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_ARRAY),  12);
 97     } else {
 98       EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_OBJECT), 16);
 99       EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_ARRAY),  16);
100     }
101   } else if (UseCompressedClassPointers) {
102     EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_BOOLEAN), 16);
103     EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_BYTE),    16);
104     EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_SHORT),   16);
105     EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_CHAR),    16);
106     EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_INT),     16);
107     EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_FLOAT),   16);
108     EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_LONG),    16);
109     EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_DOUBLE),  16);
110     EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_OBJECT),  16);
111     EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_ARRAY),   16);
112   } else {
113     EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_BOOLEAN), 20);
114     EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_BYTE),    20);
115     EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_SHORT),   20);
116     EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_CHAR),    20);
117     EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_INT),     20);
118     EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_FLOAT),   20);
119     EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_LONG),    24);
120     EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_DOUBLE),  24);
121     if (UseCompressedOops) {
< prev index next >