src/share/vm/prims/jvm.cpp

Print this page
rev 5685 : [mq]: 8028737-remove-old-code


3954 
3955 
3956 
3957 // Shared JNI/JVM entry points //////////////////////////////////////////////////////////////
3958 
3959 jclass find_class_from_class_loader(JNIEnv* env, Symbol* name, jboolean init, Handle loader, Handle protection_domain, jboolean throwError, TRAPS) {
3960   // Security Note:
3961   //   The Java level wrapper will perform the necessary security check allowing
3962   //   us to pass the NULL as the initiating class loader.
3963   Klass* klass = SystemDictionary::resolve_or_fail(name, loader, protection_domain, throwError != 0, CHECK_NULL);
3964 
3965   KlassHandle klass_handle(THREAD, klass);
3966   // Check if we should initialize the class
3967   if (init && klass_handle->oop_is_instance()) {
3968     klass_handle->initialize(CHECK_NULL);
3969   }
3970   return (jclass) JNIHandles::make_local(env, klass_handle->java_mirror());
3971 }
3972 
3973 
3974 // Internal SQE debugging support ///////////////////////////////////////////////////////////
3975 
3976 #ifndef PRODUCT
3977 
3978 extern "C" {
3979   JNIEXPORT jboolean JNICALL JVM_AccessVMBooleanFlag(const char* name, jboolean* value, jboolean is_get);
3980   JNIEXPORT jboolean JNICALL JVM_AccessVMIntFlag(const char* name, jint* value, jboolean is_get);
3981   JNIEXPORT void JNICALL JVM_VMBreakPoint(JNIEnv *env, jobject obj);
3982 }
3983 
3984 JVM_LEAF(jboolean, JVM_AccessVMBooleanFlag(const char* name, jboolean* value, jboolean is_get))
3985   JVMWrapper("JVM_AccessBoolVMFlag");
3986   return is_get ? CommandLineFlags::boolAt((char*) name, (bool*) value) : CommandLineFlags::boolAtPut((char*) name, (bool*) value, Flag::INTERNAL);
3987 JVM_END
3988 
3989 JVM_LEAF(jboolean, JVM_AccessVMIntFlag(const char* name, jint* value, jboolean is_get))
3990   JVMWrapper("JVM_AccessVMIntFlag");
3991   intx v;
3992   jboolean result = is_get ? CommandLineFlags::intxAt((char*) name, &v) : CommandLineFlags::intxAtPut((char*) name, &v, Flag::INTERNAL);
3993   *value = (jint)v;
3994   return result;
3995 JVM_END
3996 
3997 
3998 JVM_ENTRY(void, JVM_VMBreakPoint(JNIEnv *env, jobject obj))
3999   JVMWrapper("JVM_VMBreakPoint");
4000   oop the_obj = JNIHandles::resolve(obj);
4001   BREAKPOINT;
4002 JVM_END
4003 
4004 
4005 #endif
4006 
4007 
4008 // Method ///////////////////////////////////////////////////////////////////////////////////////////
4009 
4010 JVM_ENTRY(jobject, JVM_InvokeMethod(JNIEnv *env, jobject method, jobject obj, jobjectArray args0))
4011   JVMWrapper("JVM_InvokeMethod");
4012   Handle method_handle;
4013   if (thread->stack_available((address) &method_handle) >= JVMInvokeMethodSlack) {
4014     method_handle = Handle(THREAD, JNIHandles::resolve(method));
4015     Handle receiver(THREAD, JNIHandles::resolve(obj));
4016     objArrayHandle args(THREAD, objArrayOop(JNIHandles::resolve(args0)));
4017     oop result = Reflection::invoke_method(method_handle(), receiver, args, CHECK_NULL);
4018     jobject res = JNIHandles::make_local(env, result);
4019     if (JvmtiExport::should_post_vm_object_alloc()) {
4020       oop ret_type = java_lang_reflect_Method::return_type(method_handle());
4021       assert(ret_type != NULL, "sanity check: ret_type oop must not be NULL!");
4022       if (java_lang_Class::is_primitive(ret_type)) {
4023         // Only for primitive type vm allocates memory for java object.
4024         // See box() method.
4025         JvmtiExport::post_vm_object_alloc(JavaThread::current(), result);
4026       }
4027     }




3954 
3955 
3956 
3957 // Shared JNI/JVM entry points //////////////////////////////////////////////////////////////
3958 
3959 jclass find_class_from_class_loader(JNIEnv* env, Symbol* name, jboolean init, Handle loader, Handle protection_domain, jboolean throwError, TRAPS) {
3960   // Security Note:
3961   //   The Java level wrapper will perform the necessary security check allowing
3962   //   us to pass the NULL as the initiating class loader.
3963   Klass* klass = SystemDictionary::resolve_or_fail(name, loader, protection_domain, throwError != 0, CHECK_NULL);
3964 
3965   KlassHandle klass_handle(THREAD, klass);
3966   // Check if we should initialize the class
3967   if (init && klass_handle->oop_is_instance()) {
3968     klass_handle->initialize(CHECK_NULL);
3969   }
3970   return (jclass) JNIHandles::make_local(env, klass_handle->java_mirror());
3971 }
3972 
3973 


































3974 // Method ///////////////////////////////////////////////////////////////////////////////////////////
3975 
3976 JVM_ENTRY(jobject, JVM_InvokeMethod(JNIEnv *env, jobject method, jobject obj, jobjectArray args0))
3977   JVMWrapper("JVM_InvokeMethod");
3978   Handle method_handle;
3979   if (thread->stack_available((address) &method_handle) >= JVMInvokeMethodSlack) {
3980     method_handle = Handle(THREAD, JNIHandles::resolve(method));
3981     Handle receiver(THREAD, JNIHandles::resolve(obj));
3982     objArrayHandle args(THREAD, objArrayOop(JNIHandles::resolve(args0)));
3983     oop result = Reflection::invoke_method(method_handle(), receiver, args, CHECK_NULL);
3984     jobject res = JNIHandles::make_local(env, result);
3985     if (JvmtiExport::should_post_vm_object_alloc()) {
3986       oop ret_type = java_lang_reflect_Method::return_type(method_handle());
3987       assert(ret_type != NULL, "sanity check: ret_type oop must not be NULL!");
3988       if (java_lang_Class::is_primitive(ret_type)) {
3989         // Only for primitive type vm allocates memory for java object.
3990         // See box() method.
3991         JvmtiExport::post_vm_object_alloc(JavaThread::current(), result);
3992       }
3993     }