< prev index next >

src/hotspot/share/prims/whitebox.cpp

Print this page




 144 WB_END
 145 
 146 WB_ENTRY(jint, WB_GetHeapOopSize(JNIEnv* env, jobject o))
 147   return heapOopSize;
 148 WB_END
 149 
 150 WB_ENTRY(jint, WB_GetVMPageSize(JNIEnv* env, jobject o))
 151   return os::vm_page_size();
 152 WB_END
 153 
 154 WB_ENTRY(jlong, WB_GetVMAllocationGranularity(JNIEnv* env, jobject o))
 155   return os::vm_allocation_granularity();
 156 WB_END
 157 
 158 WB_ENTRY(jlong, WB_GetVMLargePageSize(JNIEnv* env, jobject o))
 159   return os::large_page_size();
 160 WB_END
 161 
 162 class WBIsKlassAliveClosure : public LockedClassesDo {
 163     Symbol* _name;
 164     bool _found;
 165 public:
 166     WBIsKlassAliveClosure(Symbol* name) : _name(name), _found(false) {}
 167 
 168     void do_klass(Klass* k) {
 169       if (_found) return;
 170       Symbol* ksym = k->name();
 171       if (ksym->fast_compare(_name) == 0) {
 172         _found = true;
 173       }
 174     }
 175 
 176     bool found() const {
 177         return _found;
 178     }
 179 };
 180 
 181 WB_ENTRY(jboolean, WB_IsClassAlive(JNIEnv* env, jobject target, jstring name))
 182   oop h_name = JNIHandles::resolve(name);
 183   if (h_name == NULL) return false;
 184   Symbol* sym = java_lang_String::as_symbol(h_name);
 185   TempNewSymbol tsym(sym); // Make sure to decrement reference count on sym on return
 186 
 187   WBIsKlassAliveClosure closure(sym);
 188   ClassLoaderDataGraph::classes_do(&closure);
 189 
 190   return closure.found();

 191 WB_END
 192 
 193 WB_ENTRY(jint, WB_GetSymbolRefcount(JNIEnv* env, jobject unused, jstring name))
 194   oop h_name = JNIHandles::resolve(name);
 195   if (h_name == NULL) return false;
 196   Symbol* sym = java_lang_String::as_symbol(h_name);
 197   TempNewSymbol tsym(sym); // Make sure to decrement reference count on sym on return
 198   return (jint)sym->refcount();
 199 WB_END
 200 
 201 
 202 WB_ENTRY(void, WB_AddToBootstrapClassLoaderSearch(JNIEnv* env, jobject o, jstring segment)) {
 203 #if INCLUDE_JVMTI
 204   ResourceMark rm;
 205   const char* seg = java_lang_String::as_utf8_string(JNIHandles::resolve_non_null(segment));
 206   JvmtiEnv* jvmti_env = JvmtiEnv::create_a_jvmti(JVMTI_VERSION);
 207   jvmtiError err = jvmti_env->AddToBootstrapClassLoaderSearch(seg);
 208   assert(err == JVMTI_ERROR_NONE, "must not fail");
 209 #endif
 210 }


2201 WB_END
2202 
2203 WB_ENTRY(jint, WB_GetKlassMetadataSize(JNIEnv* env, jobject wb, jclass mirror))
2204   Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve(mirror));
2205   // Return size in bytes.
2206   return k->size() * wordSize;
2207 WB_END
2208 
2209 #define CC (char*)
2210 
2211 static JNINativeMethod methods[] = {
2212   {CC"getObjectAddress0",                CC"(Ljava/lang/Object;)J", (void*)&WB_GetObjectAddress  },
2213   {CC"getObjectSize0",                   CC"(Ljava/lang/Object;)J", (void*)&WB_GetObjectSize     },
2214   {CC"isObjectInOldGen0",                CC"(Ljava/lang/Object;)Z", (void*)&WB_isObjectInOldGen  },
2215   {CC"getHeapOopSize",                   CC"()I",                   (void*)&WB_GetHeapOopSize    },
2216   {CC"getVMPageSize",                    CC"()I",                   (void*)&WB_GetVMPageSize     },
2217   {CC"getVMAllocationGranularity",       CC"()J",                   (void*)&WB_GetVMAllocationGranularity },
2218   {CC"getVMLargePageSize",               CC"()J",                   (void*)&WB_GetVMLargePageSize},
2219   {CC"getHeapSpaceAlignment",            CC"()J",                   (void*)&WB_GetHeapSpaceAlignment},
2220   {CC"getHeapAlignment",                 CC"()J",                   (void*)&WB_GetHeapAlignment},
2221   {CC"isClassAlive0",                    CC"(Ljava/lang/String;)Z", (void*)&WB_IsClassAlive      },
2222   {CC"getSymbolRefcount",                CC"(Ljava/lang/String;)I", (void*)&WB_GetSymbolRefcount },
2223   {CC"parseCommandLine0",
2224       CC"(Ljava/lang/String;C[Lsun/hotspot/parser/DiagnosticCommand;)[Ljava/lang/Object;",
2225       (void*) &WB_ParseCommandLine
2226   },
2227   {CC"addToBootstrapClassLoaderSearch0", CC"(Ljava/lang/String;)V",
2228                                                       (void*)&WB_AddToBootstrapClassLoaderSearch},
2229   {CC"addToSystemClassLoaderSearch0",    CC"(Ljava/lang/String;)V",
2230                                                       (void*)&WB_AddToSystemClassLoaderSearch},
2231   {CC"getCompressedOopsMaxHeapSize", CC"()J",
2232       (void*)&WB_GetCompressedOopsMaxHeapSize},
2233   {CC"printHeapSizes",     CC"()V",                   (void*)&WB_PrintHeapSizes    },
2234   {CC"runMemoryUnitTests", CC"()V",                   (void*)&WB_RunMemoryUnitTests},
2235   {CC"readFromNoaccessArea",CC"()V",                  (void*)&WB_ReadFromNoaccessArea},
2236   {CC"stressVirtualSpaceResize",CC"(JJJ)I",           (void*)&WB_StressVirtualSpaceResize},
2237 #if INCLUDE_CDS
2238   {CC"getOffsetForName0", CC"(Ljava/lang/String;)I",  (void*)&WB_GetOffsetForName},
2239 #endif
2240 #if INCLUDE_G1GC
2241   {CC"g1InConcurrentMark", CC"()Z",                   (void*)&WB_G1InConcurrentMark},




 144 WB_END
 145 
 146 WB_ENTRY(jint, WB_GetHeapOopSize(JNIEnv* env, jobject o))
 147   return heapOopSize;
 148 WB_END
 149 
 150 WB_ENTRY(jint, WB_GetVMPageSize(JNIEnv* env, jobject o))
 151   return os::vm_page_size();
 152 WB_END
 153 
 154 WB_ENTRY(jlong, WB_GetVMAllocationGranularity(JNIEnv* env, jobject o))
 155   return os::vm_allocation_granularity();
 156 WB_END
 157 
 158 WB_ENTRY(jlong, WB_GetVMLargePageSize(JNIEnv* env, jobject o))
 159   return os::large_page_size();
 160 WB_END
 161 
 162 class WBIsKlassAliveClosure : public LockedClassesDo {
 163     Symbol* _name;
 164     int _count;
 165 public:
 166     WBIsKlassAliveClosure(Symbol* name) : _name(name), _count(0) {}
 167 
 168     void do_klass(Klass* k) {

 169       Symbol* ksym = k->name();
 170       if (ksym->fast_compare(_name) == 0) {
 171         _count++;
 172       }
 173     }
 174 
 175     int count() const {
 176         return _count;
 177     }
 178 };
 179 
 180 WB_ENTRY(jint, WB_CountAliveClasses(JNIEnv* env, jobject target, jstring name))
 181   oop h_name = JNIHandles::resolve(name);
 182   if (h_name == NULL) return false;
 183   Symbol* sym = java_lang_String::as_symbol(h_name);
 184   TempNewSymbol tsym(sym); // Make sure to decrement reference count on sym on return
 185 
 186   WBIsKlassAliveClosure closure(sym);
 187   ClassLoaderDataGraph::classes_do(&closure);
 188 
 189   // Return the count of alive classes with this name.
 190   return closure.count();
 191 WB_END
 192 
 193 WB_ENTRY(jint, WB_GetSymbolRefcount(JNIEnv* env, jobject unused, jstring name))
 194   oop h_name = JNIHandles::resolve(name);
 195   if (h_name == NULL) return false;
 196   Symbol* sym = java_lang_String::as_symbol(h_name);
 197   TempNewSymbol tsym(sym); // Make sure to decrement reference count on sym on return
 198   return (jint)sym->refcount();
 199 WB_END
 200 
 201 
 202 WB_ENTRY(void, WB_AddToBootstrapClassLoaderSearch(JNIEnv* env, jobject o, jstring segment)) {
 203 #if INCLUDE_JVMTI
 204   ResourceMark rm;
 205   const char* seg = java_lang_String::as_utf8_string(JNIHandles::resolve_non_null(segment));
 206   JvmtiEnv* jvmti_env = JvmtiEnv::create_a_jvmti(JVMTI_VERSION);
 207   jvmtiError err = jvmti_env->AddToBootstrapClassLoaderSearch(seg);
 208   assert(err == JVMTI_ERROR_NONE, "must not fail");
 209 #endif
 210 }


2201 WB_END
2202 
2203 WB_ENTRY(jint, WB_GetKlassMetadataSize(JNIEnv* env, jobject wb, jclass mirror))
2204   Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve(mirror));
2205   // Return size in bytes.
2206   return k->size() * wordSize;
2207 WB_END
2208 
2209 #define CC (char*)
2210 
2211 static JNINativeMethod methods[] = {
2212   {CC"getObjectAddress0",                CC"(Ljava/lang/Object;)J", (void*)&WB_GetObjectAddress  },
2213   {CC"getObjectSize0",                   CC"(Ljava/lang/Object;)J", (void*)&WB_GetObjectSize     },
2214   {CC"isObjectInOldGen0",                CC"(Ljava/lang/Object;)Z", (void*)&WB_isObjectInOldGen  },
2215   {CC"getHeapOopSize",                   CC"()I",                   (void*)&WB_GetHeapOopSize    },
2216   {CC"getVMPageSize",                    CC"()I",                   (void*)&WB_GetVMPageSize     },
2217   {CC"getVMAllocationGranularity",       CC"()J",                   (void*)&WB_GetVMAllocationGranularity },
2218   {CC"getVMLargePageSize",               CC"()J",                   (void*)&WB_GetVMLargePageSize},
2219   {CC"getHeapSpaceAlignment",            CC"()J",                   (void*)&WB_GetHeapSpaceAlignment},
2220   {CC"getHeapAlignment",                 CC"()J",                   (void*)&WB_GetHeapAlignment},
2221   {CC"countAliveClasses0",               CC"(Ljava/lang/String;)I", (void*)&WB_CountAliveClasses },
2222   {CC"getSymbolRefcount",                CC"(Ljava/lang/String;)I", (void*)&WB_GetSymbolRefcount },
2223   {CC"parseCommandLine0",
2224       CC"(Ljava/lang/String;C[Lsun/hotspot/parser/DiagnosticCommand;)[Ljava/lang/Object;",
2225       (void*) &WB_ParseCommandLine
2226   },
2227   {CC"addToBootstrapClassLoaderSearch0", CC"(Ljava/lang/String;)V",
2228                                                       (void*)&WB_AddToBootstrapClassLoaderSearch},
2229   {CC"addToSystemClassLoaderSearch0",    CC"(Ljava/lang/String;)V",
2230                                                       (void*)&WB_AddToSystemClassLoaderSearch},
2231   {CC"getCompressedOopsMaxHeapSize", CC"()J",
2232       (void*)&WB_GetCompressedOopsMaxHeapSize},
2233   {CC"printHeapSizes",     CC"()V",                   (void*)&WB_PrintHeapSizes    },
2234   {CC"runMemoryUnitTests", CC"()V",                   (void*)&WB_RunMemoryUnitTests},
2235   {CC"readFromNoaccessArea",CC"()V",                  (void*)&WB_ReadFromNoaccessArea},
2236   {CC"stressVirtualSpaceResize",CC"(JJJ)I",           (void*)&WB_StressVirtualSpaceResize},
2237 #if INCLUDE_CDS
2238   {CC"getOffsetForName0", CC"(Ljava/lang/String;)I",  (void*)&WB_GetOffsetForName},
2239 #endif
2240 #if INCLUDE_G1GC
2241   {CC"g1InConcurrentMark", CC"()Z",                   (void*)&WB_G1InConcurrentMark},


< prev index next >