< prev index next >

src/share/vm/prims/jvm.cpp

Print this page
rev 12479 : 8171855: Move package name transformations during module bootstrap into native code
Reviewed-by: alanb, acorn, lfoltan, mchung


 992   Klass* k = SystemDictionary::find_instance_or_array_klass(klass_name,
 993                                                               h_loader,
 994                                                               Handle(),
 995                                                               CHECK_NULL);
 996 #if INCLUDE_CDS
 997   if (k == NULL) {
 998     // If the class is not already loaded, try to see if it's in the shared
 999     // archive for the current classloader (h_loader).
1000     instanceKlassHandle ik = SystemDictionaryShared::find_or_load_shared_class(
1001         klass_name, h_loader, CHECK_NULL);
1002     k = ik();
1003   }
1004 #endif
1005   return (k == NULL) ? NULL :
1006             (jclass) JNIHandles::make_local(env, k->java_mirror());
1007 JVM_END
1008 
1009 // Module support //////////////////////////////////////////////////////////////////////////////
1010 
1011 JVM_ENTRY(void, JVM_DefineModule(JNIEnv *env, jobject module, jboolean is_open, jstring version,
1012                                  jstring location, jobjectArray packages))
1013   JVMWrapper("JVM_DefineModule");
1014   Modules::define_module(module, version, location, packages, CHECK);
1015 JVM_END
1016 
1017 JVM_ENTRY(void, JVM_SetBootLoaderUnnamedModule(JNIEnv *env, jobject module))
1018   JVMWrapper("JVM_SetBootLoaderUnnamedModule");
1019   Modules::set_bootloader_unnamed_module(module, CHECK);
1020 JVM_END
1021 
1022 JVM_ENTRY(void, JVM_AddModuleExports(JNIEnv *env, jobject from_module, jstring package, jobject to_module))
1023   JVMWrapper("JVM_AddModuleExports");
1024   Modules::add_module_exports_qualified(from_module, package, to_module, CHECK);
1025 JVM_END
1026 
1027 JVM_ENTRY(void, JVM_AddModuleExportsToAllUnnamed(JNIEnv *env, jobject from_module, jstring package))
1028   JVMWrapper("JVM_AddModuleExportsToAllUnnamed");
1029   Modules::add_module_exports_to_all_unnamed(from_module, package, CHECK);
1030 JVM_END
1031 
1032 JVM_ENTRY(void, JVM_AddModuleExportsToAll(JNIEnv *env, jobject from_module, jstring package))
1033   JVMWrapper("JVM_AddModuleExportsToAll");
1034   Modules::add_module_exports(from_module, package, NULL, CHECK);
1035 JVM_END
1036 
1037 JVM_ENTRY (void, JVM_AddReadsModule(JNIEnv *env, jobject from_module, jobject source_module))
1038   JVMWrapper("JVM_AddReadsModule");
1039   Modules::add_reads_module(from_module, source_module, CHECK);
1040 JVM_END
1041 
1042 JVM_ENTRY (void, JVM_AddModulePackage(JNIEnv *env, jobject module, jstring package))
1043   JVMWrapper("JVM_AddModulePackage");
1044   Modules::add_module_package(module, package, CHECK);
1045 JVM_END
1046 
1047 JVM_ENTRY (jobject, JVM_GetModuleByPackageName(JNIEnv *env, jobject loader, jstring package))
1048   JVMWrapper("JVM_GetModuleByPackageName");
1049   return Modules::get_module_by_package_name(loader, package, THREAD);
1050 JVM_END
1051 
1052 // Reflection support //////////////////////////////////////////////////////////////////////////////
1053 
1054 JVM_ENTRY(jstring, JVM_GetClassName(JNIEnv *env, jclass cls))
1055   assert (cls != NULL, "illegal class");
1056   JVMWrapper("JVM_GetClassName");
1057   JvmtiVMObjectAllocEventCollector oam;
1058   ResourceMark rm(THREAD);
1059   const char* name;
1060   if (java_lang_Class::is_primitive(JNIHandles::resolve(cls))) {
1061     name = type2name(java_lang_Class::primitive_type(JNIHandles::resolve(cls)));
1062   } else {
1063     // Consider caching interned string in Klass
1064     Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve(cls));
1065     assert(k->is_klass(), "just checking");
1066     name = k->external_name();
1067   }




 992   Klass* k = SystemDictionary::find_instance_or_array_klass(klass_name,
 993                                                               h_loader,
 994                                                               Handle(),
 995                                                               CHECK_NULL);
 996 #if INCLUDE_CDS
 997   if (k == NULL) {
 998     // If the class is not already loaded, try to see if it's in the shared
 999     // archive for the current classloader (h_loader).
1000     instanceKlassHandle ik = SystemDictionaryShared::find_or_load_shared_class(
1001         klass_name, h_loader, CHECK_NULL);
1002     k = ik();
1003   }
1004 #endif
1005   return (k == NULL) ? NULL :
1006             (jclass) JNIHandles::make_local(env, k->java_mirror());
1007 JVM_END
1008 
1009 // Module support //////////////////////////////////////////////////////////////////////////////
1010 
1011 JVM_ENTRY(void, JVM_DefineModule(JNIEnv *env, jobject module, jboolean is_open, jstring version,
1012                                  jstring location, const char* const* packages, jsize num_packages))
1013   JVMWrapper("JVM_DefineModule");
1014   Modules::define_module(module, version, location, packages, num_packages, CHECK);
1015 JVM_END
1016 
1017 JVM_ENTRY(void, JVM_SetBootLoaderUnnamedModule(JNIEnv *env, jobject module))
1018   JVMWrapper("JVM_SetBootLoaderUnnamedModule");
1019   Modules::set_bootloader_unnamed_module(module, CHECK);
1020 JVM_END
1021 
1022 JVM_ENTRY(void, JVM_AddModuleExports(JNIEnv *env, jobject from_module, const char* package, jobject to_module))
1023   JVMWrapper("JVM_AddModuleExports");
1024   Modules::add_module_exports_qualified(from_module, package, to_module, CHECK);
1025 JVM_END
1026 
1027 JVM_ENTRY(void, JVM_AddModuleExportsToAllUnnamed(JNIEnv *env, jobject from_module, const char* package))
1028   JVMWrapper("JVM_AddModuleExportsToAllUnnamed");
1029   Modules::add_module_exports_to_all_unnamed(from_module, package, CHECK);
1030 JVM_END
1031 
1032 JVM_ENTRY(void, JVM_AddModuleExportsToAll(JNIEnv *env, jobject from_module, const char* package))
1033   JVMWrapper("JVM_AddModuleExportsToAll");
1034   Modules::add_module_exports(from_module, package, NULL, CHECK);
1035 JVM_END
1036 
1037 JVM_ENTRY (void, JVM_AddReadsModule(JNIEnv *env, jobject from_module, jobject source_module))
1038   JVMWrapper("JVM_AddReadsModule");
1039   Modules::add_reads_module(from_module, source_module, CHECK);
1040 JVM_END
1041 
1042 JVM_ENTRY (void, JVM_AddModulePackage(JNIEnv *env, jobject module, const char* package))
1043   JVMWrapper("JVM_AddModulePackage");
1044   Modules::add_module_package(module, package, CHECK);
1045 JVM_END
1046 
1047 JVM_ENTRY (jobject, JVM_GetModuleByPackageName(JNIEnv *env, jobject loader, const char* package))
1048   JVMWrapper("JVM_GetModuleByPackageName");
1049   return Modules::get_module_by_package_name(loader, package, THREAD);
1050 JVM_END
1051 
1052 // Reflection support //////////////////////////////////////////////////////////////////////////////
1053 
1054 JVM_ENTRY(jstring, JVM_GetClassName(JNIEnv *env, jclass cls))
1055   assert (cls != NULL, "illegal class");
1056   JVMWrapper("JVM_GetClassName");
1057   JvmtiVMObjectAllocEventCollector oam;
1058   ResourceMark rm(THREAD);
1059   const char* name;
1060   if (java_lang_Class::is_primitive(JNIHandles::resolve(cls))) {
1061     name = type2name(java_lang_Class::primitive_type(JNIHandles::resolve(cls)));
1062   } else {
1063     // Consider caching interned string in Klass
1064     Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve(cls));
1065     assert(k->is_klass(), "just checking");
1066     name = k->external_name();
1067   }


< prev index next >