< prev index next >

src/share/vm/prims/whitebox.cpp

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

*** 38,47 **** --- 38,49 ---- #include "memory/iterator.hpp" #include "memory/resourceArea.hpp" #include "memory/universe.hpp" #include "memory/oopFactory.hpp" #include "oops/constantPool.hpp" + #include "oops/objArrayKlass.hpp" + #include "oops/objArrayOop.inline.hpp" #include "oops/oop.inline.hpp" #include "prims/wbtestmethods/parserTests.hpp" #include "prims/whitebox.hpp" #include "runtime/arguments.hpp" #include "runtime/compilationPolicy.hpp"
*** 1398,1432 **** MetadataFactory::free_array(cld, (Array<u1>*)(uintptr_t)addr); WB_END WB_ENTRY(void, WB_DefineModule(JNIEnv* env, jobject o, jobject module, jstring version, jstring location, jobjectArray packages)) ! Modules::define_module(module, version, location, packages, CHECK); WB_END WB_ENTRY(void, WB_AddModuleExports(JNIEnv* env, jobject o, jobject from_module, jstring package, jobject to_module)) ! Modules::add_module_exports_qualified(from_module, package, to_module, CHECK); WB_END WB_ENTRY(void, WB_AddModuleExportsToAllUnnamed(JNIEnv* env, jobject o, jclass module, jstring package)) ! Modules::add_module_exports_to_all_unnamed(module, package, CHECK); WB_END WB_ENTRY(void, WB_AddModuleExportsToAll(JNIEnv* env, jobject o, jclass module, jstring package)) ! Modules::add_module_exports(module, package, NULL, CHECK); WB_END WB_ENTRY(void, WB_AddReadsModule(JNIEnv* env, jobject o, jobject from_module, jobject source_module)) Modules::add_reads_module(from_module, source_module, CHECK); WB_END WB_ENTRY(void, WB_AddModulePackage(JNIEnv* env, jobject o, jclass module, jstring package)) ! Modules::add_module_package(module, package, CHECK); WB_END WB_ENTRY(jobject, WB_GetModuleByPackageName(JNIEnv* env, jobject o, jobject loader, jstring package)) ! return Modules::get_module_by_package_name(loader, package, THREAD); WB_END WB_ENTRY(jlong, WB_IncMetaspaceCapacityUntilGC(JNIEnv* env, jobject wb, jlong inc)) if (inc < 0) { THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(), --- 1400,1477 ---- MetadataFactory::free_array(cld, (Array<u1>*)(uintptr_t)addr); WB_END WB_ENTRY(void, WB_DefineModule(JNIEnv* env, jobject o, jobject module, jstring version, jstring location, jobjectArray packages)) ! ResourceMark rm(THREAD); ! ! objArrayOop packages_oop = objArrayOop(JNIHandles::resolve(packages)); ! objArrayHandle packages_h(THREAD, packages_oop); ! int num_packages = (packages_h == NULL ? 0 : packages_h->length()); ! ! char** pkgs = NULL; ! if (num_packages > 0) { ! pkgs = new char*[num_packages]; ! for (int x = 0; x < num_packages; x++) { ! oop pkg_str = packages_h->obj_at(x); ! if (pkg_str == NULL || !pkg_str->is_a(SystemDictionary::String_klass())) { ! THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), ! err_msg("Bad package name")); ! } ! pkgs[x] = java_lang_String::as_utf8_string(pkg_str); ! } ! } ! Modules::define_module(module, version, location, (const char* const*)pkgs, num_packages, CHECK); WB_END WB_ENTRY(void, WB_AddModuleExports(JNIEnv* env, jobject o, jobject from_module, jstring package, jobject to_module)) ! ResourceMark rm(THREAD); ! char* package_name = NULL; ! if (package != NULL) { ! package_name = java_lang_String::as_utf8_string(JNIHandles::resolve_non_null(package)); ! } ! Modules::add_module_exports_qualified(from_module, package_name, to_module, CHECK); WB_END WB_ENTRY(void, WB_AddModuleExportsToAllUnnamed(JNIEnv* env, jobject o, jclass module, jstring package)) ! ResourceMark rm(THREAD); ! char* package_name = NULL; ! if (package != NULL) { ! package_name = java_lang_String::as_utf8_string(JNIHandles::resolve_non_null(package)); ! } ! Modules::add_module_exports_to_all_unnamed(module, package_name, CHECK); WB_END WB_ENTRY(void, WB_AddModuleExportsToAll(JNIEnv* env, jobject o, jclass module, jstring package)) ! ResourceMark rm(THREAD); ! char* package_name = NULL; ! if (package != NULL) { ! package_name = java_lang_String::as_utf8_string(JNIHandles::resolve_non_null(package)); ! } ! Modules::add_module_exports(module, package_name, NULL, CHECK); WB_END WB_ENTRY(void, WB_AddReadsModule(JNIEnv* env, jobject o, jobject from_module, jobject source_module)) Modules::add_reads_module(from_module, source_module, CHECK); WB_END WB_ENTRY(void, WB_AddModulePackage(JNIEnv* env, jobject o, jclass module, jstring package)) ! ResourceMark rm(THREAD); ! char* package_name = NULL; ! if (package != NULL) { ! package_name = java_lang_String::as_utf8_string(JNIHandles::resolve_non_null(package)); ! } ! Modules::add_module_package(module, package_name, CHECK); WB_END WB_ENTRY(jobject, WB_GetModuleByPackageName(JNIEnv* env, jobject o, jobject loader, jstring package)) ! ResourceMark rm(THREAD); ! char* package_name = NULL; ! if (package != NULL) { ! package_name = java_lang_String::as_utf8_string(JNIHandles::resolve_non_null(package)); ! } ! return Modules::get_module_by_package_name(loader, package_name, THREAD); WB_END WB_ENTRY(jlong, WB_IncMetaspaceCapacityUntilGC(JNIEnv* env, jobject wb, jlong inc)) if (inc < 0) { THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(),
< prev index next >