< prev index next >

src/share/vm/prims/whitebox.cpp

Print this page
rev 7462 : 8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.


 147 
 148 #ifndef PRODUCT
 149 // Forward declaration
 150 void TestReservedSpace_test();
 151 void TestReserveMemorySpecial_test();
 152 void TestVirtualSpace_test();
 153 void TestMetaspaceAux_test();
 154 #endif
 155 
 156 WB_ENTRY(void, WB_RunMemoryUnitTests(JNIEnv* env, jobject o))
 157 #ifndef PRODUCT
 158   TestReservedSpace_test();
 159   TestReserveMemorySpecial_test();
 160   TestVirtualSpace_test();
 161   TestMetaspaceAux_test();
 162 #endif
 163 WB_END
 164 
 165 WB_ENTRY(void, WB_ReadFromNoaccessArea(JNIEnv* env, jobject o))
 166   size_t granularity = os::vm_allocation_granularity();
 167   ReservedHeapSpace rhs(100 * granularity, granularity, false, NULL);
 168   VirtualSpace vs;
 169   vs.initialize(rhs, 50 * granularity);
 170 
 171   //Check if constraints are complied
 172   if (!( UseCompressedOops && rhs.base() != NULL &&
 173          Universe::narrow_oop_base() != NULL &&
 174          Universe::narrow_oop_use_implicit_null_checks() )) {
 175     tty->print_cr("WB_ReadFromNoaccessArea method is useless:\n "
 176                   "\tUseCompressedOops is %d\n"
 177                   "\trhs.base() is "PTR_FORMAT"\n"
 178                   "\tUniverse::narrow_oop_base() is "PTR_FORMAT"\n"
 179                   "\tUniverse::narrow_oop_use_implicit_null_checks() is %d",
 180                   UseCompressedOops,
 181                   rhs.base(),
 182                   Universe::narrow_oop_base(),
 183                   Universe::narrow_oop_use_implicit_null_checks());
 184     return;
 185   }
 186   tty->print_cr("Reading from no access area... ");
 187   tty->print_cr("*(vs.low_boundary() - rhs.noaccess_prefix() / 2 ) = %c",
 188                 *(vs.low_boundary() - rhs.noaccess_prefix() / 2 ));
 189 WB_END
 190 
 191 static jint wb_stress_virtual_space_resize(size_t reserved_space_size,
 192                                            size_t magnitude, size_t iterations) {
 193   size_t granularity = os::vm_allocation_granularity();
 194   ReservedHeapSpace rhs(reserved_space_size * granularity, granularity, false, NULL);
 195   VirtualSpace vs;
 196   if (!vs.initialize(rhs, 0)) {
 197     tty->print_cr("Failed to initialize VirtualSpace. Can't proceed.");
 198     return 3;
 199   }
 200 
 201   long seed = os::random();
 202   tty->print_cr("Random seed is %ld", seed);
 203   os::init_random(seed);
 204 
 205   for (size_t i = 0; i < iterations; i++) {
 206 
 207     // Whether we will shrink or grow
 208     bool shrink = os::random() % 2L == 0;
 209 
 210     // Get random delta to resize virtual space
 211     size_t delta = (size_t)os::random() % magnitude;
 212 
 213     // If we are about to shrink virtual space below zero, then expand instead
 214     if (shrink && vs.committed_size() < delta) {




 147 
 148 #ifndef PRODUCT
 149 // Forward declaration
 150 void TestReservedSpace_test();
 151 void TestReserveMemorySpecial_test();
 152 void TestVirtualSpace_test();
 153 void TestMetaspaceAux_test();
 154 #endif
 155 
 156 WB_ENTRY(void, WB_RunMemoryUnitTests(JNIEnv* env, jobject o))
 157 #ifndef PRODUCT
 158   TestReservedSpace_test();
 159   TestReserveMemorySpecial_test();
 160   TestVirtualSpace_test();
 161   TestMetaspaceAux_test();
 162 #endif
 163 WB_END
 164 
 165 WB_ENTRY(void, WB_ReadFromNoaccessArea(JNIEnv* env, jobject o))
 166   size_t granularity = os::vm_allocation_granularity();
 167   ReservedHeapSpace rhs(100 * granularity, granularity, false);
 168   VirtualSpace vs;
 169   vs.initialize(rhs, 50 * granularity);
 170 
 171   // Check if constraints are complied
 172   if (!( UseCompressedOops && rhs.base() != NULL &&
 173          Universe::narrow_oop_base() != NULL &&
 174          Universe::narrow_oop_use_implicit_null_checks() )) {
 175     tty->print_cr("WB_ReadFromNoaccessArea method is useless:\n "
 176                   "\tUseCompressedOops is %d\n"
 177                   "\trhs.base() is "PTR_FORMAT"\n"
 178                   "\tUniverse::narrow_oop_base() is "PTR_FORMAT"\n"
 179                   "\tUniverse::narrow_oop_use_implicit_null_checks() is %d",
 180                   UseCompressedOops,
 181                   rhs.base(),
 182                   Universe::narrow_oop_base(),
 183                   Universe::narrow_oop_use_implicit_null_checks());
 184     return;
 185   }
 186   tty->print_cr("Reading from no access area... ");
 187   tty->print_cr("*(vs.low_boundary() - rhs.noaccess_prefix() / 2 ) = %c",
 188                 *(vs.low_boundary() - rhs.noaccess_prefix() / 2 ));
 189 WB_END
 190 
 191 static jint wb_stress_virtual_space_resize(size_t reserved_space_size,
 192                                            size_t magnitude, size_t iterations) {
 193   size_t granularity = os::vm_allocation_granularity();
 194   ReservedHeapSpace rhs(reserved_space_size * granularity, granularity, false);
 195   VirtualSpace vs;
 196   if (!vs.initialize(rhs, 0)) {
 197     tty->print_cr("Failed to initialize VirtualSpace. Can't proceed.");
 198     return 3;
 199   }
 200 
 201   long seed = os::random();
 202   tty->print_cr("Random seed is %ld", seed);
 203   os::init_random(seed);
 204 
 205   for (size_t i = 0; i < iterations; i++) {
 206 
 207     // Whether we will shrink or grow
 208     bool shrink = os::random() % 2L == 0;
 209 
 210     // Get random delta to resize virtual space
 211     size_t delta = (size_t)os::random() % magnitude;
 212 
 213     // If we are about to shrink virtual space below zero, then expand instead
 214     if (shrink && vs.committed_size() < delta) {


< prev index next >