Skip to content

Commit

Permalink
Merge pull request #20603 from ThanHenderson/unnamed
Browse files Browse the repository at this point in the history
 Fix unnamed module spelling mistake
  • Loading branch information
babsingh authored Nov 15, 2024
2 parents d330919 + 681725e commit 0b18eb2
Show file tree
Hide file tree
Showing 17 changed files with 46 additions and 46 deletions.
2 changes: 1 addition & 1 deletion runtime/gc_base/RootScanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ MM_RootScanner::scanModularityObjects(J9ClassLoader * classLoader)
}

if (classLoader == _javaVM->systemClassLoader) {
doSlot(&_javaVM->unamedModuleForSystemLoader->moduleObject);
doSlot(&_javaVM->unnamedModuleForSystemLoader->moduleObject);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion runtime/gc_glue_java/ConcurrentMarkingDelegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ MM_ConcurrentMarkingDelegate::concurrentClassMark(MM_EnvironmentBase *env, bool
}

if (classLoader == _javaVM->systemClassLoader) {
_markingScheme->markObject(env, _javaVM->unamedModuleForSystemLoader->moduleObject);
_markingScheme->markObject(env, _javaVM->unnamedModuleForSystemLoader->moduleObject);
}
}

Expand Down
2 changes: 1 addition & 1 deletion runtime/gc_glue_java/MarkingDelegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ MM_MarkingDelegate::completeMarking(MM_EnvironmentBase *env)
}

if (classLoader == javaVM->systemClassLoader) {
_markingScheme->markObjectNoCheck(env, (omrobjectptr_t )javaVM->unamedModuleForSystemLoader->moduleObject);
_markingScheme->markObjectNoCheck(env, (omrobjectptr_t )javaVM->unnamedModuleForSystemLoader->moduleObject);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion runtime/gc_glue_java/MetronomeDelegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1046,7 +1046,7 @@ MM_MetronomeDelegate::doClassTracing(MM_EnvironmentRealtime *env)
}

if (classLoader == _javaVM->systemClassLoader) {
didWork |= _markingScheme->markObject(env, _javaVM->unamedModuleForSystemLoader->moduleObject);
didWork |= _markingScheme->markObject(env, _javaVM->unnamedModuleForSystemLoader->moduleObject);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions runtime/gc_vlhgc/CopyForwardScheme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2705,7 +2705,7 @@ MM_CopyForwardScheme::scanClassLoaderObjectSlots(MM_EnvironmentVLHGC *env, MM_Al
}

if (success && (classLoader == _javaVM->systemClassLoader)) {
success = copyAndForward(env, reservingContext, classLoaderObject, (J9Object **)&(_javaVM->unamedModuleForSystemLoader->moduleObject));
success = copyAndForward(env, reservingContext, classLoaderObject, (J9Object **)&(_javaVM->unnamedModuleForSystemLoader->moduleObject));
}
}
}
Expand Down Expand Up @@ -4455,7 +4455,7 @@ MM_CopyForwardScheme::scanRoots(MM_EnvironmentVLHGC* env)
}

if (success && (classLoader == _javaVM->systemClassLoader)) {
success = copyAndForward(env, getContextForHeapAddress(_javaVM->unamedModuleForSystemLoader->moduleObject), (J9Object **)&(_javaVM->unamedModuleForSystemLoader->moduleObject));
success = copyAndForward(env, getContextForHeapAddress(_javaVM->unnamedModuleForSystemLoader->moduleObject), (J9Object **)&(_javaVM->unnamedModuleForSystemLoader->moduleObject));
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions runtime/gc_vlhgc/GlobalMarkCardScrubber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,9 +299,9 @@ MM_GlobalMarkCardScrubber::scrubClassLoaderObject(MM_EnvironmentVLHGC *env, J9Ob
}

if (classLoader == javaVM->systemClassLoader) {
Assert_MM_true(NULL != javaVM->unamedModuleForSystemLoader->moduleObject);
Assert_MM_true(NULL != javaVM->unnamedModuleForSystemLoader->moduleObject);
if (doScrub) {
doScrub = mayScrubReference(env, classLoaderObject, javaVM->unamedModuleForSystemLoader->moduleObject);
doScrub = mayScrubReference(env, classLoaderObject, javaVM->unnamedModuleForSystemLoader->moduleObject);
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions runtime/gc_vlhgc/GlobalMarkingScheme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -908,9 +908,9 @@ MM_GlobalMarkingScheme::scanClassLoaderObject(MM_EnvironmentVLHGC *env, J9Object
}

if (classLoader == _javaVM->systemClassLoader) {
Assert_MM_true(NULL != _javaVM->unamedModuleForSystemLoader->moduleObject);
markObject(env, _javaVM->unamedModuleForSystemLoader->moduleObject);
rememberReferenceIfRequired(env, classLoaderObject, _javaVM->unamedModuleForSystemLoader->moduleObject);
Assert_MM_true(NULL != _javaVM->unnamedModuleForSystemLoader->moduleObject);
markObject(env, _javaVM->unnamedModuleForSystemLoader->moduleObject);
rememberReferenceIfRequired(env, classLoaderObject, _javaVM->unnamedModuleForSystemLoader->moduleObject);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion runtime/gc_vlhgc/WriteOnceCompactor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1359,7 +1359,7 @@ MM_WriteOnceCompactor::fixupClassLoaderObject(MM_EnvironmentVLHGC* env, J9Object
}

if (classLoader == _javaVM->systemClassLoader) {
slotPtr = &_javaVM->unamedModuleForSystemLoader->moduleObject;
slotPtr = &_javaVM->unnamedModuleForSystemLoader->moduleObject;

originalObject = *slotPtr;
J9Object* forwardedObject = getForwardWrapper(env, originalObject, cache);
Expand Down
32 changes: 16 additions & 16 deletions runtime/j9vm/java11vmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ static UDATA addModuleDefinition(J9VMThread * currentThread, J9Module * fromModu
static BOOLEAN isPackageDefined(J9VMThread * currentThread, J9ClassLoader * classLoader, const char *packageName);
static BOOLEAN areNoPackagesDefined(J9VMThread * currentThread, J9ClassLoader * classLoader, const char* const* packages, U_32 numPackages);
static UDATA exportPackageToAll(J9VMThread * currentThread, J9Module * fromModule, const char *package);
static UDATA exportPackageToAllUnamed(J9VMThread * currentThread, J9Module * fromModule, const char *package);
static UDATA exportPackageToAllUnnamed(J9VMThread *currentThread, J9Module *fromModule, const char *package);
static UDATA exportPackageToModule(J9VMThread * currentThread, J9Module * fromModule, const char *package, J9Module * toModule);
static void trcModulesCreationPackage(J9VMThread * currentThread, J9Module * fromModule, const char *package);
static void trcModulesAddModuleExportsToAll(J9VMThread * currentThread, J9Module * fromModule, const char *package);
Expand Down Expand Up @@ -281,7 +281,7 @@ createModule(J9VMThread * currentThread, j9object_t moduleObject, J9ClassLoader
} else {
if (NULL == moduleName) {
/* moduleName is passed as NULL for the unnamed module for bootloader created by JVM_SetBootLoaderUnnamedModule() */
j9mod = vm->unamedModuleForSystemLoader;
j9mod = vm->unnamedModuleForSystemLoader;
} else {
j9mod = vm->javaBaseModule;
j9mod->isLoose = TRUE;
Expand Down Expand Up @@ -561,7 +561,7 @@ trcModulesAddModuleExportsToAllUnnamed(J9VMThread * currentThread, J9Module * fr
}

static UDATA
exportPackageToAllUnamed(J9VMThread * currentThread, J9Module * fromModule, const char *package)
exportPackageToAllUnnamed(J9VMThread * currentThread, J9Module * fromModule, const char *package)
{
UDATA retval = ERRCODE_GENERAL_FAILURE;
J9Package * const j9package = getPackageDefinition(currentThread, fromModule, package, &retval);
Expand Down Expand Up @@ -914,9 +914,9 @@ JVM_DefineModule(JNIEnv * env, jobject module, jboolean isOpen, jstring version,
}

#if JAVA_SPEC_VERSION >= 21
/* vm->unamedModuleForSystemLoader->moduleObject was saved by JVM_SetBootLoaderUnnamedModule */
/* vm->unnamedModuleForSystemLoader->moduleObject was saved by JVM_SetBootLoaderUnnamedModule */
{
j9object_t moduleObject = vm->unamedModuleForSystemLoader->moduleObject;
j9object_t moduleObject = vm->unnamedModuleForSystemLoader->moduleObject;
Assert_SC_notNull(moduleObject);
J9VMJAVALANGCLASSLOADER_SET_UNNAMEDMODULE(currentThread, systemClassLoader->classLoaderObject, moduleObject);
Trc_MODULE_defineModule_setBootloaderUnnamedModule(currentThread);
Expand Down Expand Up @@ -1022,7 +1022,7 @@ JVM_AddModuleExports(JNIEnv * env, jobject fromModule, const char *package, jobj
J9Module * const j9ToMod = getJ9Module(currentThread, toModule);

if (isModuleUnnamed(currentThread, J9_JNI_UNWRAP_REFERENCE(toModule))) {
rc = exportPackageToAllUnamed(currentThread, j9FromMod, package);
rc = exportPackageToAllUnnamed(currentThread, j9FromMod, package);
} else {
rc = exportPackageToModule(currentThread, j9FromMod, package, j9ToMod);
}
Expand Down Expand Up @@ -1339,9 +1339,9 @@ JVM_AddModuleExportsToAllUnnamed(JNIEnv * env, jobject fromModule, const char *p
{
UDATA rc = ERRCODE_GENERAL_FAILURE;

J9Module * const j9FromMod = getJ9Module(currentThread, fromModule);
J9Module *const j9FromMod = getJ9Module(currentThread, fromModule);

rc = exportPackageToAllUnamed(currentThread, j9FromMod, package);
rc = exportPackageToAllUnnamed(currentThread, j9FromMod, package);

if (ERRCODE_SUCCESS != rc) {
throwExceptionHelper(currentThread, rc);
Expand Down Expand Up @@ -1501,7 +1501,7 @@ JVM_WaitForReferencePendingList(JNIEnv *env)

/**
* Adds an unnamed module to the bootLoader
* JDK21+ saves it to J9JavaVM->unamedModuleForSystemLoader->moduleObject,
* JDK21+ saves it to J9JavaVM->unnamedModuleForSystemLoader->moduleObject,
* and delays bootclassloader.unnamedModule setting until java.base module is created.
*
* @param module module
Expand Down Expand Up @@ -1539,16 +1539,16 @@ JVM_SetBootLoaderUnnamedModule(JNIEnv *env, jobject module)
vmFuncs->setCurrentExceptionUTF(currentThread, J9VMCONSTANTPOOL_JAVALANGILLEGALARGUMENTEXCEPTION, "module was not loaded by the bootclassloader");
} else {
#if JAVA_SPEC_VERSION >= 21
J9Module *unamedModuleForSystemLoader = vm->unamedModuleForSystemLoader;
J9Module *unnamedModuleForSystemLoader = vm->unnamedModuleForSystemLoader;
/* can't set bootclassloader.unnamedModule since bootclassloader hasn't finished the initialization yet */
if (NULL == unamedModuleForSystemLoader) {
vmFuncs->setCurrentExceptionUTF(currentThread, J9VMCONSTANTPOOL_JAVALANGINTERNALERROR, "unamedModuleForSystemLoader was not initialized");
} else if (NULL != unamedModuleForSystemLoader->moduleObject) {
vmFuncs->setCurrentExceptionUTF(currentThread, J9VMCONSTANTPOOL_JAVALANGINTERNALERROR, "module is already set in the unamedModuleForSystemLoader");
if (NULL == unnamedModuleForSystemLoader) {
vmFuncs->setCurrentExceptionUTF(currentThread, J9VMCONSTANTPOOL_JAVALANGINTERNALERROR, "unnamedModuleForSystemLoader was not initialized");
} else if (NULL != unnamedModuleForSystemLoader->moduleObject) {
vmFuncs->setCurrentExceptionUTF(currentThread, J9VMCONSTANTPOOL_JAVALANGINTERNALERROR, "module is already set in the unnamedModuleForSystemLoader");
} else {
J9Module *j9mod = createModule(currentThread, modObj, systemClassLoader, NULL /* NULL name field */);
unamedModuleForSystemLoader->moduleObject = modObj;
Trc_MODULE_setUnamedModuleForSystemLoaderModuleObject(currentThread, j9mod, unamedModuleForSystemLoader);
unnamedModuleForSystemLoader->moduleObject = modObj;
Trc_MODULE_setUnnamedModuleForSystemLoaderModuleObject(currentThread, j9mod, unnamedModuleForSystemLoader);
}
#else /* JAVA_SPEC_VERSION >= 21 */
if (NULL == J9VMJAVALANGCLASSLOADER_UNNAMEDMODULE(currentThread, systemClassLoader->classLoaderObject)) {
Expand Down
2 changes: 1 addition & 1 deletion runtime/oti/j9.h
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ static const struct { \
#define internalExitVMToJNI internalReleaseVMAccess
#endif /* !J9VM_INTERP_ATOMIC_FREE_JNI */

#define J9_IS_J9MODULE_UNNAMED(vm, module) ((NULL == module) || (module == vm->unamedModuleForSystemLoader))
#define J9_IS_J9MODULE_UNNAMED(vm, module) ((NULL == module) || (module == vm->unnamedModuleForSystemLoader))

#define J9_IS_J9MODULE_OPEN(module) (TRUE == module->isOpen)

Expand Down
2 changes: 1 addition & 1 deletion runtime/oti/j9nonbuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -6128,7 +6128,7 @@ typedef struct J9JavaVM {
omrthread_monitor_t classLoaderModuleAndLocationMutex;
struct J9Pool* modularityPool;
struct J9Module *javaBaseModule;
struct J9Module *unamedModuleForSystemLoader;
struct J9Module *unnamedModuleForSystemLoader;
J9ClassPathEntry *modulesPathEntry;
jclass jimModules;
jmethodID addReads;
Expand Down
2 changes: 1 addition & 1 deletion runtime/util/module.tdf
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,5 @@ TraceEvent=Trc_MODULE_addModulePackage Overhead=1 Level=5 Test Template="JVM_Add
TraceEvent=Trc_MODULE_setPackage Overhead=1 Level=5 Test Template="internally set package/class: %.*s, loader: %s (0x%p), module: %s (0x%p)"
TraceEvent=Trc_MODULE_invokeHashTableAtPut Overhead=1 Level=5 Test Template="%s invokes hashTableAtPut() : 0x%p->table (0x%p), value (0x%p, 0x%p) collisionIsFailure (%s)"
TraceEvent=Trc_MODULE_hashTableAtPut NoEnv Overhead=1 Level=5 Test Template="hashTableAtPut() : table (0x%p), value (0x%p) node (0x%p) collisionIsFailure(false)"
TraceEvent=Trc_MODULE_setUnamedModuleForSystemLoaderModuleObject Overhead=1 Level=5 Template="JVM_SetBootLoaderUnnamedModule() sets unnamed module (0x%p) for unamedModuleForSystemLoader (0x%p)"
TraceEvent=Trc_MODULE_setUnnamedModuleForSystemLoaderModuleObject Overhead=1 Level=5 Template="JVM_SetBootLoaderUnnamedModule() sets unnamed module (0x%p) for unnamedModuleForSystemLoader (0x%p)"
TraceEvent=Trc_MODULE_defineModule_setBootloaderUnnamedModule Overhead=1 Level=5 Template="JVM_DefineModule() sets unnamed module for boot loader"
10 changes: 5 additions & 5 deletions runtime/vm/createramclass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2470,7 +2470,7 @@ trcModulesSettingPackage(J9VMThread *vmThread, J9Class *ramClass, J9ClassLoader
char classLoaderNameBuf[J9VM_PACKAGE_NAME_BUFFER_LENGTH];
char *classLoaderNameUTF = NULL;

if (javaVM->unamedModuleForSystemLoader == ramClass->module) {
if (javaVM->unnamedModuleForSystemLoader == ramClass->module) {
#define SYSTEMLOADER_UNNAMED_NAMED_MODULE "unnamed module for system loader"
memcpy(moduleNameBuf, SYSTEMLOADER_UNNAMED_NAMED_MODULE, sizeof(SYSTEMLOADER_UNNAMED_NAMED_MODULE));
#undef SYSTEMLOADER_UNNAMED_NAMED_MODULE
Expand Down Expand Up @@ -3603,9 +3603,9 @@ internalCreateRAMClassFromROMClass(J9VMThread *vmThread, J9ClassLoader *classLoa
* Therefore J9Class.module should be NULL for classes loaded from classpath by non-bootloaders.
* The call to findModuleForPackage() should correctly set J9Class.module as it would return
* NULL for classes loaded from classpath.
* For bootloader, unnamed module is represented by J9JavaVM.unamedModuleForSystemLoader.
* For bootloader, unnamed module is represented by J9JavaVM.unnamedModuleForSystemLoader.
* Therefore for classes loaded by bootloader from boot classpath,
* J9Class.module should be set to J9JavaVM.unamedModuleForSystemLoader.
* J9Class.module should be set to J9JavaVM.unnamedModuleForSystemLoader.
*/
bool findModule = false;
J9ClassLoader *findModuleClassLoader = classLoader;
Expand Down Expand Up @@ -3647,7 +3647,7 @@ internalCreateRAMClassFromROMClass(J9VMThread *vmThread, J9ClassLoader *classLoa
}

if (!findModule) {
module = javaVM->unamedModuleForSystemLoader;
module = javaVM->unnamedModuleForSystemLoader;
}
}
if (findModule) {
Expand All @@ -3657,7 +3657,7 @@ internalCreateRAMClassFromROMClass(J9VMThread *vmThread, J9ClassLoader *classLoa
module = findModuleForPackage(vmThread, findModuleClassLoader, J9UTF8_DATA(className), pkgNameLength);
omrthread_monitor_exit(classLoaderModuleAndLocationMutex);
} else {
Assert_VM_true((module == javaVM->unamedModuleForSystemLoader) || (module == hostClass->module));
Assert_VM_true((module == javaVM->unnamedModuleForSystemLoader) || (module == hostClass->module));
}
} else {
/* Ignore locationType and assign all classes created before the java.base module is created to java.base.
Expand Down
12 changes: 6 additions & 6 deletions runtime/vm/jvminit.c
Original file line number Diff line number Diff line change
Expand Up @@ -780,9 +780,9 @@ freeJavaVM(J9JavaVM * vm)
vm->modulesPathEntry = NULL;
}

if (NULL != vm->unamedModuleForSystemLoader) {
vm->internalVMFunctions->freeJ9Module(vm, vm->unamedModuleForSystemLoader);
vm->unamedModuleForSystemLoader = NULL;
if (NULL != vm->unnamedModuleForSystemLoader) {
vm->internalVMFunctions->freeJ9Module(vm, vm->unnamedModuleForSystemLoader);
vm->unnamedModuleForSystemLoader = NULL;
}

if (NULL != vm->modularityPool) {
Expand Down Expand Up @@ -2944,12 +2944,12 @@ VMInitStages(J9JavaVM *vm, IDATA stage, void* reserved)
}
vm->javaBaseModule->classLoader = vm->systemClassLoader;

vm->unamedModuleForSystemLoader = pool_newElement(vm->modularityPool);
if (NULL == vm->unamedModuleForSystemLoader) {
vm->unnamedModuleForSystemLoader = pool_newElement(vm->modularityPool);
if (NULL == vm->unnamedModuleForSystemLoader) {
setErrorJ9dll(PORTLIB, loadInfo, "cannot allocate unnamed module for bootloader", FALSE);
goto _error;
}
vm->unamedModuleForSystemLoader->classLoader = vm->systemClassLoader;
vm->unnamedModuleForSystemLoader->classLoader = vm->systemClassLoader;

patchPathResult = setBootLoaderModulePatchPaths(vm, vm->javaBaseModule, JAVA_BASE_MODULE);
if (FALSE == patchPathResult) {
Expand Down
4 changes: 2 additions & 2 deletions test/functional/Java16andUp/playlist.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
</test>

<test>
<testCaseName>Jep397Tests_testSubClassOfSealedSuperFromDifferentPackageInSameUnamedModule</testCaseName>
<testCaseName>Jep397Tests_testSubClassOfSealedSuperFromDifferentPackageInSameUnnamedModule</testCaseName>
<disables>
<disable>
<comment>https://github.com/eclipse-openj9/openj9/issues/14028#issuecomment-988225623</comment>
Expand All @@ -91,7 +91,7 @@
</disables>
<command>$(JAVA_COMMAND) $(JVM_OPTIONS) \
-cp $(Q)$(LIB_DIR)$(D)asm.jar$(P)$(RESOURCES_DIR)$(P)$(TESTNG)$(P)$(TEST_RESROOT)$(D)GeneralTest.jar$(Q) \
org.testng.TestNG -d $(REPORTDIR) $(Q)$(TEST_RESROOT)$(D)testSubClassOfSealedSuperFromDifferentPackageInSameUnamedModule.xml$(Q) -testnames Jep397Tests_testSubClassOfSealedSuperFromDifferentPackageInSameUnamedModule \
org.testng.TestNG -d $(REPORTDIR) $(Q)$(TEST_RESROOT)$(D)testSubClassOfSealedSuperFromDifferentPackageInSameUnnamedModule.xml$(Q) -testnames Jep397Tests_testSubClassOfSealedSuperFromDifferentPackageInSameUnnamedModule \
-groups $(TEST_GROUP) \
-excludegroups $(DEFAULT_EXCLUDE); \
$(TEST_STATUS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
*
* Verify whether IncompatibleClassChangeError is thrown out when
* the specified non-public subclass is in a different package from
* the sealed super class/interface within the same unamed module.
* the sealed super class/interface within the same unnamed module.
*/
@Test(groups = { "level.sanity" })
public class Test_SubClass {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Java16andUp suite" parallel="none" verbose="2">
<test name="Jep397Tests_testSubClassOfSealedSuperFromDifferentPackageInSameUnamedModule">
<test name="Jep397Tests_testSubClassOfSealedSuperFromDifferentPackageInSameUnnamedModule">
<classes>
<class name="org.openj9.test.java.lang.Test_SubClass"/>
</classes>
Expand Down

0 comments on commit 0b18eb2

Please sign in to comment.