hotspot/src/share/vm/prims/whitebox.cpp
changeset 46329 53ccc37bda19
parent 46296 15ba6edb7910
child 46354 dedf3d5f3332
equal deleted inserted replaced
46328:6061df52d610 46329:53ccc37bda19
   780   CHECK_JNI_EXCEPTION_(env, JNI_FALSE);
   780   CHECK_JNI_EXCEPTION_(env, JNI_FALSE);
   781   return WhiteBox::compile_method(Method::checked_resolve_jmethod_id(jmid), comp_level, bci, THREAD);
   781   return WhiteBox::compile_method(Method::checked_resolve_jmethod_id(jmid), comp_level, bci, THREAD);
   782 WB_END
   782 WB_END
   783 
   783 
   784 WB_ENTRY(jboolean, WB_EnqueueInitializerForCompilation(JNIEnv* env, jobject o, jclass klass, jint comp_level))
   784 WB_ENTRY(jboolean, WB_EnqueueInitializerForCompilation(JNIEnv* env, jobject o, jclass klass, jint comp_level))
   785   instanceKlassHandle ikh(java_lang_Class::as_Klass(JNIHandles::resolve(klass)));
   785   InstanceKlass* ik = InstanceKlass::cast(java_lang_Class::as_Klass(JNIHandles::resolve(klass)));
   786   return WhiteBox::compile_method(ikh->class_initializer(), comp_level, InvocationEntryBci, THREAD);
   786   return WhiteBox::compile_method(ik->class_initializer(), comp_level, InvocationEntryBci, THREAD);
   787 WB_END
   787 WB_END
   788 
   788 
   789 WB_ENTRY(jboolean, WB_ShouldPrintAssembly(JNIEnv* env, jobject o, jobject method, jint comp_level))
   789 WB_ENTRY(jboolean, WB_ShouldPrintAssembly(JNIEnv* env, jobject o, jobject method, jint comp_level))
   790   jmethodID jmid = reflected_method_to_jmid(thread, env, method);
   790   jmethodID jmid = reflected_method_to_jmid(thread, env, method);
   791   CHECK_JNI_EXCEPTION_(env, JNI_FALSE);
   791   CHECK_JNI_EXCEPTION_(env, JNI_FALSE);
  1515   VM_ForceSafepoint force_safepoint_op;
  1515   VM_ForceSafepoint force_safepoint_op;
  1516   VMThread::execute(&force_safepoint_op);
  1516   VMThread::execute(&force_safepoint_op);
  1517 WB_END
  1517 WB_END
  1518 
  1518 
  1519 WB_ENTRY(jlong, WB_GetConstantPool(JNIEnv* env, jobject wb, jclass klass))
  1519 WB_ENTRY(jlong, WB_GetConstantPool(JNIEnv* env, jobject wb, jclass klass))
  1520   instanceKlassHandle ikh(java_lang_Class::as_Klass(JNIHandles::resolve(klass)));
  1520   InstanceKlass* ik = InstanceKlass::cast(java_lang_Class::as_Klass(JNIHandles::resolve(klass)));
  1521   return (jlong) ikh->constants();
  1521   return (jlong) ik->constants();
  1522 WB_END
  1522 WB_END
  1523 
  1523 
  1524 WB_ENTRY(jint, WB_GetConstantPoolCacheIndexTag(JNIEnv* env, jobject wb))
  1524 WB_ENTRY(jint, WB_GetConstantPoolCacheIndexTag(JNIEnv* env, jobject wb))
  1525   return ConstantPool::CPCACHE_INDEX_TAG;
  1525   return ConstantPool::CPCACHE_INDEX_TAG;
  1526 WB_END
  1526 WB_END
  1527 
  1527 
  1528 WB_ENTRY(jint, WB_GetConstantPoolCacheLength(JNIEnv* env, jobject wb, jclass klass))
  1528 WB_ENTRY(jint, WB_GetConstantPoolCacheLength(JNIEnv* env, jobject wb, jclass klass))
  1529   instanceKlassHandle ikh(java_lang_Class::as_Klass(JNIHandles::resolve(klass)));
  1529   InstanceKlass* ik = InstanceKlass::cast(java_lang_Class::as_Klass(JNIHandles::resolve(klass)));
  1530   ConstantPool* cp = ikh->constants();
  1530   ConstantPool* cp = ik->constants();
  1531   if (cp->cache() == NULL) {
  1531   if (cp->cache() == NULL) {
  1532       return -1;
  1532       return -1;
  1533   }
  1533   }
  1534   return cp->cache()->length();
  1534   return cp->cache()->length();
  1535 WB_END
  1535 WB_END
  1536 
  1536 
  1537 WB_ENTRY(jint, WB_ConstantPoolRemapInstructionOperandFromCache(JNIEnv* env, jobject wb, jclass klass, jint index))
  1537 WB_ENTRY(jint, WB_ConstantPoolRemapInstructionOperandFromCache(JNIEnv* env, jobject wb, jclass klass, jint index))
  1538   instanceKlassHandle ikh(java_lang_Class::as_Klass(JNIHandles::resolve(klass)));
  1538   InstanceKlass* ik = InstanceKlass::cast(java_lang_Class::as_Klass(JNIHandles::resolve(klass)));
  1539   ConstantPool* cp = ikh->constants();
  1539   ConstantPool* cp = ik->constants();
  1540   if (cp->cache() == NULL) {
  1540   if (cp->cache() == NULL) {
  1541     THROW_MSG_0(vmSymbols::java_lang_IllegalStateException(), "Constant pool does not have a cache");
  1541     THROW_MSG_0(vmSymbols::java_lang_IllegalStateException(), "Constant pool does not have a cache");
  1542   }
  1542   }
  1543   jint cpci = index;
  1543   jint cpci = index;
  1544   jint cpciTag = ConstantPool::CPCACHE_INDEX_TAG;
  1544   jint cpciTag = ConstantPool::CPCACHE_INDEX_TAG;
  1948 
  1948 
  1949 JVM_ENTRY(void, JVM_RegisterWhiteBoxMethods(JNIEnv* env, jclass wbclass))
  1949 JVM_ENTRY(void, JVM_RegisterWhiteBoxMethods(JNIEnv* env, jclass wbclass))
  1950   {
  1950   {
  1951     if (WhiteBoxAPI) {
  1951     if (WhiteBoxAPI) {
  1952       // Make sure that wbclass is loaded by the null classloader
  1952       // Make sure that wbclass is loaded by the null classloader
  1953       instanceKlassHandle ikh = instanceKlassHandle(JNIHandles::resolve(wbclass)->klass());
  1953       InstanceKlass* ik = InstanceKlass::cast(JNIHandles::resolve(wbclass)->klass());
  1954       Handle loader(THREAD, ikh->class_loader());
  1954       Handle loader(THREAD, ik->class_loader());
  1955       if (loader.is_null()) {
  1955       if (loader.is_null()) {
  1956         WhiteBox::register_methods(env, wbclass, thread, methods, sizeof(methods) / sizeof(methods[0]));
  1956         WhiteBox::register_methods(env, wbclass, thread, methods, sizeof(methods) / sizeof(methods[0]));
  1957         WhiteBox::register_extended(env, wbclass, thread);
  1957         WhiteBox::register_extended(env, wbclass, thread);
  1958         WhiteBox::set_used();
  1958         WhiteBox::set_used();
  1959       }
  1959       }