@@ -1864,89 +1864,107 @@ jvmtiInternalGetStackTraceExtended(jvmtiEnv* env,
1864
1864
1865
1865
1866
1866
static UDATA
1867
- jvmtiInternalGetStackTraceIteratorExtended (J9VMThread * currentThread , J9StackWalkState * walkState )
1867
+ jvmtiInternalGetStackTraceIteratorExtended (J9VMThread * currentThread , J9StackWalkState * walkState )
1868
1868
{
1869
- J9JVMTIStackTraceType type ;
1870
- jmethodID methodID ;
1871
- jvmtiFrameInfoExtended * frame_buffer ;
1872
- UDATA frameCount ;
1869
+ jmethodID methodID = NULL ;
1870
+ jvmtiFrameInfoExtended * frame_buffer = NULL ;
1871
+ UDATA frameCount = 0 ;
1872
+ J9JVMTIStackTraceType type = (J9JVMTIStackTraceType )(UDATA )walkState -> userData2 ;
1873
+ J9Method * method = walkState -> method ;
1873
1874
1874
- /* In extra info mode when method enter is enabled, exclude natives which have not had method enter reported for them */
1875
+ #if JAVA_SPEC_VERSION >= 20
1876
+ J9ROMMethod * romMethod = NULL ;
1877
+ U_32 extendedModifiers = 0 ;
1875
1878
1876
- type = (J9JVMTIStackTraceType ) (UDATA ) walkState -> userData2 ;
1877
- if (type & J9JVMTI_STACK_TRACE_PRUNE_UNREPORTED_METHODS ) {
1878
- if ((UDATA )walkState -> pc == J9SF_FRAME_TYPE_NATIVE_METHOD ) {
1879
- /* INL natives never have enter/exit reported */
1879
+ /* walkState->method can never be NULL since the J9_STACKWALK_VISIBLE_ONLY flag is set. */
1880
+ Assert_JVMTI_true (NULL != method );
1881
+
1882
+ romMethod = J9_ROM_METHOD_FROM_RAM_METHOD (method );
1883
+ extendedModifiers = getExtendedModifiersDataFromROMMethod (romMethod );
1884
+
1885
+ if (J9_ARE_ANY_BITS_SET (extendedModifiers , CFR_METHOD_EXT_JVMTIMOUNTTRANSITION_ANNOTATION )) {
1886
+ goto skip ;
1887
+ }
1888
+ #endif /* JAVA_SPEC_VERSION >= 20 */
1889
+
1890
+ /* In extra info mode when method enter is enabled, exclude natives which have not had method enter reported for them. */
1891
+ if (J9_ARE_ANY_BITS_SET (type , J9JVMTI_STACK_TRACE_PRUNE_UNREPORTED_METHODS )) {
1892
+ if (J9SF_FRAME_TYPE_NATIVE_METHOD == (UDATA )walkState -> pc ) {
1893
+ /* INL natives never have enter/exit reported. */
1880
1894
return J9_STACKWALK_KEEP_ITERATING ;
1881
1895
}
1882
1896
#if defined(J9VM_INTERP_NATIVE_SUPPORT )
1883
- if ((UDATA )walkState -> pc == J9SF_FRAME_TYPE_JNI_NATIVE_METHOD ) {
1884
- if (walkState -> frameFlags & J9_STACK_FLAGS_JIT_JNI_CALL_OUT_FRAME ) {
1885
- /* Direct JNI inlined into JIT method */
1897
+ if (J9SF_FRAME_TYPE_JNI_NATIVE_METHOD == (UDATA )walkState -> pc ) {
1898
+ if (J9_ARE_ANY_BITS_SET ( walkState -> frameFlags , J9_STACK_FLAGS_JIT_JNI_CALL_OUT_FRAME ) ) {
1899
+ /* Direct JNI inlined into JIT method. */
1886
1900
return J9_STACKWALK_KEEP_ITERATING ;
1887
1901
}
1888
1902
}
1889
- /* Direct JNI thunks (method is native, jitInfo != NULL) do have enter/exit reported */
1890
- #endif
1903
+ /* Direct JNI thunks (method is native, jitInfo != NULL) do have enter/exit reported. */
1904
+ #endif /* defined(J9VM_INTERP_NATIVE_SUPPORT) */
1891
1905
}
1892
1906
1893
1907
frame_buffer = walkState -> userData1 ;
1894
- if (frame_buffer != NULL ) {
1895
- methodID = getCurrentMethodID (currentThread , walkState -> method );
1896
- if (methodID == NULL ) {
1908
+ if (NULL != frame_buffer ) {
1909
+ methodID = getCurrentMethodID (currentThread , method );
1910
+ if (NULL == methodID ) {
1897
1911
walkState -> userData1 = NULL ;
1898
1912
return J9_STACKWALK_STOP_ITERATING ;
1899
1913
}
1900
1914
1901
1915
frame_buffer -> method = methodID ;
1902
1916
1903
- if (type & J9JVMTI_STACK_TRACE_EXTRA_FRAME_INFO ) {
1904
- /* Fill in the extended data */
1905
- #ifdef J9VM_INTERP_NATIVE_SUPPORT
1906
- if (walkState -> jitInfo == NULL ) {
1917
+ if (J9_ARE_ANY_BITS_SET ( type , J9JVMTI_STACK_TRACE_EXTRA_FRAME_INFO ) ) {
1918
+ /* Fill in the extended data. */
1919
+ #if defined( J9VM_INTERP_NATIVE_SUPPORT )
1920
+ if (NULL == walkState -> jitInfo ) {
1907
1921
frame_buffer -> type = COM_IBM_STACK_FRAME_EXTENDED_NOT_JITTED ;
1908
1922
} else if (J9_ARE_ANY_BITS_SET (type , J9JVMTI_STACK_TRACE_MARK_INLINED_FRAMES ) && (walkState -> inlineDepth > 0 )) {
1909
1923
frame_buffer -> type = COM_IBM_STACK_FRAME_EXTENDED_INLINED ;
1910
1924
} else {
1911
1925
frame_buffer -> type = COM_IBM_STACK_FRAME_EXTENDED_JITTED ;
1912
1926
}
1913
- #else
1927
+ #else /* defined(J9VM_INTERP_NATIVE_SUPPORT) */
1914
1928
frame_buffer -> type = COM_IBM_STACK_FRAME_EXTENDED_NOT_JITTED ;
1915
- #endif
1929
+ #endif /* defined(J9VM_INTERP_NATIVE_SUPPORT) */
1916
1930
frame_buffer -> machinepc = -1 ; /* not supported yet */
1917
- }
1931
+ }
1918
1932
1919
- if (type & J9JVMTI_STACK_TRACE_ENTRY_LOCAL_STORAGE ) {
1920
- #ifdef J9VM_INTERP_NATIVE_SUPPORT
1921
- if ((jlocation ) walkState -> bytecodePCOffset == -1 ) {
1922
- frame_buffer -> nativeFrameAddress = (void * ) walkState -> walkedEntryLocalStorage ;
1933
+ if (J9_ARE_ANY_BITS_SET ( type , J9JVMTI_STACK_TRACE_ENTRY_LOCAL_STORAGE ) ) {
1934
+ #if defined( J9VM_INTERP_NATIVE_SUPPORT )
1935
+ if (-1 == (jlocation )walkState -> bytecodePCOffset ) {
1936
+ frame_buffer -> nativeFrameAddress = (void * )walkState -> walkedEntryLocalStorage ;
1923
1937
} else {
1924
1938
frame_buffer -> nativeFrameAddress = NULL ;
1925
1939
}
1926
- #else
1940
+ #else /* defined(J9VM_INTERP_NATIVE_SUPPORT) */
1927
1941
frame_buffer -> nativeFrameAddress = NULL ;
1928
- #endif
1942
+ #endif /* defined(J9VM_INTERP_NATIVE_SUPPORT) */
1929
1943
}
1930
1944
1931
- /* The location = -1 for native method case is handled in the stack walker */
1932
- frame_buffer -> location = (jlocation ) walkState -> bytecodePCOffset ;
1945
+ /* The location = -1 for native method case is handled in the stack walker. */
1946
+ frame_buffer -> location = (jlocation )walkState -> bytecodePCOffset ;
1933
1947
1934
- /* If the location specifies a JBinvokeinterface, back it up to the JBinvokeinterface2 */
1948
+ /* If the location specifies a JBinvokeinterface, back it up to the JBinvokeinterface2. */
1935
1949
if (!IS_SPECIAL_FRAME_PC (walkState -> pc )) {
1936
- if (* (walkState -> pc ) == JBinvokeinterface ) {
1950
+ if (JBinvokeinterface == * (walkState -> pc )) {
1937
1951
frame_buffer -> location -= 2 ;
1938
1952
}
1939
1953
}
1940
1954
1941
1955
walkState -> userData1 = frame_buffer + 1 ;
1942
1956
}
1943
1957
1944
- frameCount = (UDATA ) walkState -> userData3 ;
1958
+ frameCount = (UDATA )walkState -> userData3 ;
1945
1959
++ frameCount ;
1946
- walkState -> userData3 = (void * ) frameCount ;
1947
- if (frameCount == (UDATA ) walkState -> userData4 ) {
1960
+ walkState -> userData3 = (void * )frameCount ;
1961
+ if (frameCount == (UDATA )walkState -> userData4 ) {
1948
1962
return J9_STACKWALK_STOP_ITERATING ;
1949
1963
}
1964
+
1965
+ #if JAVA_SPEC_VERSION >= 20
1966
+ skip :
1967
+ #endif /* JAVA_SPEC_VERSION >= 20 */
1950
1968
return J9_STACKWALK_KEEP_ITERATING ;
1951
1969
}
1952
1970
0 commit comments