< prev index next >

src/hotspot/share/memory/virtualspace.cpp

Print this page
rev 52333 : imported patch 8213058


1044 void VirtualSpace::print_on(outputStream* out) {
1045   out->print   ("Virtual space:");
1046   if (special()) out->print(" (pinned in memory)");
1047   out->cr();
1048   out->print_cr(" - committed: " SIZE_FORMAT, committed_size());
1049   out->print_cr(" - reserved:  " SIZE_FORMAT, reserved_size());
1050   out->print_cr(" - [low, high]:     [" INTPTR_FORMAT ", " INTPTR_FORMAT "]",  p2i(low()), p2i(high()));
1051   out->print_cr(" - [low_b, high_b]: [" INTPTR_FORMAT ", " INTPTR_FORMAT "]",  p2i(low_boundary()), p2i(high_boundary()));
1052 }
1053 
1054 void VirtualSpace::print() {
1055   print_on(tty);
1056 }
1057 
1058 /////////////// Unit tests ///////////////
1059 
1060 #ifndef PRODUCT
1061 
1062 #define test_log(...) \
1063   do {\
1064     if (VerboseInternalVMTests) { \
1065       tty->print_cr(__VA_ARGS__); \
1066       tty->flush(); \
1067     }\
1068   } while (false)
1069 
1070 class TestReservedSpace : AllStatic {
1071  public:
1072   static void small_page_write(void* addr, size_t size) {
1073     size_t page_size = os::vm_page_size();
1074 
1075     char* end = (char*)addr + size;
1076     for (char* p = (char*)addr; p < end; p += page_size) {
1077       *p = 1;
1078     }
1079   }
1080 
1081   static void release_memory_for_test(ReservedSpace rs) {
1082     if (rs.special()) {
1083       guarantee(os::release_memory_special(rs.base(), rs.size()), "Shouldn't fail");
1084     } else {
1085       guarantee(os::release_memory(rs.base(), rs.size()), "Shouldn't fail");
1086     }
1087   }




1044 void VirtualSpace::print_on(outputStream* out) {
1045   out->print   ("Virtual space:");
1046   if (special()) out->print(" (pinned in memory)");
1047   out->cr();
1048   out->print_cr(" - committed: " SIZE_FORMAT, committed_size());
1049   out->print_cr(" - reserved:  " SIZE_FORMAT, reserved_size());
1050   out->print_cr(" - [low, high]:     [" INTPTR_FORMAT ", " INTPTR_FORMAT "]",  p2i(low()), p2i(high()));
1051   out->print_cr(" - [low_b, high_b]: [" INTPTR_FORMAT ", " INTPTR_FORMAT "]",  p2i(low_boundary()), p2i(high_boundary()));
1052 }
1053 
1054 void VirtualSpace::print() {
1055   print_on(tty);
1056 }
1057 
1058 /////////////// Unit tests ///////////////
1059 
1060 #ifndef PRODUCT
1061 
1062 #define test_log(...) \
1063   do {\




1064   } while (false)
1065 
1066 class TestReservedSpace : AllStatic {
1067  public:
1068   static void small_page_write(void* addr, size_t size) {
1069     size_t page_size = os::vm_page_size();
1070 
1071     char* end = (char*)addr + size;
1072     for (char* p = (char*)addr; p < end; p += page_size) {
1073       *p = 1;
1074     }
1075   }
1076 
1077   static void release_memory_for_test(ReservedSpace rs) {
1078     if (rs.special()) {
1079       guarantee(os::release_memory_special(rs.base(), rs.size()), "Shouldn't fail");
1080     } else {
1081       guarantee(os::release_memory(rs.base(), rs.size()), "Shouldn't fail");
1082     }
1083   }


< prev index next >