Skip to content

Commit

Permalink
Store LambdaForms into the SCC
Browse files Browse the repository at this point in the history
Signed-off-by: Irwin D'Souza <[email protected]>
  • Loading branch information
dsouzai committed Nov 6, 2024
1 parent d963ff8 commit f371299
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
8 changes: 7 additions & 1 deletion runtime/bcutil/ROMClassBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,14 @@ ROMClassBuilder::handleAnonClassName(J9CfrClassFile *classfile, ROMClassCreation
* Performance can be much worse (compared to shared cache turned off).
*/
if (isLambdaFormClassName(originalStringBytes, originalStringLength, NULL/*deterministicPrefixLength*/)) {
context->addFindClassFlags(J9_FINDCLASS_FLAG_DO_NOT_SHARE);
context->addFindClassFlags(J9_FINDCLASS_FLAG_LAMBDAFORM);
#if defined(J9VM_OPT_SHARED_CLASSES)
if ((NULL != _javaVM) && (NULL != _javaVM->sharedClassConfig)) {
if (J9_ARE_NO_BITS_SET(_javaVM->sharedClassConfig->runtimeFlags2, J9SHR_RUNTIMEFLAG2_SHARE_LAMBDAFORM)) {
context->addFindClassFlags(J9_FINDCLASS_FLAG_DO_NOT_SHARE);
}
}
#endif /* defined(J9VM_OPT_SHARED_CLASSES) */
}

#if JAVA_SPEC_VERSION >= 15
Expand Down
1 change: 1 addition & 0 deletions runtime/oti/shcflags.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@
#define J9SHR_RUNTIMEFLAG2_ENABLE_CACHEORPHAN 1
#define J9SHR_RUNTIMEFLAG2_TEST_DOUBLE_PAGESIZE 2
#define J9SHR_RUNTIMEFLAG2_TEST_HALF_PAGESIZE 4
#define J9SHR_RUNTIMEFLAG2_SHARE_LAMBDAFORM 8

#define J9SHR_VERBOSEFLAG_ENABLE_VERBOSE_DEFAULT 1
#define J9SHR_VERBOSEFLAG_ENABLE_VERBOSE 2
Expand Down
13 changes: 7 additions & 6 deletions runtime/shared_common/shrinit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,7 @@ J9SharedClassesOptions J9SHAREDCLASSESOPTIONS[] = {
{ OPTION_TEST_DOUBLE_PAGESIZE, PARSE_TYPE_EXACT, RESULT_DO_ADD_RUNTIMEFLAG2, J9SHR_RUNTIMEFLAG2_TEST_DOUBLE_PAGESIZE},
{ OPTION_TEST_HALF_PAGESIZE, PARSE_TYPE_EXACT, RESULT_DO_ADD_RUNTIMEFLAG2, J9SHR_RUNTIMEFLAG2_TEST_HALF_PAGESIZE},
{ OPTION_EXTRA_STARTUPHINTS_EQUALS, PARSE_TYPE_STARTSWITH, RESULT_DO_SET_EXTRA_STARTUPHINTS, 0},
{ OPTION_SHARE_LAMBDAFORM, PARSE_TYPE_EXACT, RESULT_DO_ADD_RUNTIMEFLAG2, J9SHR_RUNTIMEFLAG2_SHARE_LAMBDAFORM},
{ NULL, 0, 0 }
};

Expand Down Expand Up @@ -1278,7 +1279,7 @@ j9shr_dump_help(J9JavaVM* vm, UDATA more)

tmpcstr = j9nls_lookup_message((J9NLS_INFO | J9NLS_DO_NOT_PRINT_MESSAGE_TAG), J9NLS_EXELIB_INTERNAL_HELP_XXDISABLESHAREUNSAFECLASSES, NULL);
j9file_printf(PORTLIB, J9PORT_TTY_OUT, "%s", tmpcstr);

tmpcstr = j9nls_lookup_message((J9NLS_INFO | J9NLS_DO_NOT_PRINT_MESSAGE_TAG), J9NLS_EXELIB_INTERNAL_HELP_XXENABLESHAREORPAH, NULL);
j9file_printf(PORTLIB, J9PORT_TTY_OUT, "%s", tmpcstr);

Expand Down Expand Up @@ -1374,7 +1375,7 @@ void
registerStoreFilter(J9JavaVM* vm, J9ClassLoader* classloader, const char* fixedName, UDATA fixedNameSize, J9Pool** filterPoolPtr)
{
PORT_ACCESS_FROM_JAVAVM(vm);

Trc_SHR_Assert_ShouldHaveLocalMutex(vm->classMemorySegments->segmentMutex);

if (*filterPoolPtr == NULL) {
Expand Down Expand Up @@ -2448,13 +2449,13 @@ reportUtilityNotApplicable(J9JavaVM* vm, const char* ctrlDirName, const char* ca
static void j9shr_printStats_dump_help(J9JavaVM* vm, bool moreHelp, UDATA command)
{
PORT_ACCESS_FROM_JAVAVM(vm);

const char* option = OPTION_PRINTSTATS_EQUALS;
if (RESULT_DO_PRINTALLSTATS_EQUALS == command) {
option = OPTION_PRINTALLSTATS_EQUALS;
} else if (RESULT_DO_PRINT_TOP_LAYER_STATS_EQUALS == command) {
option = OPTION_PRINT_TOP_LAYER_STATS_EQUALS;
}
}

SHRINIT_TRACE2_NOTAG(1, J9NLS_SHRC_SHRINIT_HELPTEXT_PRINTSTATS_HELP_V1, option, option);

Expand Down Expand Up @@ -4058,7 +4059,7 @@ j9shr_getCacheSizeBytes(J9JavaVM *vm)
* @param [in] vm Pointer to the VM structure for the JVM
*
* @return J9SharedClassCacheMode enum that indicates the Shared Class Cache that is in effect
*
*
*/
J9SharedClassCacheMode
j9shr_getSharedClassCacheMode(J9JavaVM *vm)
Expand Down Expand Up @@ -4457,7 +4458,7 @@ getDefaultRuntimeFlags(void)
J9SHR_RUNTIMEFLAG_ENABLE_TIMESTAMP_CHECKS |
J9SHR_RUNTIMEFLAG_ENABLE_REDUCE_STORE_CONTENTION |
J9SHR_RUNTIMEFLAG_ENABLE_SHAREANONYMOUSCLASSES |
J9SHR_RUNTIMEFLAG_ENABLE_SHAREUNSAFECLASSES |
J9SHR_RUNTIMEFLAG_ENABLE_SHAREUNSAFECLASSES |
J9SHR_RUNTIMEFLAG_ENABLE_ROUND_TO_PAGE_SIZE |
J9SHR_RUNTIMEFLAG_ENABLE_MPROTECT |
#if !defined(J9ZOS390) && !defined(AIXPPC)
Expand Down
1 change: 1 addition & 0 deletions runtime/shared_common/shrinit.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ typedef struct J9SharedClassesOptions {
#define OPTION_TEST_DOUBLE_PAGESIZE "testDoublePageSize"
#define OPTION_TEST_HALF_PAGESIZE "testHalfPageSize"
#define OPTION_EXTRA_STARTUPHINTS_EQUALS "extraStartupHints="
#define OPTION_SHARE_LAMBDAFORM "shareLambdaForm" /* internal option for dev/testing */

/* public options for printallstats= and printstats= */
#define SUB_OPTION_PRINTSTATS_ALL "all"
Expand Down

0 comments on commit f371299

Please sign in to comment.