< prev index next >

src/share/vm/prims/whitebox.cpp

Print this page
rev 7696 : 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:


  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))


1205         }
1206       } else {
1207         // Registration failed unexpectedly.
1208         tty->print_cr("Warning: unexpected error on register of sun.hotspot.WhiteBox::%s%s. All methods will be unregistered",
1209             method_array[i].name, method_array[i].signature);
1210         env->UnregisterNatives(wbclass);
1211         break;
1212       }
1213     }
1214   }
1215 }
1216 
1217 #define CC (char*)
1218 
1219 static JNINativeMethod methods[] = {
1220   {CC"getObjectAddress",   CC"(Ljava/lang/Object;)J", (void*)&WB_GetObjectAddress  },
1221   {CC"getObjectSize",      CC"(Ljava/lang/Object;)J", (void*)&WB_GetObjectSize     },
1222   {CC"isObjectInOldGen",   CC"(Ljava/lang/Object;)Z", (void*)&WB_isObjectInOldGen  },
1223   {CC"getHeapOopSize",     CC"()I",                   (void*)&WB_GetHeapOopSize    },
1224   {CC"getVMPageSize",      CC"()I",                   (void*)&WB_GetVMPageSize     },

1225   {CC"isClassAlive0",      CC"(Ljava/lang/String;)Z", (void*)&WB_IsClassAlive      },
1226   {CC"parseCommandLine",
1227       CC"(Ljava/lang/String;C[Lsun/hotspot/parser/DiagnosticCommand;)[Ljava/lang/Object;",
1228       (void*) &WB_ParseCommandLine
1229   },
1230   {CC"addToBootstrapClassLoaderSearch", CC"(Ljava/lang/String;)V",
1231                                                       (void*)&WB_AddToBootstrapClassLoaderSearch},
1232   {CC"addToSystemClassLoaderSearch",    CC"(Ljava/lang/String;)V",
1233                                                       (void*)&WB_AddToSystemClassLoaderSearch},
1234   {CC"getCompressedOopsMaxHeapSize", CC"()J",
1235       (void*)&WB_GetCompressedOopsMaxHeapSize},
1236   {CC"printHeapSizes",     CC"()V",                   (void*)&WB_PrintHeapSizes    },
1237   {CC"runMemoryUnitTests", CC"()V",                   (void*)&WB_RunMemoryUnitTests},
1238   {CC"readFromNoaccessArea",CC"()V",                  (void*)&WB_ReadFromNoaccessArea},
1239   {CC"stressVirtualSpaceResize",CC"(JJJ)I",           (void*)&WB_StressVirtualSpaceResize},
1240 #if INCLUDE_ALL_GCS
1241   {CC"g1InConcurrentMark", CC"()Z",                   (void*)&WB_G1InConcurrentMark},
1242   {CC"g1IsHumongous",      CC"(Ljava/lang/Object;)Z", (void*)&WB_G1IsHumongous     },
1243   {CC"g1NumFreeRegions",   CC"()J",                   (void*)&WB_G1NumFreeRegions  },
1244   {CC"g1RegionSize",       CC"()I",                   (void*)&WB_G1RegionSize      },




  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))


1209         }
1210       } else {
1211         // Registration failed unexpectedly.
1212         tty->print_cr("Warning: unexpected error on register of sun.hotspot.WhiteBox::%s%s. All methods will be unregistered",
1213             method_array[i].name, method_array[i].signature);
1214         env->UnregisterNatives(wbclass);
1215         break;
1216       }
1217     }
1218   }
1219 }
1220 
1221 #define CC (char*)
1222 
1223 static JNINativeMethod methods[] = {
1224   {CC"getObjectAddress",   CC"(Ljava/lang/Object;)J", (void*)&WB_GetObjectAddress  },
1225   {CC"getObjectSize",      CC"(Ljava/lang/Object;)J", (void*)&WB_GetObjectSize     },
1226   {CC"isObjectInOldGen",   CC"(Ljava/lang/Object;)Z", (void*)&WB_isObjectInOldGen  },
1227   {CC"getHeapOopSize",     CC"()I",                   (void*)&WB_GetHeapOopSize    },
1228   {CC"getVMPageSize",      CC"()I",                   (void*)&WB_GetVMPageSize     },
1229   {CC"getVMLargePageSize", CC"()J",                   (void*)&WB_GetVMLargePageSize},
1230   {CC"isClassAlive0",      CC"(Ljava/lang/String;)Z", (void*)&WB_IsClassAlive      },
1231   {CC"parseCommandLine",
1232       CC"(Ljava/lang/String;C[Lsun/hotspot/parser/DiagnosticCommand;)[Ljava/lang/Object;",
1233       (void*) &WB_ParseCommandLine
1234   },
1235   {CC"addToBootstrapClassLoaderSearch", CC"(Ljava/lang/String;)V",
1236                                                       (void*)&WB_AddToBootstrapClassLoaderSearch},
1237   {CC"addToSystemClassLoaderSearch",    CC"(Ljava/lang/String;)V",
1238                                                       (void*)&WB_AddToSystemClassLoaderSearch},
1239   {CC"getCompressedOopsMaxHeapSize", CC"()J",
1240       (void*)&WB_GetCompressedOopsMaxHeapSize},
1241   {CC"printHeapSizes",     CC"()V",                   (void*)&WB_PrintHeapSizes    },
1242   {CC"runMemoryUnitTests", CC"()V",                   (void*)&WB_RunMemoryUnitTests},
1243   {CC"readFromNoaccessArea",CC"()V",                  (void*)&WB_ReadFromNoaccessArea},
1244   {CC"stressVirtualSpaceResize",CC"(JJJ)I",           (void*)&WB_StressVirtualSpaceResize},
1245 #if INCLUDE_ALL_GCS
1246   {CC"g1InConcurrentMark", CC"()Z",                   (void*)&WB_G1InConcurrentMark},
1247   {CC"g1IsHumongous",      CC"(Ljava/lang/Object;)Z", (void*)&WB_G1IsHumongous     },
1248   {CC"g1NumFreeRegions",   CC"()J",                   (void*)&WB_G1NumFreeRegions  },
1249   {CC"g1RegionSize",       CC"()I",                   (void*)&WB_G1RegionSize      },


< prev index next >