Skip to content

Commit

Permalink
Merge pull request #20696 from nbhuiyan/memsegment-accessors
Browse files Browse the repository at this point in the history
Restrict special handling of MemorySegment methods to only the getters and setters
  • Loading branch information
jdmpapin authored Nov 29, 2024
2 parents 19118bd + 63cae52 commit 3111f29
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion runtime/compiler/env/j9method.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4825,7 +4825,8 @@ void TR_ResolvedJ9Method::construct()
}
else if ((classNameLen == 31) && !strncmp(className, "java/lang/foreign/MemorySegment", 31))
{
setRecognizedMethodInfo(TR::java_lang_foreign_MemorySegment_method);
if (nameLen >= 3 && (!strncmp(name, "get", 3) || !strncmp(name, "set", 3)))
setRecognizedMethodInfo(TR::java_lang_foreign_MemorySegment_method);
}
#endif
else if ((classNameLen >= 59 + 3 && classNameLen <= 59 + 7) && !strncmp(className, "java/lang/invoke/ArrayVarHandle$ArrayVarHandleOperations$Op", 59))
Expand Down
2 changes: 1 addition & 1 deletion runtime/compiler/optimizer/J9EstimateCodeSize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,7 @@ TR_J9EstimateCodeSize::processBytecodeAndGenerateCFG(TR_CallTarget *calltarget,
if (meth)
{
const char * sig = meth->signature(comp()->trMemory());
if (sig && !strncmp(sig, "java/lang/foreign/MemorySegment", 31))
if (sig && (!strncmp(sig, "java/lang/foreign/MemorySegment.get", 35) || !strncmp(sig, "java/lang/foreign/MemorySegment.set", 35) ))
{
nph.setNeedsPeekingToTrue();
heuristicTrace(tracer(), "Depth %d: invokeinterface call at bc index %d has Signature %s, enabled peeking for caller to fold layout field load necessary for VarHandle operation inlining.", _recursionDepth, i, sig);
Expand Down

0 comments on commit 3111f29

Please sign in to comment.