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

Enable peeking ILGen for inlined methods related to java/util/HashMap get/put operations. #21157

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

nbhuiyan
Copy link
Member

To propagate arg info from callers of HashMap.put, HashMap.get, HashMap.hash, Map.get, Map.put and Object.hashCode, generating IL of their callers is necessary when called from an inlined method. This allows us to propagate prex arg info from caller and enable compile-time folding of fastIdentityHashCode calls during Value Propagation.

@nbhuiyan
Copy link
Member Author

@vijaysun-omr Requesting review. These set of changes enable Object.hashCode folding when called from certain inlined methods. This is not the ideal way to do this, but necessary until InterpreterEmulator is capable of iterating with state for all methods. Until then, this will help with Object.hashCode folding related to HashMap operations. Others can easily expand the set of method signatures to trigger the peeking ilgen of the caller methods if necessary.

@@ -748,6 +748,15 @@ TR_J9EstimateCodeSize::processBytecodeAndGenerateCFG(TR_CallTarget *calltarget,
auto calleeMethod = (TR_ResolvedJ9Method*)calltarget->_calleeMethod;
resolvedMethod = calleeMethod->getResolvedPossiblyPrivateVirtualMethod(comp(), cpIndex, true, &isUnresolvedInCP);

if (resolvedMethod)
{
const char * sig = resolvedMethod->signature(comp()->trMemory());
Copy link
Contributor

Choose a reason for hiding this comment

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

Could/should we be using recognized methods here ? as opposed to strncmp ?

@vijaysun-omr
Copy link
Contributor

Do you intend to squash these commits ?

@vijaysun-omr
Copy link
Contributor

jenkins test sanity all JDK21

@nbhuiyan nbhuiyan changed the title Enable peeking ILGen for inlined methods related to java/lang/HashMap get/put operations. Enable peeking ILGen for inlined methods related to java/util/HashMap get/put operations. Feb 21, 2025
@nbhuiyan
Copy link
Member Author

Tests passed on all platforms except x86-64 Windows, related to #21000. Updating the branch to address review comments so the builds will not be accessible from this PR.

@nbhuiyan nbhuiyan force-pushed the class-arg-propagation branch from 1c35232 to f2a5444 Compare February 21, 2025 20:20
@nbhuiyan nbhuiyan requested a review from dsouzai as a code owner February 21, 2025 20:20
if (resolvedMethod)
{
const char * sig = resolvedMethod->signature(comp()->trMemory());
if (sig && !strncmp(sig, "java/util/HashMap.hash", 22))
Copy link
Contributor

Choose a reason for hiding this comment

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

Similar question to before for this spot too. Should/could we be using recognized methods here ? Please check the other strncmp uses that you added as well. At least one of the other ones is only known to be a "method" rather than a "resolved method". So you may not be able to use recognized methods there.

To propagate arg info from callers of HashMap.put, HashMap.get, and
Object.hashCode, generating IL of their callers is necessary when
called from an inlined method. This allows us to propagate prex
arg info from caller and enable compile-time folding of
fastIdentityHashCode calls.

Signed-off-by: Nazim Bhuiyan <[email protected]>
@nbhuiyan nbhuiyan force-pushed the class-arg-propagation branch from f2a5444 to 598658d Compare February 21, 2025 22:28
@vijaysun-omr
Copy link
Contributor

Thanks, I will run testing again, but I don't intend to merge until some performance questions you are investigating are resolved.

@vijaysun-omr
Copy link
Contributor

jenkins test sanity all JDK21

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants