Skip to content

Commit 152bbb2

Browse files
authored
Merge pull request #22878 from pshipton/csmanagement
Stop using jimagePackageToModule for jdk26+
2 parents 9d2c7fb + 90d0fe1 commit 152bbb2

4 files changed

Lines changed: 24 additions & 15 deletions

File tree

runtime/bcutil/jimageintf.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -408,18 +408,17 @@ jimageGetResource(J9JImageIntf *jimageIntf, UDATA handle, UDATA resourceLocation
408408
return rc;
409409
}
410410

411+
#if JAVA_SPEC_VERSION < 26
411412
const char *
412413
jimagePackageToModule(J9JImageIntf *jimageIntf, UDATA handle, const char *packageName)
413414
{
414-
#if JAVA_SPEC_VERSION < 26
415415
if (0 != jimageIntf->libJImageHandle) {
416416
JImageFile *jimage = (JImageFile *)handle;
417417
return libJImagePackageToModule(jimage, packageName);
418-
} else
419-
#endif /* JAVA_SPEC_VERSION < 26 */
420-
{
418+
} else {
421419
PORT_ACCESS_FROM_PORT(jimageIntf->portLib);
422420
J9JImage *jimage = (J9JImage *)handle;
423421
return j9bcutil_findModuleForPackage(PORTLIB, jimage, packageName);
424422
}
425423
}
424+
#endif /* JAVA_SPEC_VERSION < 26 */

runtime/jcl/common/jclcinit.c

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -752,16 +752,19 @@ initializeRequiredClasses(J9VMThread *vmThread, char* dllName)
752752
if (J9_ARE_ANY_BITS_SET(vm->extendedRuntimeFlags2, J9_EXTENDED_RUNTIME2_LOAD_AGENT_MODULE)
753753
&& (NULL != vm->modulesPathEntry->extraInfo))
754754
{
755+
const char *moduleName = "jdk.management.agent";
756+
#if JAVA_SPEC_VERSION < 26
755757
const char *packageName = "jdk/internal/agent";
756-
const char *expectedModuleName = "jdk.management.agent";
757-
const char *moduleName = vm->jimageIntf->jimagePackageToModule(
758+
const char *actualModuleName = vm->jimageIntf->jimagePackageToModule(
758759
vm->jimageIntf, (UDATA) vm->modulesPathEntry->extraInfo,
759760
packageName);
760-
if (NULL == moduleName) {
761+
if (NULL == actualModuleName) {
761762
Trc_JCL_initializeRequiredClasses_moduleForPackageNotFound(vmThread, packageName);
762-
} else if (0 != strcmp(expectedModuleName, moduleName)) {
763-
Trc_JCL_initializeRequiredClasses_unexpectedModuleForPackage(vmThread, packageName, moduleName, expectedModuleName);
764-
} else {
763+
} else if (0 != strcmp(moduleName, actualModuleName)) {
764+
Trc_JCL_initializeRequiredClasses_unexpectedModuleForPackage(vmThread, packageName, actualModuleName, moduleName);
765+
} else
766+
#endif /* JAVA_SPEC_VERSION < 26 */
767+
{
765768
J9VMSystemProperty *systemProperty = NULL;
766769
Trc_JCL_initializeRequiredClasses_addAgentModuleEntry(vmThread, moduleName);
767770
/* Handle the case where there are no user-specified modules. In this case, there
@@ -790,17 +793,20 @@ initializeRequiredClasses(J9VMThread *vmThread, char* dllName)
790793
if (J9_ARE_ANY_BITS_SET(vm->extendedRuntimeFlags2, J9_EXTENDED_RUNTIME2_LOAD_HEALTHCENTER_MODULE)
791794
&& (NULL != vm->modulesPathEntry->extraInfo))
792795
{
796+
const char *moduleName = "ibm.healthcenter";
797+
#if JAVA_SPEC_VERSION < 26
793798
const char *packageName = "com/ibm/java/diagnostics/healthcenter/agent";
794-
const char *expectedModuleName = "ibm.healthcenter";
795-
const char *moduleName = vm->jimageIntf->jimagePackageToModule(
799+
const char *actualModuleName = vm->jimageIntf->jimagePackageToModule(
796800
vm->jimageIntf, (UDATA) vm->modulesPathEntry->extraInfo,
797801
packageName);
798802
if (NULL == moduleName) {
799803
Trc_JCL_initializeRequiredClasses_moduleForPackageNotFound(vmThread, packageName);
800-
} else if (0 != strcmp(expectedModuleName, moduleName)) {
804+
} else if (0 != strcmp(moduleName, actualModuleName)) {
801805
// package %s found in module %s (expected %s) - not loading"
802-
Trc_JCL_initializeRequiredClasses_unexpectedModuleForPackage(vmThread, packageName, moduleName, expectedModuleName);
803-
} else {
806+
Trc_JCL_initializeRequiredClasses_unexpectedModuleForPackage(vmThread, packageName, actualModuleName, moduleName);
807+
} else
808+
#endif /* JAVA_SPEC_VERSION < 26 */
809+
{
804810
J9VMSystemProperty *systemProperty = NULL;
805811
Trc_JCL_initializeRequiredClasses_addAgentModuleEntry(vmThread, moduleName);
806812
/* Handle the case where there are no user-specified modules. In this case, there

runtime/oti/bcutil_api.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,7 @@ jimageFreeResourceLocation(J9JImageIntf *jimageIntf, UDATA handle, UDATA resourc
381381
I_32
382382
jimageGetResource(J9JImageIntf *jimageIntf, UDATA handle, UDATA resourceLocation, char *buffer, I_64 bufferSize, I_64 *resourceSize);
383383

384+
#if JAVA_SPEC_VERSION < 26
384385
/**
385386
* Finds the module for the given package.
386387
*
@@ -392,6 +393,7 @@ jimageGetResource(J9JImageIntf *jimageIntf, UDATA handle, UDATA resourceLocation
392393
*/
393394
const char *
394395
jimagePackageToModule(J9JImageIntf *jimageIntf, UDATA handle, const char *packageName);
396+
#endif /* JAVA_SPEC_VERSION < 26 */
395397

396398
/* ---------------- jimagereader.c ----------------*/
397399

runtime/oti/j9nonbuilder.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2096,7 +2096,9 @@ typedef struct J9JImageIntf {
20962096
I_32 (* jimageFindResource)(struct J9JImageIntf *jimageIntf, UDATA handle, const char *moduleName, const char* name, UDATA *resourceLocation, I_64 *size);
20972097
void (* jimageFreeResourceLocation)(struct J9JImageIntf *jimageIntf, UDATA handle, UDATA resourceLocation);
20982098
I_32 (* jimageGetResource)(struct J9JImageIntf *jimageIntf, UDATA handle, UDATA resourceLocation, char *buffer, I_64 bufferSize, I_64 *resourceSize);
2099+
#if JAVA_SPEC_VERSION < 26
20992100
const char * (* jimagePackageToModule)(struct J9JImageIntf *jimageIntf, UDATA handle, const char *packageName);
2101+
#endif /* JAVA_SPEC_VERSION < 26 */
21002102
} J9JImageIntf;
21012103

21022104
/* @ddr_namespace: map_to_type=J9TranslationBufferSet */

0 commit comments

Comments
 (0)