-
Notifications
You must be signed in to change notification settings - Fork 757
Refactor the Deserializer to use a helper struct #22135
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
base: master
Are you sure you want to change the base?
Conversation
@mpirvu could you review? I couldn't think of a better name than |
I suggest I am in the process of reviewing the PR. |
@@ -3031,13 +3031,14 @@ handleServerMessage(JITServer::ClientStream *client, TR_J9VM *fe, JITServer::Mes | |||
if (auto deserializer = compInfo->getJITServerAOTDeserializer()) | |||
{ | |||
bool wasReset = false; | |||
deserializer->cacheRecords((const uint8_t *)recordsStr.data(), recordsStr.size(), comp, | |||
auto helper = DeserializerHelper(comp->j9VMThread(), comp->fej9(), comp->trMemory(), comp); | |||
deserializer->cacheRecords((const uint8_t *)recordsStr.data(), recordsStr.size(), &helper, |
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.
Wouldn't be better for the helper
param to be provided as a const reference?
{ | ||
++_numDeserializationFailures; | ||
|
||
if (TR::Options::getVerboseOption(TR_VerboseJITServer)) | ||
TR_VerboseLog::writeLineLocked(TR_Vlog_JITServer, | ||
"ERROR: Failed to deserialize AOT method %s%s", | ||
comp->signature(), wasReset ? " due to concurrent deserializer reset" : "" | ||
helper->_comp->signature(), wasReset ? " due to concurrent deserializer reset" : "" |
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.
In the new world _comp
may not exist if I understood correctly the purpose of this commit. Then we must take that into account and test for it.
|
||
if (TR::Options::getVerboseOption(TR_VerboseJITServer)) | ||
TR_VerboseLog::writeLineLocked(TR_Vlog_JITServer, "Deserialized AOT method %s", comp->signature()); | ||
TR_VerboseLog::writeLineLocked(TR_Vlog_JITServer, "Deserialized AOT method %s", helper->_comp->signature()); |
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.
_comp
may not exist.
auto fej9vm = comp->fej9vm(); | ||
void *thunk = fej9vm->getJ2IThunk((char *)record->signature(), record->signatureSize(), comp); | ||
auto fej9vm = helper->_fej9; | ||
void *thunk = fej9vm->getJ2IThunk((char *)record->signature(), record->signatureSize(), helper->_comp); |
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.
Can _comp
be NULL?
@@ -1223,7 +1223,7 @@ JITServerLocalSCCAOTDeserializer::updateSCCOffsets(SerializedAOTMethod *method, | |||
"Invalid TR_AOTMethodHeader version: %d.%d", header->majorVersion, header->minorVersion); | |||
TR_ASSERT_FATAL((header->offsetToRelocationDataItems != 0) || (method->numRecords() == 0), | |||
"Unexpected %zu serialization records in serialized method %s with no relocation data", | |||
method->numRecords(), comp->signature()); | |||
method->numRecords(), helper->_comp->signature()); |
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.
Can _comp
be NULL?
if (wasReset) | ||
comp->failCompilation<J9::AOTDeserializerReset>("Deserializer reset during relocation of method %s", | ||
comp->signature()); | ||
helper->_comp->failCompilation<J9::AOTDeserializerReset>("Deserializer reset during relocation of method %s", |
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.
Can _comp
be NULL? Similar question for other places.
Thinking more about this one: deep inside the deserializer routines it may be hard to determine whether the comp object is valid or not. Maybe the routines that that will be accessed from a non-compilation threads should have a DeserializerContext as parameter and everything else should have a comp object. |
05ebeac
to
75e7a80
Compare
Updated in force push.
It turns out that most of the comp object accesses were just for the signature. There were only two places that required the comp object, and both scenarios do not make sense outside of a compilation (related to thunk serialization and generated class). So I just put
Ah missed this; yeah I can make the update. |
It's also really hard to know which routines are accessed by a non-comp thread because there are so many helper routines; also the fact that there's more than one type of deserializer really complicates matters. |
75e7a80
to
5e18e8d
Compare
Updated in force push. |
Converted to draft because I accidentally modified code unrelated to this PR (in trying to convert |
To faciltate a non-compilation thread invoking the deserializer, which can happen outside the context of a compilation, the APIs in the Deserializer need to be updated to no longer require a TR::Compilation object directly. Signed-off-by: Irwin D'Souza <dsouzai.gh@gmail.com>
5e18e8d
to
026876d
Compare
Ok, good for review again. |
To faciltate a non-compilation thread invoking the deserializer, which can happen outside the context of a compilation, the APIs in the Deserializer need to be updated to no longer require a TR::Compilation object directly.