< prev index next >

src/hotspot/share/jvmci/jvmciCompilerToVM.cpp

Print this page




1017 
1018 C2V_VMENTRY_NULL(jobject, executeHotSpotNmethod, (JNIEnv* env, jobject, jobject args, jobject hs_nmethod))
1019   // The incoming arguments array would have to contain JavaConstants instead of regular objects
1020   // and the return value would have to be wrapped as a JavaConstant.
1021   requireInHotSpot("executeHotSpotNmethod", JVMCI_CHECK_NULL);
1022 
1023   HandleMark hm;
1024 
1025   JVMCIObject nmethod_mirror = JVMCIENV->wrap(hs_nmethod);
1026   nmethodLocker locker;
1027   nmethod* nm = JVMCIENV->get_nmethod(nmethod_mirror, locker);
1028   if (nm == NULL) {
1029     JVMCI_THROW_NULL(InvalidInstalledCodeException);
1030   }
1031   methodHandle mh(THREAD, nm->method());
1032   Symbol* signature = mh->signature();
1033   JavaCallArguments jca(mh->size_of_parameters());
1034 
1035   JavaArgumentUnboxer jap(signature, &jca, (arrayOop) JNIHandles::resolve(args), mh->is_static());
1036   JavaValue result(jap.return_type());
1037   jca.set_alternative_target(nm);
1038   JavaCalls::call(&result, mh, &jca, CHECK_NULL);
1039 
1040   if (jap.return_type() == T_VOID) {
1041     return NULL;
1042   } else if (is_reference_type(jap.return_type())) {
1043     return JNIHandles::make_local((oop) result.get_jobject());
1044   } else {
1045     jvalue *value = (jvalue *) result.get_value_addr();
1046     // Narrow the value down if required (Important on big endian machines)
1047     switch (jap.return_type()) {
1048       case T_BOOLEAN:
1049        value->z = (jboolean) value->i;
1050        break;
1051       case T_BYTE:
1052        value->b = (jbyte) value->i;
1053        break;
1054       case T_CHAR:
1055        value->c = (jchar) value->i;
1056        break;
1057       case T_SHORT:




1017 
1018 C2V_VMENTRY_NULL(jobject, executeHotSpotNmethod, (JNIEnv* env, jobject, jobject args, jobject hs_nmethod))
1019   // The incoming arguments array would have to contain JavaConstants instead of regular objects
1020   // and the return value would have to be wrapped as a JavaConstant.
1021   requireInHotSpot("executeHotSpotNmethod", JVMCI_CHECK_NULL);
1022 
1023   HandleMark hm;
1024 
1025   JVMCIObject nmethod_mirror = JVMCIENV->wrap(hs_nmethod);
1026   nmethodLocker locker;
1027   nmethod* nm = JVMCIENV->get_nmethod(nmethod_mirror, locker);
1028   if (nm == NULL) {
1029     JVMCI_THROW_NULL(InvalidInstalledCodeException);
1030   }
1031   methodHandle mh(THREAD, nm->method());
1032   Symbol* signature = mh->signature();
1033   JavaCallArguments jca(mh->size_of_parameters());
1034 
1035   JavaArgumentUnboxer jap(signature, &jca, (arrayOop) JNIHandles::resolve(args), mh->is_static());
1036   JavaValue result(jap.return_type());
1037   jca.set_alternative_target(Handle(THREAD, JNIHandles::resolve(nmethod_mirror.as_jobject())));
1038   JavaCalls::call(&result, mh, &jca, CHECK_NULL);
1039 
1040   if (jap.return_type() == T_VOID) {
1041     return NULL;
1042   } else if (is_reference_type(jap.return_type())) {
1043     return JNIHandles::make_local((oop) result.get_jobject());
1044   } else {
1045     jvalue *value = (jvalue *) result.get_value_addr();
1046     // Narrow the value down if required (Important on big endian machines)
1047     switch (jap.return_type()) {
1048       case T_BOOLEAN:
1049        value->z = (jboolean) value->i;
1050        break;
1051       case T_BYTE:
1052        value->b = (jbyte) value->i;
1053        break;
1054       case T_CHAR:
1055        value->c = (jchar) value->i;
1056        break;
1057       case T_SHORT:


< prev index next >