949 result->set_type(args->return_type());
950
951 // Invoke the method. Result is returned as oop.
952 JavaCalls::call(result, method, &java_args, CHECK);
953
954 // Convert result
955 if (is_reference_type(result->get_type())) {
956 result->set_jobject(JNIHandles::make_local(THREAD, result->get_oop()));
957 }
958 }
959
960 DT_RETURN_MARK_DECL(AllocObject, jobject
961 , HOTSPOT_JNI_ALLOCOBJECT_RETURN(_ret_ref));
962
963 JNI_ENTRY(jobject, jni_AllocObject(JNIEnv *env, jclass clazz))
964 HOTSPOT_JNI_ALLOCOBJECT_ENTRY(env, clazz);
965
966 jobject ret = nullptr;
967 DT_RETURN_MARK(AllocObject, jobject, (const jobject&)ret);
968
969 instanceOop i = InstanceKlass::allocate_instance(JNIHandles::resolve_non_null(clazz), CHECK_NULL);
970 ret = JNIHandles::make_local(THREAD, i);
971 return ret;
972 JNI_END
973
974 DT_RETURN_MARK_DECL(NewObjectA, jobject
975 , HOTSPOT_JNI_NEWOBJECTA_RETURN(_ret_ref));
976
977 JNI_ENTRY(jobject, jni_NewObjectA(JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args))
978 HOTSPOT_JNI_NEWOBJECTA_ENTRY(env, clazz, (uintptr_t) methodID);
979
980 jobject obj = nullptr;
981 DT_RETURN_MARK(NewObjectA, jobject, (const jobject&)obj);
982
983 instanceOop i = InstanceKlass::allocate_instance(JNIHandles::resolve_non_null(clazz), CHECK_NULL);
984 obj = JNIHandles::make_local(THREAD, i);
985 JavaValue jvalue(T_VOID);
986 JNI_ArgumentPusherArray ap(methodID, args);
987 jni_invoke_nonstatic(env, &jvalue, obj, JNI_NONVIRTUAL, methodID, &ap, CHECK_NULL);
988 return obj;
989 JNI_END
990
991
992 DT_RETURN_MARK_DECL(NewObjectV, jobject
993 , HOTSPOT_JNI_NEWOBJECTV_RETURN(_ret_ref));
994
995 JNI_ENTRY(jobject, jni_NewObjectV(JNIEnv *env, jclass clazz, jmethodID methodID, va_list args))
996 HOTSPOT_JNI_NEWOBJECTV_ENTRY(env, clazz, (uintptr_t) methodID);
997
998 jobject obj = nullptr;
999 DT_RETURN_MARK(NewObjectV, jobject, (const jobject&)obj);
1000
1001 instanceOop i = InstanceKlass::allocate_instance(JNIHandles::resolve_non_null(clazz), CHECK_NULL);
1002 obj = JNIHandles::make_local(THREAD, i);
1003 JavaValue jvalue(T_VOID);
1004 JNI_ArgumentPusherVaArg ap(methodID, args);
1005 jni_invoke_nonstatic(env, &jvalue, obj, JNI_NONVIRTUAL, methodID, &ap, CHECK_NULL);
1006 return obj;
1007 JNI_END
1008
1009
1010 DT_RETURN_MARK_DECL(NewObject, jobject
1011 , HOTSPOT_JNI_NEWOBJECT_RETURN(_ret_ref));
1012
1013 JNI_ENTRY(jobject, jni_NewObject(JNIEnv *env, jclass clazz, jmethodID methodID, ...))
1014 HOTSPOT_JNI_NEWOBJECT_ENTRY(env, clazz, (uintptr_t) methodID);
1015
1016 jobject obj = nullptr;
1017 DT_RETURN_MARK(NewObject, jobject, (const jobject&)obj);
1018
1019 instanceOop i = InstanceKlass::allocate_instance(JNIHandles::resolve_non_null(clazz), CHECK_NULL);
1020 obj = JNIHandles::make_local(THREAD, i);
1021 va_list args;
1022 va_start(args, methodID);
1023 JavaValue jvalue(T_VOID);
1024 JNI_ArgumentPusherVaArg ap(methodID, args);
1025 jni_invoke_nonstatic(env, &jvalue, obj, JNI_NONVIRTUAL, methodID, &ap, CHECK_NULL);
1026 va_end(args);
1027 return obj;
1028 JNI_END
1029
1030
1031 JNI_ENTRY(jclass, jni_GetObjectClass(JNIEnv *env, jobject obj))
1032 HOTSPOT_JNI_GETOBJECTCLASS_ENTRY(env, obj);
1033
1034 Klass* k = JNIHandles::resolve_non_null(obj)->klass();
1035 jclass ret =
1036 (jclass) JNIHandles::make_local(THREAD, k->java_mirror());
1037
1038 HOTSPOT_JNI_GETOBJECTCLASS_RETURN(ret);
1039 return ret;
|
949 result->set_type(args->return_type());
950
951 // Invoke the method. Result is returned as oop.
952 JavaCalls::call(result, method, &java_args, CHECK);
953
954 // Convert result
955 if (is_reference_type(result->get_type())) {
956 result->set_jobject(JNIHandles::make_local(THREAD, result->get_oop()));
957 }
958 }
959
960 DT_RETURN_MARK_DECL(AllocObject, jobject
961 , HOTSPOT_JNI_ALLOCOBJECT_RETURN(_ret_ref));
962
963 JNI_ENTRY(jobject, jni_AllocObject(JNIEnv *env, jclass clazz))
964 HOTSPOT_JNI_ALLOCOBJECT_ENTRY(env, clazz);
965
966 jobject ret = nullptr;
967 DT_RETURN_MARK(AllocObject, jobject, (const jobject&)ret);
968
969 instanceOop i = InstanceKlass::allocate_instance(JNIHandles::resolve_non_null(clazz), "jni", CHECK_NULL);
970 ret = JNIHandles::make_local(THREAD, i);
971 return ret;
972 JNI_END
973
974 DT_RETURN_MARK_DECL(NewObjectA, jobject
975 , HOTSPOT_JNI_NEWOBJECTA_RETURN(_ret_ref));
976
977 JNI_ENTRY(jobject, jni_NewObjectA(JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args))
978 HOTSPOT_JNI_NEWOBJECTA_ENTRY(env, clazz, (uintptr_t) methodID);
979
980 jobject obj = nullptr;
981 DT_RETURN_MARK(NewObjectA, jobject, (const jobject&)obj);
982
983 instanceOop i = InstanceKlass::allocate_instance(JNIHandles::resolve_non_null(clazz), "jni", CHECK_NULL);
984 obj = JNIHandles::make_local(THREAD, i);
985 JavaValue jvalue(T_VOID);
986 JNI_ArgumentPusherArray ap(methodID, args);
987 jni_invoke_nonstatic(env, &jvalue, obj, JNI_NONVIRTUAL, methodID, &ap, CHECK_NULL);
988 return obj;
989 JNI_END
990
991
992 DT_RETURN_MARK_DECL(NewObjectV, jobject
993 , HOTSPOT_JNI_NEWOBJECTV_RETURN(_ret_ref));
994
995 JNI_ENTRY(jobject, jni_NewObjectV(JNIEnv *env, jclass clazz, jmethodID methodID, va_list args))
996 HOTSPOT_JNI_NEWOBJECTV_ENTRY(env, clazz, (uintptr_t) methodID);
997
998 jobject obj = nullptr;
999 DT_RETURN_MARK(NewObjectV, jobject, (const jobject&)obj);
1000
1001 instanceOop i = InstanceKlass::allocate_instance(JNIHandles::resolve_non_null(clazz), "jni", CHECK_NULL);
1002 obj = JNIHandles::make_local(THREAD, i);
1003 JavaValue jvalue(T_VOID);
1004 JNI_ArgumentPusherVaArg ap(methodID, args);
1005 jni_invoke_nonstatic(env, &jvalue, obj, JNI_NONVIRTUAL, methodID, &ap, CHECK_NULL);
1006 return obj;
1007 JNI_END
1008
1009
1010 DT_RETURN_MARK_DECL(NewObject, jobject
1011 , HOTSPOT_JNI_NEWOBJECT_RETURN(_ret_ref));
1012
1013 JNI_ENTRY(jobject, jni_NewObject(JNIEnv *env, jclass clazz, jmethodID methodID, ...))
1014 HOTSPOT_JNI_NEWOBJECT_ENTRY(env, clazz, (uintptr_t) methodID);
1015
1016 jobject obj = nullptr;
1017 DT_RETURN_MARK(NewObject, jobject, (const jobject&)obj);
1018
1019 instanceOop i = InstanceKlass::allocate_instance(JNIHandles::resolve_non_null(clazz), "jni", CHECK_NULL);
1020 obj = JNIHandles::make_local(THREAD, i);
1021 va_list args;
1022 va_start(args, methodID);
1023 JavaValue jvalue(T_VOID);
1024 JNI_ArgumentPusherVaArg ap(methodID, args);
1025 jni_invoke_nonstatic(env, &jvalue, obj, JNI_NONVIRTUAL, methodID, &ap, CHECK_NULL);
1026 va_end(args);
1027 return obj;
1028 JNI_END
1029
1030
1031 JNI_ENTRY(jclass, jni_GetObjectClass(JNIEnv *env, jobject obj))
1032 HOTSPOT_JNI_GETOBJECTCLASS_ENTRY(env, obj);
1033
1034 Klass* k = JNIHandles::resolve_non_null(obj)->klass();
1035 jclass ret =
1036 (jclass) JNIHandles::make_local(THREAD, k->java_mirror());
1037
1038 HOTSPOT_JNI_GETOBJECTCLASS_RETURN(ret);
1039 return ret;
|