Mercurial > hg > truffle
comparison src/share/vm/utilities/globalDefinitions.cpp @ 9062:8be1318fbe77
Merge
author | dcubed |
---|---|
date | Fri, 05 Apr 2013 10:38:08 -0700 |
parents | cc32ccaaf47f |
children | de6a9e811145 |
comparison
equal
deleted
inserted
replaced
9055:dcdeb150988c | 9062:8be1318fbe77 |
---|---|
353 julong result = julong(a) * b / div; | 353 julong result = julong(a) * b / div; |
354 assert(result <= (size_t)max_uintx, "Integer overflow in lcm"); | 354 assert(result <= (size_t)max_uintx, "Integer overflow in lcm"); |
355 | 355 |
356 return size_t(result); | 356 return size_t(result); |
357 } | 357 } |
358 | |
359 #ifndef PRODUCT | |
360 | |
361 void GlobalDefinitions::test_globals() { | |
362 intptr_t page_sizes[] = { os::vm_page_size(), 4096, 8192, 65536, 2*1024*1024 }; | |
363 const int num_page_sizes = sizeof(page_sizes) / sizeof(page_sizes[0]); | |
364 | |
365 for (int i = 0; i < num_page_sizes; i++) { | |
366 intptr_t page_size = page_sizes[i]; | |
367 | |
368 address a_page = (address)(10*page_size); | |
369 | |
370 // Check that address within page is returned as is | |
371 assert(clamp_address_in_page(a_page, a_page, page_size) == a_page, "incorrect"); | |
372 assert(clamp_address_in_page(a_page + 128, a_page, page_size) == a_page + 128, "incorrect"); | |
373 assert(clamp_address_in_page(a_page + page_size - 1, a_page, page_size) == a_page + page_size - 1, "incorrect"); | |
374 | |
375 // Check that address above page returns start of next page | |
376 assert(clamp_address_in_page(a_page + page_size, a_page, page_size) == a_page + page_size, "incorrect"); | |
377 assert(clamp_address_in_page(a_page + page_size + 1, a_page, page_size) == a_page + page_size, "incorrect"); | |
378 assert(clamp_address_in_page(a_page + page_size*5 + 1, a_page, page_size) == a_page + page_size, "incorrect"); | |
379 | |
380 // Check that address below page returns start of page | |
381 assert(clamp_address_in_page(a_page - 1, a_page, page_size) == a_page, "incorrect"); | |
382 assert(clamp_address_in_page(a_page - 2*page_size - 1, a_page, page_size) == a_page, "incorrect"); | |
383 assert(clamp_address_in_page(a_page - 5*page_size - 1, a_page, page_size) == a_page, "incorrect"); | |
384 } | |
385 } | |
386 | |
387 #endif // PRODUCT |