Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add flag to indicate if ROMclass is from SCC #20029

Merged
merged 2 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 20 additions & 13 deletions runtime/bcutil/ROMClassBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -410,12 +410,12 @@ ROMClassBuilder::handleAnonClassName(J9CfrClassFile *classfile, ROMClassCreation
}
memcpy (constantPool[newUtfCPEntry].bytes + newHostPackageLength, originalStringBytes, originalStringLength);
*(U_8*)((UDATA) constantPool[newUtfCPEntry].bytes + newHostPackageLength + originalStringLength) = ANON_CLASSNAME_CHARACTER_SEPARATOR;
/*
/*
* 0x<romAddress> will be appended to anon/hidden class name.
* Initialize the 0x<romAddress> part to 0x00000000 or 0x0000000000000000 (depending on the platforms).
*/
j9str_printf(PORTLIB, buf, ROM_ADDRESS_LENGTH + 1, ROM_ADDRESS_FORMAT, 0);
memcpy(constantPool[newUtfCPEntry].bytes + newHostPackageLength + originalStringLength + 1, buf, ROM_ADDRESS_LENGTH + 1);
memcpy(constantPool[newUtfCPEntry].bytes + newHostPackageLength + originalStringLength + 1, buf, ROM_ADDRESS_LENGTH + 1);

/* Mark if the class is a Lambda class. */
#if defined(J9VM_OPT_OPENJDK_METHODHANDLE)
Expand Down Expand Up @@ -593,8 +593,8 @@ ROMClassBuilder::prepareAndLaydown( BufferManager *bufferManager, ClassFileParse
#if JAVA_SPEC_VERSION < 21
U_32 sizeToCompareForLambda = 0;
if (context->isLambdaClass()) {
/*
* romSize calculated from getSizeInfo() does not involve StringInternManager. It is only accurate for string intern disabled classes.
/*
* romSize calculated from getSizeInfo() does not involve StringInternManager. It is only accurate for string intern disabled classes.
* Lambda classes in java 15 and up are strong hidden classes (defined with Option.STONG), which has the same lifecycle as its
* defining class loader. It is string intern enabled. So pass classFileSize instead of romSize to sizeToCompareForLambda.
*/
Expand Down Expand Up @@ -667,7 +667,7 @@ ROMClassBuilder::prepareAndLaydown( BufferManager *bufferManager, ClassFileParse
) {
/* For redefining/transforming, we still want loadType to be J9SHR_LOADTYPE_REDEFINED/J9SHR_LOADTYPE_RETRANSFORMED,
* so put these checks after the redefining/transforming checks.
*/
*/
loadType = J9SHR_LOADTYPE_NOT_FROM_PATH;
}

Expand Down Expand Up @@ -768,10 +768,13 @@ ROMClassBuilder::prepareAndLaydown( BufferManager *bufferManager, ClassFileParse
*/
if (!sharedStoreClassTransaction.isCacheFull()) {
if ( sharedStoreClassTransaction.allocateSharedClass(&sizeRequirements) ){
U_8 *romClassBuffer = (U_8*)sharedStoreClassTransaction.getRomClass();
J9ROMClass *romClassBuffer = (J9ROMClass*)sharedStoreClassTransaction.getRomClass();
/*
* Make note that the laydown is occurring in SharedClasses
*/

extraModifiers |= J9AccClassIsShared;

romSize = finishPrepareAndLaydown(
(U_8*)sharedStoreClassTransaction.getRomClass(),
(U_8*)sharedStoreClassTransaction.getLineNumberTable(),
Expand All @@ -782,15 +785,15 @@ ROMClassBuilder::prepareAndLaydown( BufferManager *bufferManager, ClassFileParse
context, &constantPoolMap
);

fixReturnBytecodes(_portLibrary, (J9ROMClass *)romClassBuffer);
fixReturnBytecodes(_portLibrary, romClassBuffer);

/*
* inform the shared class transaction what the final ROMSize is
*/
sharedStoreClassTransaction.updateSharedClassSize(romSize);
context->recordROMClass((J9ROMClass *)romClassBuffer);
context->recordROMClass(romClassBuffer);
if ((NULL != _javaVM) && (_javaVM->extendedRuntimeFlags & J9_EXTENDED_RUNTIME_CHECK_DEBUG_INFO_COMPRESSION)) {
checkDebugInfoCompression((J9ROMClass *)romClassBuffer, classFileOracle, &srpKeyProducer, &constantPoolMap, &srpOffsetTable);
checkDebugInfoCompression(romClassBuffer, classFileOracle, &srpKeyProducer, &constantPoolMap, &srpOffsetTable);
}
return OK;
}
Expand Down Expand Up @@ -1216,7 +1219,7 @@ ROMClassBuilder::finishPrepareAndLaydown(
* + UNUSED
*
* + UNUSED
* + UNUSED
* + J9AccClassIsShared
* + J9AccClassIsValueBased
* + J9AccClassHiddenOptionNestmate
*
Expand Down Expand Up @@ -1265,7 +1268,7 @@ ROMClassBuilder::computeExtraModifiers(ClassFileOracle *classFileOracle, ROMClas
if ( context->isClassAnon() ) {
modifiers |= J9AccClassAnonClass;
}

if (context->isClassHidden()) {
modifiers |= J9AccClassHidden;
if (context->isHiddenClassOptNestmateSet()) {
Expand Down Expand Up @@ -1299,7 +1302,7 @@ ROMClassBuilder::computeExtraModifiers(ClassFileOracle *classFileOracle, ROMClas
if ( classFileOracle->isClassUnmodifiable() ) {
modifiers |= J9AccClassIsUnmodifiable;
}

if (classFileOracle->isValueBased()) {
modifiers |= J9AccClassIsValueBased;
}
Expand Down Expand Up @@ -1486,6 +1489,10 @@ ROMClassBuilder::compareROMClassForEquality(
{
bool ret = false;

if (romClassIsShared) {
extraModifiers |= J9AccClassIsShared;
}

#if JAVA_SPEC_VERSION < 21
if (context->isLambdaClass()) {
/*
Expand All @@ -1495,7 +1502,7 @@ ROMClassBuilder::compareROMClassForEquality(
* between the number of digits of the index number. The same lambda class might have a
* different index number from run to run and when the number of digits of the index number
* increases by 1, classFileSize also increases by 1. The indexNumber is the counter for the number of
* lambda classes defined so far. It is an int in the JCL side. So the it cannot vary more than max
* lambda classes defined so far. It is an int in the JCL side. So the int cannot vary more than max
* integer vs 0, which is maxVariance (9 bytes). This check is different than the romSize check because
* when the number of digits of the index number increases by 1, classFileSize also increases by 1 but
* romSize increases by 2.
Expand Down
1 change: 1 addition & 0 deletions runtime/oti/j9javaaccessflags.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
* See map in ROMClassBuilder::computeExtraModifiers for
* available slots.
*/
#define J9AccClassIsShared 0x20
hangshao0 marked this conversation as resolved.
Show resolved Hide resolved
#define J9AccClassIsValueBased 0x40
#define J9AccClassHiddenOptionNestmate 0x80
#define J9AccClassHiddenOptionStrong 0x100
Expand Down
2 changes: 1 addition & 1 deletion runtime/shared_common/OSCache.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
#define OSCACHE_LOWEST_ACTIVE_GEN 1

/* Always increment this value by 2. For testing we use the (current generation - 1) and expect the cache contents to be compatible. */
#define OSCACHE_CURRENT_CACHE_GEN 43
#define OSCACHE_CURRENT_CACHE_GEN 45
#define OSCACHE_CURRENT_LAYER_LAYER 0

#define J9SH_VERSION(versionMajor, versionMinor) (versionMajor*100 + versionMinor)
Expand Down