< prev index next >

src/share/vm/prims/whitebox.cpp

Print this page
rev 7989 : 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
Summary: Allow partial use of large pages for auxiliary data structures in G1.
Reviewed-by: jmasa


  72 class VM_WhiteBoxOperation : public VM_Operation {
  73  public:
  74   VM_WhiteBoxOperation()                         { }
  75   VMOp_Type type()                  const        { return VMOp_WhiteBoxOperation; }
  76   bool allow_nested_vm_operations() const        { return true; }
  77 };
  78 
  79 
  80 WB_ENTRY(jlong, WB_GetObjectAddress(JNIEnv* env, jobject o, jobject obj))
  81   return (jlong)(void*)JNIHandles::resolve(obj);
  82 WB_END
  83 
  84 WB_ENTRY(jint, WB_GetHeapOopSize(JNIEnv* env, jobject o))
  85   return heapOopSize;
  86 WB_END
  87 
  88 WB_ENTRY(jint, WB_GetVMPageSize(JNIEnv* env, jobject o))
  89   return os::vm_page_size();
  90 WB_END
  91 




  92 class WBIsKlassAliveClosure : public KlassClosure {
  93     Symbol* _name;
  94     bool _found;
  95 public:
  96     WBIsKlassAliveClosure(Symbol* name) : _name(name), _found(false) {}
  97 
  98     void do_klass(Klass* k) {
  99       if (_found) return;
 100       Symbol* ksym = k->name();
 101       if (ksym->fast_compare(_name) == 0) {
 102         _found = true;
 103       }
 104     }
 105 
 106     bool found() const {
 107         return _found;
 108     }
 109 };
 110 
 111 WB_ENTRY(jboolean, WB_IsClassAlive(JNIEnv* env, jobject target, jstring name))


1288         }
1289       } else {
1290         // Registration failed unexpectedly.
1291         tty->print_cr("Warning: unexpected error on register of sun.hotspot.WhiteBox::%s%s. All methods will be unregistered",
1292             method_array[i].name, method_array[i].signature);
1293         env->UnregisterNatives(wbclass);
1294         break;
1295       }
1296     }
1297   }
1298 }
1299 
1300 #define CC (char*)
1301 
1302 static JNINativeMethod methods[] = {
1303   {CC"getObjectAddress",   CC"(Ljava/lang/Object;)J", (void*)&WB_GetObjectAddress  },
1304   {CC"getObjectSize",      CC"(Ljava/lang/Object;)J", (void*)&WB_GetObjectSize     },
1305   {CC"isObjectInOldGen",   CC"(Ljava/lang/Object;)Z", (void*)&WB_isObjectInOldGen  },
1306   {CC"getHeapOopSize",     CC"()I",                   (void*)&WB_GetHeapOopSize    },
1307   {CC"getVMPageSize",      CC"()I",                   (void*)&WB_GetVMPageSize     },

1308   {CC"isClassAlive0",      CC"(Ljava/lang/String;)Z", (void*)&WB_IsClassAlive      },
1309   {CC"parseCommandLine",
1310       CC"(Ljava/lang/String;C[Lsun/hotspot/parser/DiagnosticCommand;)[Ljava/lang/Object;",
1311       (void*) &WB_ParseCommandLine
1312   },
1313   {CC"addToBootstrapClassLoaderSearch", CC"(Ljava/lang/String;)V",
1314                                                       (void*)&WB_AddToBootstrapClassLoaderSearch},
1315   {CC"addToSystemClassLoaderSearch",    CC"(Ljava/lang/String;)V",
1316                                                       (void*)&WB_AddToSystemClassLoaderSearch},
1317   {CC"getCompressedOopsMaxHeapSize", CC"()J",
1318       (void*)&WB_GetCompressedOopsMaxHeapSize},
1319   {CC"printHeapSizes",     CC"()V",                   (void*)&WB_PrintHeapSizes    },
1320   {CC"runMemoryUnitTests", CC"()V",                   (void*)&WB_RunMemoryUnitTests},
1321   {CC"readFromNoaccessArea",CC"()V",                  (void*)&WB_ReadFromNoaccessArea},
1322   {CC"stressVirtualSpaceResize",CC"(JJJ)I",           (void*)&WB_StressVirtualSpaceResize},
1323 #if INCLUDE_ALL_GCS
1324   {CC"g1InConcurrentMark", CC"()Z",                   (void*)&WB_G1InConcurrentMark},
1325   {CC"g1IsHumongous",      CC"(Ljava/lang/Object;)Z", (void*)&WB_G1IsHumongous     },
1326   {CC"g1NumMaxRegions",    CC"()J",                   (void*)&WB_G1NumMaxRegions  },
1327   {CC"g1NumFreeRegions",   CC"()J",                   (void*)&WB_G1NumFreeRegions  },




  72 class VM_WhiteBoxOperation : public VM_Operation {
  73  public:
  74   VM_WhiteBoxOperation()                         { }
  75   VMOp_Type type()                  const        { return VMOp_WhiteBoxOperation; }
  76   bool allow_nested_vm_operations() const        { return true; }
  77 };
  78 
  79 
  80 WB_ENTRY(jlong, WB_GetObjectAddress(JNIEnv* env, jobject o, jobject obj))
  81   return (jlong)(void*)JNIHandles::resolve(obj);
  82 WB_END
  83 
  84 WB_ENTRY(jint, WB_GetHeapOopSize(JNIEnv* env, jobject o))
  85   return heapOopSize;
  86 WB_END
  87 
  88 WB_ENTRY(jint, WB_GetVMPageSize(JNIEnv* env, jobject o))
  89   return os::vm_page_size();
  90 WB_END
  91 
  92 WB_ENTRY(jlong, WB_GetVMLargePageSize(JNIEnv* env, jobject o))
  93   return os::large_page_size();
  94 WB_END
  95 
  96 class WBIsKlassAliveClosure : public KlassClosure {
  97     Symbol* _name;
  98     bool _found;
  99 public:
 100     WBIsKlassAliveClosure(Symbol* name) : _name(name), _found(false) {}
 101 
 102     void do_klass(Klass* k) {
 103       if (_found) return;
 104       Symbol* ksym = k->name();
 105       if (ksym->fast_compare(_name) == 0) {
 106         _found = true;
 107       }
 108     }
 109 
 110     bool found() const {
 111         return _found;
 112     }
 113 };
 114 
 115 WB_ENTRY(jboolean, WB_IsClassAlive(JNIEnv* env, jobject target, jstring name))


1292         }
1293       } else {
1294         // Registration failed unexpectedly.
1295         tty->print_cr("Warning: unexpected error on register of sun.hotspot.WhiteBox::%s%s. All methods will be unregistered",
1296             method_array[i].name, method_array[i].signature);
1297         env->UnregisterNatives(wbclass);
1298         break;
1299       }
1300     }
1301   }
1302 }
1303 
1304 #define CC (char*)
1305 
1306 static JNINativeMethod methods[] = {
1307   {CC"getObjectAddress",   CC"(Ljava/lang/Object;)J", (void*)&WB_GetObjectAddress  },
1308   {CC"getObjectSize",      CC"(Ljava/lang/Object;)J", (void*)&WB_GetObjectSize     },
1309   {CC"isObjectInOldGen",   CC"(Ljava/lang/Object;)Z", (void*)&WB_isObjectInOldGen  },
1310   {CC"getHeapOopSize",     CC"()I",                   (void*)&WB_GetHeapOopSize    },
1311   {CC"getVMPageSize",      CC"()I",                   (void*)&WB_GetVMPageSize     },
1312   {CC"getVMLargePageSize", CC"()J",                   (void*)&WB_GetVMLargePageSize},
1313   {CC"isClassAlive0",      CC"(Ljava/lang/String;)Z", (void*)&WB_IsClassAlive      },
1314   {CC"parseCommandLine",
1315       CC"(Ljava/lang/String;C[Lsun/hotspot/parser/DiagnosticCommand;)[Ljava/lang/Object;",
1316       (void*) &WB_ParseCommandLine
1317   },
1318   {CC"addToBootstrapClassLoaderSearch", CC"(Ljava/lang/String;)V",
1319                                                       (void*)&WB_AddToBootstrapClassLoaderSearch},
1320   {CC"addToSystemClassLoaderSearch",    CC"(Ljava/lang/String;)V",
1321                                                       (void*)&WB_AddToSystemClassLoaderSearch},
1322   {CC"getCompressedOopsMaxHeapSize", CC"()J",
1323       (void*)&WB_GetCompressedOopsMaxHeapSize},
1324   {CC"printHeapSizes",     CC"()V",                   (void*)&WB_PrintHeapSizes    },
1325   {CC"runMemoryUnitTests", CC"()V",                   (void*)&WB_RunMemoryUnitTests},
1326   {CC"readFromNoaccessArea",CC"()V",                  (void*)&WB_ReadFromNoaccessArea},
1327   {CC"stressVirtualSpaceResize",CC"(JJJ)I",           (void*)&WB_StressVirtualSpaceResize},
1328 #if INCLUDE_ALL_GCS
1329   {CC"g1InConcurrentMark", CC"()Z",                   (void*)&WB_G1InConcurrentMark},
1330   {CC"g1IsHumongous",      CC"(Ljava/lang/Object;)Z", (void*)&WB_G1IsHumongous     },
1331   {CC"g1NumMaxRegions",    CC"()J",                   (void*)&WB_G1NumMaxRegions  },
1332   {CC"g1NumFreeRegions",   CC"()J",                   (void*)&WB_G1NumFreeRegions  },


< prev index next >