comparison src/share/vm/runtime/arguments.cpp @ 1829:fe08403130db

6979458: VM crashes when -XX:ObjectAlignmentInBytes is too big Summary: Set upper limit 256 for ObjectAlignmentInBytes value. Reviewed-by: never, iveresov
author kvn
date Tue, 05 Oct 2010 08:57:20 -0700
parents 18c378513575
children 22e4420d19f7
comparison
equal deleted inserted replaced
1828:3f9a70eb8b1f 1829:fe08403130db
1259 1259
1260 bool verify_object_alignment() { 1260 bool verify_object_alignment() {
1261 // Object alignment. 1261 // Object alignment.
1262 if (!is_power_of_2(ObjectAlignmentInBytes)) { 1262 if (!is_power_of_2(ObjectAlignmentInBytes)) {
1263 jio_fprintf(defaultStream::error_stream(), 1263 jio_fprintf(defaultStream::error_stream(),
1264 "error: ObjectAlignmentInBytes=%d must be power of 2", (int)ObjectAlignmentInBytes); 1264 "error: ObjectAlignmentInBytes=%d must be power of 2\n",
1265 (int)ObjectAlignmentInBytes);
1265 return false; 1266 return false;
1266 } 1267 }
1267 if ((int)ObjectAlignmentInBytes < BytesPerLong) { 1268 if ((int)ObjectAlignmentInBytes < BytesPerLong) {
1268 jio_fprintf(defaultStream::error_stream(), 1269 jio_fprintf(defaultStream::error_stream(),
1269 "error: ObjectAlignmentInBytes=%d must be greater or equal %d", (int)ObjectAlignmentInBytes, BytesPerLong); 1270 "error: ObjectAlignmentInBytes=%d must be greater or equal %d\n",
1271 (int)ObjectAlignmentInBytes, BytesPerLong);
1272 return false;
1273 }
1274 // It does not make sense to have big object alignment
1275 // since a space lost due to alignment will be greater
1276 // then a saved space from compressed oops.
1277 if ((int)ObjectAlignmentInBytes > 256) {
1278 jio_fprintf(defaultStream::error_stream(),
1279 "error: ObjectAlignmentInBytes=%d must not be greater then 256\n",
1280 (int)ObjectAlignmentInBytes);
1281 return false;
1282 }
1283 // In case page size is very small.
1284 if ((int)ObjectAlignmentInBytes >= os::vm_page_size()) {
1285 jio_fprintf(defaultStream::error_stream(),
1286 "error: ObjectAlignmentInBytes=%d must be less then page size %d\n",
1287 (int)ObjectAlignmentInBytes, os::vm_page_size());
1270 return false; 1288 return false;
1271 } 1289 }
1272 return true; 1290 return true;
1273 } 1291 }
1274 1292