Skip to content

Commit

Permalink
Merge pull request #20471 from nbhuiyan/getcallerclass
Browse files Browse the repository at this point in the history
Force inline AbstractMemorySegmentImpl.reinterpret for getCallerClass optimization
  • Loading branch information
0xdaryl authored Nov 5, 2024
2 parents 9377d3f + 2280db2 commit 33c0833
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions runtime/compiler/codegen/J9RecognizedMethodsEnum.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1169,6 +1169,7 @@
java_lang_invoke_VarHandleByteArrayAsX_ByteBufferHandle_method,

jdk_internal_foreign_layout_ValueLayouts_AbstractValueLayout_accessHandle,
jdk_internal_foreign_AbstractMemorySegmentImpl_reinterpret,
java_lang_foreign_MemorySegment_method,

// Clone and Deep Copy
Expand Down
7 changes: 7 additions & 0 deletions runtime/compiler/env/j9method.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4030,6 +4030,12 @@ void TR_ResolvedJ9Method::construct()
{ TR::unknownMethod},
};

static X AbstractMemorySegmentImplMethods [] =
{
{ TR::jdk_internal_foreign_AbstractMemorySegmentImpl_reinterpret, 11, "reinterpret", (int16_t)-1, "*"},
{ TR::unknownMethod},
};

static X ArraysSupportMethods [] =
{
{x(TR::jdk_internal_util_ArraysSupport_vectorizedMismatch, "vectorizedMismatch", "(Ljava/lang/Object;JLjava/lang/Object;JII)I")},
Expand Down Expand Up @@ -4343,6 +4349,7 @@ void TR_ResolvedJ9Method::construct()
{ "java/util/concurrent/atomic/AtomicIntegerArray", JavaUtilConcurrentAtomicIntegerArrayMethods },
{ "java/util/concurrent/ConcurrentHashMap$TreeBin", JavaUtilConcurrentConcurrentHashMapTreeBinMethods },
{ "java/io/ObjectInputStream$BlockDataInputStream", ObjectInputStream_BlockDataInputStreamMethods },
{ "jdk/internal/foreign/AbstractMemorySegmentImpl", AbstractMemorySegmentImplMethods },
{ 0 }
};

Expand Down
3 changes: 3 additions & 0 deletions runtime/compiler/optimizer/InlinerTempForJ9.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,9 @@ TR_J9InlinerPolicy::alwaysWorthInlining(TR_ResolvedMethod * calleeMethod, TR::No
case TR::java_lang_Class_newInstance:
case TR::jdk_internal_util_Preconditions_checkIndex:

// AbstractMemorySegmentImpl.reinterpret methods call Reflection.getCallerClass
case TR::jdk_internal_foreign_AbstractMemorySegmentImpl_reinterpret:

// we rely on inlining compareAndSwap so we see the inner native call and can special case it
case TR::com_ibm_jit_JITHelpers_compareAndSwapIntInObject:
case TR::com_ibm_jit_JITHelpers_compareAndSwapLongInObject:
Expand Down

0 comments on commit 33c0833

Please sign in to comment.