Skip to content

Add storage, retrieval of AOT method dependencies #20581

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

Merged
merged 1 commit into from
Nov 15, 2024

Conversation

cjjdespres
Copy link
Contributor

When the dependencies of compiled AOT method bodies are tracked, they will be stored in the SCC as arrays of uintptr_t values, with the first entry being the length of the array, and the subsequent entries being encoded class chain offsets. The low bit of the class chain offset will be cleared if the corresponding class merely needs to be loaded before the compiled method body in the SCC can be loaded.

This infrastructure is currently unused.

Related: #20529

@cjjdespres cjjdespres requested a review from dsouzai as a code owner November 12, 2024 17:42
@cjjdespres
Copy link
Contributor Author

Attn @mpirvu. This is just the dependency storage/retrieval implementation. I've mentioned before that I was storing the offset to the dependencies next to the well-known classes offset, in the relocation record header. That happens starting here. While I was doing that previously, I believe this conflicts with AOT method compression in the SCC - I'd have to decompress the stored data just to read off the offset, because the relocation records are compressed as well. I've chosen not to store the dependency offset in the compiled body at all, and instead look up the dependencies by key when I need them.

Alternatively, I could store the dependency chain offset in the AOT method header itself.

@mpirvu mpirvu self-assigned this Nov 12, 2024
cursor += dependencyKeyPrefixLength;

convertUnsignedOffsetToASCII(offset, cursor);
keyLength = (cursor - buffer) + _numDigitsForCacheOffsets + 1; // NULL terminator not included in _numDigitsForCacheOffsets
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the keyLength includes the NULL terminator

* The dependencies of an AOT method are encoded as an array of uintptr_t values. The first entry is the number
* of elements in the entire array. The subsequent entries are encoded offsets to the class chains of classes that
* need to be loaded or initialized before the compiled body can be loaded. The entry will be the offset itself
* if the class must be initialized, and it will be (offset & ~1) if the class only needs to be loaded.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand the comment. Do you erase the last bit or set the last bit?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I erase the last bit. Class chain offsets always have their last bit set. I've clarified.

@cjjdespres cjjdespres force-pushed the dep-compilations branch 2 times, most recently from b39688a to 62f91cc Compare November 14, 2024 14:40
@mpirvu
Copy link
Contributor

mpirvu commented Nov 14, 2024

jenkins compile all jdk21

@cjjdespres
Copy link
Contributor Author

One build error:

09:53:43  /Users/jenkins/workspace/Build_JDK21_aarch64_mac_Personal/openj9/runtime/compiler/env/J9SharedCache.cpp:1599:23: error: incomplete type 'TR::CompilationInfoPerThreadBase' named in nested name specifier
09:53:43     auto aotBody = TR::CompilationInfoPerThreadBase::findAotBodyInSCC(vmThread, method);
09:53:43                    ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
09:53:43  /Users/jenkins/workspace/Build_JDK21_aarch64_mac_Personal/openj9/runtime/compiler/control/MethodToBeCompiled.hpp:44:22: note: forward declaration of 'TR::CompilationInfoPerThreadBase'
09:53:43  namespace TR { class CompilationInfoPerThreadBase; }

The imports must be slightly different on aarch64_mac.

@cjjdespres
Copy link
Contributor Author

I think CompilationThread.hpp was brought in by one of the includes guarded by J9VM_OPT_JITSERVER. Hopefully fixed.

When the dependencies of compiled AOT method bodies are tracked, they
will be stored in the SCC as arrays of uintptr_t values, with the first
entry being the length of the array, and the subsequent entries being
encoded class chain offsets. The low bit of the class chain offset will
be cleared if the corresponding class merely needs to be loaded before
the compiled method body in the SCC can be loaded.

This infrastructure is currently unused.

Signed-off-by: Christian Despres <[email protected]>
@mpirvu
Copy link
Contributor

mpirvu commented Nov 14, 2024

jenkins compile all jdk21

@mpirvu
Copy link
Contributor

mpirvu commented Nov 15, 2024

The new code is not executed, so compile tests are sufficient.

@mpirvu mpirvu merged commit bbf6b05 into eclipse-openj9:master Nov 15, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants