135 // OS ignored requested address. Try different address. |
135 // OS ignored requested address. Try different address. |
136 return; |
136 return; |
137 } |
137 } |
138 // Check alignment constraints. |
138 // Check alignment constraints. |
139 assert((uintptr_t) base % alignment == 0, |
139 assert((uintptr_t) base % alignment == 0, |
140 err_msg("Large pages returned a non-aligned address, base: " |
140 "Large pages returned a non-aligned address, base: " |
141 PTR_FORMAT " alignment: " PTR_FORMAT, |
141 PTR_FORMAT " alignment: " PTR_FORMAT, |
142 base, (void*)(uintptr_t)alignment)); |
142 base, (void*)(uintptr_t)alignment); |
143 _special = true; |
143 _special = true; |
144 } else { |
144 } else { |
145 // failed; try to reserve regular memory below |
145 // failed; try to reserve regular memory below |
146 if (UseLargePages && (!FLAG_IS_DEFAULT(UseLargePages) || |
146 if (UseLargePages && (!FLAG_IS_DEFAULT(UseLargePages) || |
147 !FLAG_IS_DEFAULT(LargePageSizeInBytes))) { |
147 !FLAG_IS_DEFAULT(LargePageSizeInBytes))) { |
332 base = os::reserve_memory_special(size, alignment, requested_address, false); |
332 base = os::reserve_memory_special(size, alignment, requested_address, false); |
333 |
333 |
334 if (base != NULL) { |
334 if (base != NULL) { |
335 // Check alignment constraints. |
335 // Check alignment constraints. |
336 assert((uintptr_t) base % alignment == 0, |
336 assert((uintptr_t) base % alignment == 0, |
337 err_msg("Large pages returned a non-aligned address, base: " |
337 "Large pages returned a non-aligned address, base: " |
338 PTR_FORMAT " alignment: " PTR_FORMAT, |
338 PTR_FORMAT " alignment: " PTR_FORMAT, |
339 base, (void*)(uintptr_t)alignment)); |
339 base, (void*)(uintptr_t)alignment); |
340 _special = true; |
340 _special = true; |
341 } |
341 } |
342 } |
342 } |
343 |
343 |
344 if (base == NULL) { |
344 if (base == NULL) { |
1203 |
1203 |
1204 void TestReservedSpace_test() { |
1204 void TestReservedSpace_test() { |
1205 TestReservedSpace::test_reserved_space(); |
1205 TestReservedSpace::test_reserved_space(); |
1206 } |
1206 } |
1207 |
1207 |
1208 #define assert_equals(actual, expected) \ |
1208 #define assert_equals(actual, expected) \ |
1209 assert(actual == expected, \ |
1209 assert(actual == expected, \ |
1210 err_msg("Got " SIZE_FORMAT " expected " \ |
1210 "Got " SIZE_FORMAT " expected " \ |
1211 SIZE_FORMAT, actual, expected)); |
1211 SIZE_FORMAT, actual, expected); |
1212 |
1212 |
1213 #define assert_ge(value1, value2) \ |
1213 #define assert_ge(value1, value2) \ |
1214 assert(value1 >= value2, \ |
1214 assert(value1 >= value2, \ |
1215 err_msg("'" #value1 "': " SIZE_FORMAT " '" \ |
1215 "'" #value1 "': " SIZE_FORMAT " '" \ |
1216 #value2 "': " SIZE_FORMAT, value1, value2)); |
1216 #value2 "': " SIZE_FORMAT, value1, value2); |
1217 |
1217 |
1218 #define assert_lt(value1, value2) \ |
1218 #define assert_lt(value1, value2) \ |
1219 assert(value1 < value2, \ |
1219 assert(value1 < value2, \ |
1220 err_msg("'" #value1 "': " SIZE_FORMAT " '" \ |
1220 "'" #value1 "': " SIZE_FORMAT " '" \ |
1221 #value2 "': " SIZE_FORMAT, value1, value2)); |
1221 #value2 "': " SIZE_FORMAT, value1, value2); |
1222 |
1222 |
1223 |
1223 |
1224 class TestVirtualSpace : AllStatic { |
1224 class TestVirtualSpace : AllStatic { |
1225 enum TestLargePages { |
1225 enum TestLargePages { |
1226 Default, |
1226 Default, |