src/hotspot/share/jvmci/jvmciCompilerToVM.cpp
changeset 55463 31bf7b93df5d
parent 55454 8892555795cd
child 55488 d3e45bd166dc
equal deleted inserted replaced
55462:6dfdcd31463d 55463:31bf7b93df5d
   563     } else {
   563     } else {
   564       resolved_klass = SystemDictionary::find(class_name, class_loader, protection_domain, CHECK_0);
   564       resolved_klass = SystemDictionary::find(class_name, class_loader, protection_domain, CHECK_0);
   565     }
   565     }
   566   }
   566   }
   567   JVMCIObject result = JVMCIENV->get_jvmci_type(resolved_klass, JVMCI_CHECK_NULL);
   567   JVMCIObject result = JVMCIENV->get_jvmci_type(resolved_klass, JVMCI_CHECK_NULL);
       
   568   return JVMCIENV->get_jobject(result);
       
   569 C2V_END
       
   570 
       
   571 C2V_VMENTRY_NULL(jobject, getArrayType, (JNIEnv* env, jobject, jobject jvmci_type))
       
   572   if (jvmci_type == NULL) {
       
   573     JVMCI_THROW_0(NullPointerException);
       
   574   }
       
   575 
       
   576   JVMCIObject jvmci_type_object = JVMCIENV->wrap(jvmci_type);
       
   577   JVMCIKlassHandle array_klass(THREAD);
       
   578   if (JVMCIENV->isa_HotSpotResolvedPrimitiveType(jvmci_type_object)) {
       
   579     BasicType type = JVMCIENV->kindToBasicType(JVMCIENV->get_HotSpotResolvedPrimitiveType_kind(jvmci_type_object), JVMCI_CHECK_0);
       
   580     if (type == T_VOID) {
       
   581       return NULL;
       
   582     }
       
   583     array_klass = Universe::typeArrayKlassObj(type);
       
   584     if (array_klass == NULL) {
       
   585       JVMCI_THROW_MSG_NULL(InternalError, err_msg("No array klass for primitive type %s", type2name(type)));
       
   586     }
       
   587   } else {
       
   588     Klass* klass = JVMCIENV->asKlass(jvmci_type);
       
   589     if (klass == NULL) {
       
   590       JVMCI_THROW_0(NullPointerException);
       
   591     }
       
   592     array_klass = klass->array_klass(CHECK_NULL);
       
   593   }
       
   594   JVMCIObject result = JVMCIENV->get_jvmci_type(array_klass, JVMCI_CHECK_NULL);
   568   return JVMCIENV->get_jobject(result);
   595   return JVMCIENV->get_jobject(result);
   569 C2V_END
   596 C2V_END
   570 
   597 
   571 C2V_VMENTRY_NULL(jobject, lookupClass, (JNIEnv* env, jobject, jclass mirror))
   598 C2V_VMENTRY_NULL(jobject, lookupClass, (JNIEnv* env, jobject, jclass mirror))
   572   requireInHotSpot("lookupClass", JVMCI_CHECK_NULL);
   599   requireInHotSpot("lookupClass", JVMCI_CHECK_NULL);
  2576   char* speculation = NEW_RESOURCE_ARRAY(char, speculation_len);
  2603   char* speculation = NEW_RESOURCE_ARRAY(char, speculation_len);
  2577   JVMCIENV->copy_bytes_to(speculation_handle, (jbyte*) speculation, 0, speculation_len);
  2604   JVMCIENV->copy_bytes_to(speculation_handle, (jbyte*) speculation, 0, speculation_len);
  2578   return FailedSpeculation::add_failed_speculation(NULL, (FailedSpeculation**)(address) failed_speculations_address, (address) speculation, speculation_len);
  2605   return FailedSpeculation::add_failed_speculation(NULL, (FailedSpeculation**)(address) failed_speculations_address, (address) speculation, speculation_len);
  2579 }
  2606 }
  2580 
  2607 
       
  2608 C2V_VMENTRY(void, callSystemExit, (JNIEnv* env, jobject, jint status))
       
  2609   JavaValue result(T_VOID);
       
  2610   JavaCallArguments jargs(1);
       
  2611   jargs.push_int(status);
       
  2612   JavaCalls::call_static(&result,
       
  2613                        SystemDictionary::System_klass(),
       
  2614                        vmSymbols::exit_method_name(),
       
  2615                        vmSymbols::int_void_signature(),
       
  2616                        &jargs,
       
  2617                        CHECK);
       
  2618 }
       
  2619 
  2581 #define CC (char*)  /*cast a literal from (const char*)*/
  2620 #define CC (char*)  /*cast a literal from (const char*)*/
  2582 #define FN_PTR(f) CAST_FROM_FN_PTR(void*, &(c2v_ ## f))
  2621 #define FN_PTR(f) CAST_FROM_FN_PTR(void*, &(c2v_ ## f))
  2583 
  2622 
  2584 #define STRING                  "Ljava/lang/String;"
  2623 #define STRING                  "Ljava/lang/String;"
  2585 #define OBJECT                  "Ljava/lang/Object;"
  2624 #define OBJECT                  "Ljava/lang/Object;"
  2622   {CC "setNotInlinableOrCompilable",                  CC "(" HS_RESOLVED_METHOD ")V",                                                       FN_PTR(setNotInlinableOrCompilable)},
  2661   {CC "setNotInlinableOrCompilable",                  CC "(" HS_RESOLVED_METHOD ")V",                                                       FN_PTR(setNotInlinableOrCompilable)},
  2623   {CC "isCompilable",                                 CC "(" HS_RESOLVED_METHOD ")Z",                                                       FN_PTR(isCompilable)},
  2662   {CC "isCompilable",                                 CC "(" HS_RESOLVED_METHOD ")Z",                                                       FN_PTR(isCompilable)},
  2624   {CC "hasNeverInlineDirective",                      CC "(" HS_RESOLVED_METHOD ")Z",                                                       FN_PTR(hasNeverInlineDirective)},
  2663   {CC "hasNeverInlineDirective",                      CC "(" HS_RESOLVED_METHOD ")Z",                                                       FN_PTR(hasNeverInlineDirective)},
  2625   {CC "shouldInlineMethod",                           CC "(" HS_RESOLVED_METHOD ")Z",                                                       FN_PTR(shouldInlineMethod)},
  2664   {CC "shouldInlineMethod",                           CC "(" HS_RESOLVED_METHOD ")Z",                                                       FN_PTR(shouldInlineMethod)},
  2626   {CC "lookupType",                                   CC "(" STRING HS_RESOLVED_KLASS "Z)" HS_RESOLVED_TYPE,                                FN_PTR(lookupType)},
  2665   {CC "lookupType",                                   CC "(" STRING HS_RESOLVED_KLASS "Z)" HS_RESOLVED_TYPE,                                FN_PTR(lookupType)},
       
  2666   {CC "getArrayType",                                 CC "(" HS_RESOLVED_TYPE ")" HS_RESOLVED_KLASS,                                        FN_PTR(getArrayType)},
  2627   {CC "lookupClass",                                  CC "(" CLASS ")" HS_RESOLVED_TYPE,                                                    FN_PTR(lookupClass)},
  2667   {CC "lookupClass",                                  CC "(" CLASS ")" HS_RESOLVED_TYPE,                                                    FN_PTR(lookupClass)},
  2628   {CC "lookupNameInPool",                             CC "(" HS_CONSTANT_POOL "I)" STRING,                                                  FN_PTR(lookupNameInPool)},
  2668   {CC "lookupNameInPool",                             CC "(" HS_CONSTANT_POOL "I)" STRING,                                                  FN_PTR(lookupNameInPool)},
  2629   {CC "lookupNameAndTypeRefIndexInPool",              CC "(" HS_CONSTANT_POOL "I)I",                                                        FN_PTR(lookupNameAndTypeRefIndexInPool)},
  2669   {CC "lookupNameAndTypeRefIndexInPool",              CC "(" HS_CONSTANT_POOL "I)I",                                                        FN_PTR(lookupNameAndTypeRefIndexInPool)},
  2630   {CC "lookupSignatureInPool",                        CC "(" HS_CONSTANT_POOL "I)" STRING,                                                  FN_PTR(lookupSignatureInPool)},
  2670   {CC "lookupSignatureInPool",                        CC "(" HS_CONSTANT_POOL "I)" STRING,                                                  FN_PTR(lookupSignatureInPool)},
  2631   {CC "lookupKlassRefIndexInPool",                    CC "(" HS_CONSTANT_POOL "I)I",                                                        FN_PTR(lookupKlassRefIndexInPool)},
  2671   {CC "lookupKlassRefIndexInPool",                    CC "(" HS_CONSTANT_POOL "I)I",                                                        FN_PTR(lookupKlassRefIndexInPool)},
  2721   {CC "asReflectionField",                            CC "(" HS_RESOLVED_KLASS "I)" REFLECTION_FIELD,                                       FN_PTR(asReflectionField)},
  2761   {CC "asReflectionField",                            CC "(" HS_RESOLVED_KLASS "I)" REFLECTION_FIELD,                                       FN_PTR(asReflectionField)},
  2722   {CC "getFailedSpeculations",                        CC "(J[[B)[[B",                                                                       FN_PTR(getFailedSpeculations)},
  2762   {CC "getFailedSpeculations",                        CC "(J[[B)[[B",                                                                       FN_PTR(getFailedSpeculations)},
  2723   {CC "getFailedSpeculationsAddress",                 CC "(" HS_RESOLVED_METHOD ")J",                                                       FN_PTR(getFailedSpeculationsAddress)},
  2763   {CC "getFailedSpeculationsAddress",                 CC "(" HS_RESOLVED_METHOD ")J",                                                       FN_PTR(getFailedSpeculationsAddress)},
  2724   {CC "releaseFailedSpeculations",                    CC "(J)V",                                                                            FN_PTR(releaseFailedSpeculations)},
  2764   {CC "releaseFailedSpeculations",                    CC "(J)V",                                                                            FN_PTR(releaseFailedSpeculations)},
  2725   {CC "addFailedSpeculation",                         CC "(J[B)Z",                                                                          FN_PTR(addFailedSpeculation)},
  2765   {CC "addFailedSpeculation",                         CC "(J[B)Z",                                                                          FN_PTR(addFailedSpeculation)},
       
  2766   {CC "callSystemExit",                               CC "(I)V",                                                                            FN_PTR(callSystemExit)},
  2726 };
  2767 };
  2727 
  2768 
  2728 int CompilerToVM::methods_count() {
  2769 int CompilerToVM::methods_count() {
  2729   return sizeof(methods) / sizeof(JNINativeMethod);
  2770   return sizeof(methods) / sizeof(JNINativeMethod);
  2730 }
  2771 }