< prev index next >

src/hotspot/share/prims/jvm.cpp

Print this page




3483   //   protection_domain. The protection_domain is passed as NULL by the java code
3484   //   if there is no security manager in 3-arg Class.forName().
3485   Klass* klass = SystemDictionary::resolve_or_fail(name, loader, protection_domain, throwError != 0, CHECK_NULL);
3486 
3487   // Check if we should initialize the class
3488   if (init && klass->is_instance_klass()) {
3489     klass->initialize(CHECK_NULL);
3490   }
3491   return (jclass) JNIHandles::make_local(env, klass->java_mirror());
3492 }
3493 
3494 
3495 // Method ///////////////////////////////////////////////////////////////////////////////////////////
3496 
3497 JVM_ENTRY(jobject, JVM_InvokeMethod(JNIEnv *env, jobject method, jobject obj, jobjectArray args0))
3498   JVMWrapper("JVM_InvokeMethod");
3499   Handle method_handle;
3500   if (thread->stack_available((address) &method_handle) >= JVMInvokeMethodSlack) {
3501     method_handle = Handle(THREAD, JNIHandles::resolve(method));
3502     Handle receiver(THREAD, JNIHandles::resolve(obj));
3503     objArrayHandle args(THREAD, objArrayOop(JNIHandles::resolve(args0)));
3504     oop result = Reflection::invoke_method(method_handle(), receiver, args, CHECK_NULL);
3505     jobject res = JNIHandles::make_local(env, result);
3506     if (JvmtiExport::should_post_vm_object_alloc()) {
3507       oop ret_type = java_lang_reflect_Method::return_type(method_handle());
3508       assert(ret_type != NULL, "sanity check: ret_type oop must not be NULL!");
3509       if (java_lang_Class::is_primitive(ret_type)) {
3510         // Only for primitive type vm allocates memory for java object.
3511         // See box() method.
3512         JvmtiExport::post_vm_object_alloc(JavaThread::current(), result);
3513       }
3514     }
3515     return res;
3516   } else {
3517     THROW_0(vmSymbols::java_lang_StackOverflowError());
3518   }
3519 JVM_END
3520 
3521 
3522 JVM_ENTRY(jobject, JVM_NewInstanceFromConstructor(JNIEnv *env, jobject c, jobjectArray args0))
3523   JVMWrapper("JVM_NewInstanceFromConstructor");

3524   oop constructor_mirror = JNIHandles::resolve(c);
3525   objArrayHandle args(THREAD, objArrayOop(JNIHandles::resolve(args0)));
3526   oop result = Reflection::invoke_constructor(constructor_mirror, args, CHECK_NULL);
3527   jobject res = JNIHandles::make_local(env, result);
3528   if (JvmtiExport::should_post_vm_object_alloc()) {
3529     JvmtiExport::post_vm_object_alloc(JavaThread::current(), result);
3530   }
3531   return res;
3532 JVM_END
3533 
3534 // Atomic ///////////////////////////////////////////////////////////////////////////////////////////
3535 
3536 JVM_LEAF(jboolean, JVM_SupportsCX8())
3537   JVMWrapper("JVM_SupportsCX8");
3538   return VM_Version::supports_cx8();
3539 JVM_END
3540 
3541 JVM_ENTRY(void, JVM_InitializeFromArchive(JNIEnv* env, jclass cls))
3542   JVMWrapper("JVM_InitializeFromArchive");
3543   Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve(cls));
3544   assert(k->is_klass(), "just checking");
3545   HeapShared::initialize_from_archived_subgraph(k);




3483   //   protection_domain. The protection_domain is passed as NULL by the java code
3484   //   if there is no security manager in 3-arg Class.forName().
3485   Klass* klass = SystemDictionary::resolve_or_fail(name, loader, protection_domain, throwError != 0, CHECK_NULL);
3486 
3487   // Check if we should initialize the class
3488   if (init && klass->is_instance_klass()) {
3489     klass->initialize(CHECK_NULL);
3490   }
3491   return (jclass) JNIHandles::make_local(env, klass->java_mirror());
3492 }
3493 
3494 
3495 // Method ///////////////////////////////////////////////////////////////////////////////////////////
3496 
3497 JVM_ENTRY(jobject, JVM_InvokeMethod(JNIEnv *env, jobject method, jobject obj, jobjectArray args0))
3498   JVMWrapper("JVM_InvokeMethod");
3499   Handle method_handle;
3500   if (thread->stack_available((address) &method_handle) >= JVMInvokeMethodSlack) {
3501     method_handle = Handle(THREAD, JNIHandles::resolve(method));
3502     Handle receiver(THREAD, JNIHandles::resolve(obj));
3503     objArrayHandle args = oopFactory::ensure_objArray(JNIHandles::resolve(args0), CHECK_NULL);
3504     oop result = Reflection::invoke_method(method_handle(), receiver, args, CHECK_NULL);
3505     jobject res = JNIHandles::make_local(env, result);
3506     if (JvmtiExport::should_post_vm_object_alloc()) {
3507       oop ret_type = java_lang_reflect_Method::return_type(method_handle());
3508       assert(ret_type != NULL, "sanity check: ret_type oop must not be NULL!");
3509       if (java_lang_Class::is_primitive(ret_type)) {
3510         // Only for primitive type vm allocates memory for java object.
3511         // See box() method.
3512         JvmtiExport::post_vm_object_alloc(JavaThread::current(), result);
3513       }
3514     }
3515     return res;
3516   } else {
3517     THROW_0(vmSymbols::java_lang_StackOverflowError());
3518   }
3519 JVM_END
3520 
3521 
3522 JVM_ENTRY(jobject, JVM_NewInstanceFromConstructor(JNIEnv *env, jobject c, jobjectArray args0))
3523   JVMWrapper("JVM_NewInstanceFromConstructor");
3524   objArrayHandle args = oopFactory::ensure_objArray(JNIHandles::resolve(args0), CHECK_NULL);
3525   oop constructor_mirror = JNIHandles::resolve(c);

3526   oop result = Reflection::invoke_constructor(constructor_mirror, args, CHECK_NULL);
3527   jobject res = JNIHandles::make_local(env, result);
3528   if (JvmtiExport::should_post_vm_object_alloc()) {
3529     JvmtiExport::post_vm_object_alloc(JavaThread::current(), result);
3530   }
3531   return res;
3532 JVM_END
3533 
3534 // Atomic ///////////////////////////////////////////////////////////////////////////////////////////
3535 
3536 JVM_LEAF(jboolean, JVM_SupportsCX8())
3537   JVMWrapper("JVM_SupportsCX8");
3538   return VM_Version::supports_cx8();
3539 JVM_END
3540 
3541 JVM_ENTRY(void, JVM_InitializeFromArchive(JNIEnv* env, jclass cls))
3542   JVMWrapper("JVM_InitializeFromArchive");
3543   Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve(cls));
3544   assert(k->is_klass(), "just checking");
3545   HeapShared::initialize_from_archived_subgraph(k);


< prev index next >