1273 case done_parm:
1274 return;
1275 break;
1276 default:
1277 ShouldNotReachHere();
1278 break;
1279 }
1280 fingerprint >>= parameter_feature_size;
1281 }
1282 }
1283 }
1284 };
1285
1286
1287 enum JNICallType {
1288 JNI_STATIC,
1289 JNI_VIRTUAL,
1290 JNI_NONVIRTUAL
1291 };
1292
1293 static methodHandle jni_resolve_interface_call(Handle recv, methodHandle method, TRAPS) {
1294 assert(!method.is_null() , "method should not be null");
1295
1296 KlassHandle recv_klass; // Default to NULL (use of ?: can confuse gcc)
1297 if (recv.not_null()) recv_klass = KlassHandle(THREAD, recv->klass());
1298 KlassHandle spec_klass (THREAD, method->method_holder());
1299 Symbol* name = method->name();
1300 Symbol* signature = method->signature();
1301 CallInfo info;
1302 LinkResolver::resolve_interface_call(info, recv, recv_klass, spec_klass, name, signature, KlassHandle(), false, true, CHECK_(methodHandle()));
1303 return info.selected_method();
1304 }
1305
1306 static methodHandle jni_resolve_virtual_call(Handle recv, methodHandle method, TRAPS) {
1307 assert(!method.is_null() , "method should not be null");
1308
1309 KlassHandle recv_klass; // Default to NULL (use of ?: can confuse gcc)
1310 if (recv.not_null()) recv_klass = KlassHandle(THREAD, recv->klass());
1311 KlassHandle spec_klass (THREAD, method->method_holder());
1312 Symbol* name = method->name();
1313 Symbol* signature = method->signature();
1314 CallInfo info;
1315 LinkResolver::resolve_virtual_call(info, recv, recv_klass, spec_klass, name, signature, KlassHandle(), false, true, CHECK_(methodHandle()));
1316 return info.selected_method();
1317 }
1318
1319
1320
1321 static void jni_invoke_static(JNIEnv *env, JavaValue* result, jobject receiver, JNICallType call_type, jmethodID method_id, JNI_ArgumentPusher *args, TRAPS) {
1322 methodHandle method(THREAD, Method::resolve_jmethod_id(method_id));
1323
1324 // Create object to hold arguments for the JavaCall, and associate it with
1325 // the jni parser
1326 ResourceMark rm(THREAD);
1327 int number_of_parameters = method->size_of_parameters();
1328 JavaCallArguments java_args(number_of_parameters);
1329 args->set_java_argument_object(&java_args);
1330
1331 assert(method->is_static(), "method should be static");
1332
1333 // Fill out JavaCallArguments object
1334 args->iterate( Fingerprinter(method).fingerprint() );
1335 // Initialize result type
1336 result->set_type(args->get_ret_type());
1337
1338 // Invoke the method. Result is returned as oop.
5034 args->version = JNI_VERSION_1_2;
5035 // javaStackSize is int in arguments structure
5036 assert(jlong(ThreadStackSize) * K < INT_MAX, "integer overflow");
5037 args->javaStackSize = (jint)(ThreadStackSize * K);
5038 }
5039 return ret;
5040 }
5041
5042 #ifndef PRODUCT
5043
5044 #include "gc_interface/collectedHeap.hpp"
5045 #include "utilities/quickSort.hpp"
5046
5047 #define run_unit_test(unit_test_function_call) \
5048 tty->print_cr("Running test: " #unit_test_function_call); \
5049 unit_test_function_call
5050
5051 void execute_internal_vm_tests() {
5052 if (ExecuteInternalVMTests) {
5053 tty->print_cr("Running internal VM tests");
5054 run_unit_test(arrayOopDesc::test_max_array_length());
5055 run_unit_test(CollectedHeap::test_is_in());
5056 run_unit_test(QuickSort::test_quick_sort());
5057 run_unit_test(AltHashing::test_alt_hash());
5058 tty->print_cr("All internal VM tests passed");
5059 }
5060 }
5061
5062 #undef run_unit_test
5063
5064 #endif
5065
5066 #ifndef USDT2
5067 HS_DTRACE_PROBE_DECL3(hotspot_jni, CreateJavaVM__entry, vm, penv, args);
5068 DT_RETURN_MARK_DECL(CreateJavaVM, jint);
5069 #else /* USDT2 */
5070 DT_RETURN_MARK_DECL(CreateJavaVM, jint
5071 , HOTSPOT_JNI_CREATEJAVAVM_RETURN(_ret_ref));
5072 #endif /* USDT2 */
5073
|
1273 case done_parm:
1274 return;
1275 break;
1276 default:
1277 ShouldNotReachHere();
1278 break;
1279 }
1280 fingerprint >>= parameter_feature_size;
1281 }
1282 }
1283 }
1284 };
1285
1286
1287 enum JNICallType {
1288 JNI_STATIC,
1289 JNI_VIRTUAL,
1290 JNI_NONVIRTUAL
1291 };
1292
1293
1294
1295 static void jni_invoke_static(JNIEnv *env, JavaValue* result, jobject receiver, JNICallType call_type, jmethodID method_id, JNI_ArgumentPusher *args, TRAPS) {
1296 methodHandle method(THREAD, Method::resolve_jmethod_id(method_id));
1297
1298 // Create object to hold arguments for the JavaCall, and associate it with
1299 // the jni parser
1300 ResourceMark rm(THREAD);
1301 int number_of_parameters = method->size_of_parameters();
1302 JavaCallArguments java_args(number_of_parameters);
1303 args->set_java_argument_object(&java_args);
1304
1305 assert(method->is_static(), "method should be static");
1306
1307 // Fill out JavaCallArguments object
1308 args->iterate( Fingerprinter(method).fingerprint() );
1309 // Initialize result type
1310 result->set_type(args->get_ret_type());
1311
1312 // Invoke the method. Result is returned as oop.
5008 args->version = JNI_VERSION_1_2;
5009 // javaStackSize is int in arguments structure
5010 assert(jlong(ThreadStackSize) * K < INT_MAX, "integer overflow");
5011 args->javaStackSize = (jint)(ThreadStackSize * K);
5012 }
5013 return ret;
5014 }
5015
5016 #ifndef PRODUCT
5017
5018 #include "gc_interface/collectedHeap.hpp"
5019 #include "utilities/quickSort.hpp"
5020
5021 #define run_unit_test(unit_test_function_call) \
5022 tty->print_cr("Running test: " #unit_test_function_call); \
5023 unit_test_function_call
5024
5025 void execute_internal_vm_tests() {
5026 if (ExecuteInternalVMTests) {
5027 tty->print_cr("Running internal VM tests");
5028 run_unit_test(GlobalDefinitions::test_globals());
5029 run_unit_test(arrayOopDesc::test_max_array_length());
5030 run_unit_test(CollectedHeap::test_is_in());
5031 run_unit_test(QuickSort::test_quick_sort());
5032 run_unit_test(AltHashing::test_alt_hash());
5033 tty->print_cr("All internal VM tests passed");
5034 }
5035 }
5036
5037 #undef run_unit_test
5038
5039 #endif
5040
5041 #ifndef USDT2
5042 HS_DTRACE_PROBE_DECL3(hotspot_jni, CreateJavaVM__entry, vm, penv, args);
5043 DT_RETURN_MARK_DECL(CreateJavaVM, jint);
5044 #else /* USDT2 */
5045 DT_RETURN_MARK_DECL(CreateJavaVM, jint
5046 , HOTSPOT_JNI_CREATEJAVAVM_RETURN(_ret_ref));
5047 #endif /* USDT2 */
5048
|