-
Notifications
You must be signed in to change notification settings - Fork 722
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
Cache rom to ram mappings for exception backtrace #20169
Conversation
A function to delete entry from the hashtable needs to be added. That function needs to be registered with |
71429c2
to
65ca798
Compare
runtime/shared_common/shrinit.cpp
Outdated
@@ -3509,6 +3525,19 @@ j9shr_init(J9JavaVM *vm, UDATA loadFlags, UDATA* nonfatal) | |||
config->jclURLCache = NULL; | |||
config->jclURLHashTable = NULL; | |||
config->jclUTF8HashTable = NULL; | |||
config->romToRamHashTable = hashTableNew(OMRPORT_FROM_J9PORT(vm->portLibrary), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The hashtable and mutext should be created only when J9_ARE_ALL_BITS_SET(config->runtimeFlags, J9SHR_RUNTIMEFLAG_ENABLE_CACHE_NON_BOOT_CLASSES)
is TRUE.
Also it is better to create the mutex before the hashtable. Access to the mutex and hashtable should be protected by if (NULL != config->romToRamHashTable)
.
11d5e41
to
a3a5d30
Compare
a3a5d30
to
45fbf60
Compare
After addressing the review comments, please create personal builds on platforms where the regression are identified and sent them to the perf team to test. |
1c98baa
to
40619ae
Compare
When the class is redefined/retransformed, the obsolete Lines 2642 to 2644 in 17a3fe8
|
042d776
to
6035c9c
Compare
e95e9dd
to
7ada641
Compare
@theresa-m Could you update the commit message to include some more detail of the change. |
7ada641
to
c9d1a0b
Compare
Create a hash table and access mutex to cache romClass to ramClass mappings from exceptiondescribe.c:findJ9ClassForROMClass. This saves time iterating over multiple class loaders to find a ram class. Entries will be deleted when a class is unloaded or redefined. Signed-off-by: Theresa Mammarella <Theresa.T.Mammarella@ibm.com>
c9d1a0b
to
f41b139
Compare
I added a few more details to the description. |
Jenkins test sanity,extended amac jdk21 |
Jenkins test sanity,extended zlinux jdk11 |
Jenkins test sanity,extended alinux jdk17 |
The failure looks to be related to #20150 |
Please create a PR to back port this change to 0.48. |
0.48 port is here #20195 |
@@ -2641,6 +2642,13 @@ recreateRAMClasses(J9VMThread * currentThread, J9HashTable * classHashTable, J9H | |||
/* Delete original class from defining loader's class table */ | |||
if (!fastHCR) { | |||
vmFuncs->hashClassTableDelete(classLoader, J9UTF8_DATA(className), J9UTF8_LENGTH(className)); | |||
if ((NULL != vm->sharedClassConfig) && (NULL != vm->sharedClassConfig->romToRamHashTable)) { | |||
omrthread_rwmutex_enter_write(vm->sharedClassConfig->romToRamHashTableMutex); | |||
RomToRamEntry entry; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't strictly legal C code: declarations must be at the beginning of a block.
Moving the initialization of entry
before acquiring the mutex also slightly reduces the size of that critical section.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Keith, I will open a pull request to update this.
@@ -4251,6 +4329,16 @@ j9shr_shutdown(J9JavaVM *vm) | |||
if (utfHashTable) { | |||
hashTableFree(utfHashTable); | |||
} | |||
if (NULL != romToRamHashTable) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Talked to @theresa-m, it is possible that the hashtable is freed by another thread after line 4286, so this check and the following if (romToRamHashTable) {
won't work as it is checking the local variable romToRamHashTable
whose value might become stale already.
Create a hash table and access mutex to cache romClass to ramClass mappings from
exceptiondescribe.c:findJ9ClassForROMClass. This saves time iterating over multiple
class loaders to find a ram class. Entries will be deleted when a class
is unloaded or redefined.