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

Support heap memory for ffi CaptureCallState #21197

Merged
merged 1 commit into from
Mar 3, 2025

Conversation

theresa-m
Copy link
Contributor

@theresa-m theresa-m commented Feb 26, 2025

Starting in Java 24 the ffi CaptureCallState and Critical options can be used together. When heap memory use is allowed through the critical option the captured call state should be returned to the given heap memory segment.

Related: #21018
Related: #21019

OpenJDK foreign test suite (failure is related to #21018): https://hyc-runtimes-jenkins.swg-devops.com/view/Test_grinder/job/Grinder/48403/

@theresa-m theresa-m added this to the Java 24 (0.50) milestone Feb 26, 2025
@theresa-m theresa-m marked this pull request as ready for review February 26, 2025 18:30
@tajila tajila requested a review from babsingh February 27, 2025 13:56
@babsingh
Copy link
Contributor

@theresa-m The changes LGTM. Could you please squash the commits?

@theresa-m
Copy link
Contributor Author

@theresa-m The changes LGTM. Could you please squash the commits?

Done.

@babsingh
Copy link
Contributor

jenkins test sanity.functional,sanity.openjdk amac jdk24

@babsingh
Copy link
Contributor

jenkins test sanity.functional,sanity.openjdk zlinux jdk21

@babsingh
Copy link
Contributor

JDK24 builds failed due to an unrelated issue, which has been resolved through #21224. Relaunching the JDK24 builds:

jenkins test sanity.functional,sanity.openjdk amac jdk24

@pshipton
Copy link
Member

Note that Enable off-heap as default on Balanced GC is causing a number of failures in balanced modes.

@babsingh
Copy link
Contributor

https://openj9-jenkins.osuosl.org/job/Test_openjdk24_j9_sanity.functional_aarch64_mac_Personal_testList_0/8/consoleFull

03:06:11  -----------------------------------
03:06:11  Jep454Tests_testLinkerFfi_DownCall_HeapArray_1_FAILED
03:06:11  -----------------------------------
03:06:02  Unhandled exception
03:06:02  Type=Segmentation error vmState=0x00000000
03:06:02  J9Generic_Signal_Number=00000018 Signal_Number=0000000b Error_Value=00000000 Signal_Code=00000002
03:06:02  Handler1=00000001022A1ACC Handler2=00000001025CDE40 InaccessibleAddress=0B0B0B0B0B0B0B0B
03:06:02  x0=000000012D8DF500 x1=000000012D8DF500 x2=0000000000000000 x3=0B0B0B0B0B0B0B0B
03:06:02  x4=0000000107641264 x5=000000016DD4A668 x6=000000016DD4A660 x7=000000016DD4A658
03:06:02  x8=000000010779F418 x9=0000000000000000 x10=00000001022FF818 x11=FFFFFFFFFFFE1BD0
03:06:02  x12=000000016DD4A678 x13=000000016DD4A650 x14=0000000138E91E00 x15=0000000138E91E00
03:06:02  x16=00000001911EE940 x17=00000001FF7FDC70 x18=0000000138AB75F0 x19=000000016DD4A658
03:06:02  x20=0B0B0B0B0B0B0B0B x21=000000028010EC70 x22=000000014053CD34 x23=0000000000000001
03:06:02  x24=000000028010EC60 x25=000000016DD4A650 x26=000000016DD4A6C0 x27=000000016DD4A668
03:06:02  x28=000000014053CD34 x29(FP)=000000016DD4A640 x30(LR)=0000000102322594 x31(SP)=000000016DD4A160
03:06:02  PC=0000000102322598 SP=000000016DD4A160
03:06:02  v0=0101010101010101 (f: 16843008.000000, d: 7.748604e-304)
03:06:02  v1=0b0b0b0b0b0b0b0b (f: 185273104.000000, d: 1.801071e-255)
03:06:02  v2=0b0b0b0b0b0b0b0b (f: 185273104.000000, d: 1.801071e-255)
03:06:02  v3=0b0b0b0b0b0b0b0b (f: 185273104.000000, d: 1.801071e-255)
03:06:02  v4=0b0b0b0b0b0b0b0b (f: 185273104.000000, d: 1.801071e-255)
03:06:02  v5=0000000000000000 (f: 0.000000, d: 0.000000e+00)
03:06:02  v6=40c0000000000000 (f: 0.000000, d: 8.192000e+03)
03:06:02  v7=c0c0000000000000 (f: 0.000000, d: -8.192000e+03)
03:06:02  v8=0000000000000000 (f: 0.000000, d: 0.000000e+00)
03:06:02  v9=0000000000000000 (f: 0.000000, d: 0.000000e+00)
03:06:02  v10=0000000000000000 (f: 0.000000, d: 0.000000e+00)
03:06:02  v11=0000000000000000 (f: 0.000000, d: 0.000000e+00)
03:06:02  v12=0000000000000000 (f: 0.000000, d: 0.000000e+00)
03:06:02  v13=0000000000000000 (f: 0.000000, d: 0.000000e+00)
03:06:02  v14=0000000000000000 (f: 0.000000, d: 0.000000e+00)
03:06:02  v15=0000000000000000 (f: 0.000000, d: 0.000000e+00)
03:06:02  v16=bfd0000000000000 (f: 0.000000, d: -2.500000e-01)
03:06:02  v17=3fd5737383555555 (f: 2203407616.000000, d: 3.351716e-01)
03:06:02  v18=bf7e3aaa77737787 (f: 2004055936.000000, d: -7.380167e-03)
03:06:02  v19=3fe62e42fefa39ef (f: 4277811712.000000, d: 6.931472e-01)
03:06:02  v20=cf5568375c2d25fd (f: 1546462720.000000, d: -1.512922e+74)
03:06:02  v21=f140511a8d00f46b (f: 2365649920.000000, d: -3.320335e+237)
03:06:02  v22=efcdab8967452301 (f: 1732584192.000000, d: -3.598696e+230)
03:06:02  v23=0000000000000000 (f: 0.000000, d: 0.000000e+00)
03:06:02  v24=1466bf6916a9743f (f: 380204096.000000, d: 2.162273e-210)
03:06:02  v25=050345ca066eef02 (f: 107933440.000000, d: 1.620074e-284)
03:06:02  v26=3e5ebc1f3ab05e11 (f: 984636928.000000, d: 2.862406e-08)
03:06:02  v27=0000000000000000 (f: 0.000000, d: 0.000000e+00)
03:06:02  v28=22bcbb1b264fd36c (f: 642765696.000000, d: 2.356085e-141)
03:06:02  v29=03d2f5ba064939ed (f: 105462256.000000, d: 3.039902e-290)
03:06:02  v30=746e692f6b646a4c (f: 1801742976.000000, d: 6.967474e+252)
03:06:02  v31=7461746f6e6e612f (f: 1852727552.000000, d: 3.999097e+252)
03:06:02  Module=/Users/jenkins/workspace/Test_openjdk24_j9_sanity.functional_aarch64_mac_Personal_testList_0/jdkbinary/j2sdk-image/lib/default/libj9vm29.dylib
03:06:02  Module_base_address=000000010227C000 Symbol=_ZN26VM_BytecodeInterpreterFull3runEP10J9VMThread
03:06:02  Symbol_address=00000001022FC0BC
03:06:02  Target=2_90_20250228_21 (Mac OS X 11.7.1)
03:06:02  CPU=aarch64 (8 logical CPUs) (0x400000000 RAM)
03:06:02  ----------- Stack Backtrace -----------
03:06:02  ---------------------------------------
03:06:02  JVMDUMP039I Processing dump event "gpf", detail "" at 2025/02/28 19:06:01 - please wait.
03:06:02  JVMDUMP032I JVM requested System dump using '/Users/jenkins/workspace/Test_openjdk24_j9_sanity.functional_aarch64_mac_Personal_testList_0/aqa-tests/TKG/output_17407282421042/Jep454Tests_testLinkerFfi_DownCall_HeapArray_1/core.20250228.190601.4343.0001.dmp' in response to an event

@babsingh
Copy link
Contributor

https://openj9-jenkins.osuosl.org/job/Test_openjdk24_j9_sanity.openjdk_aarch64_mac_Personal_testList_1/8/consoleFull

03:15:23  TEST: jdk/internal/math/ToDecimal/FloatToDecimalTest.java

03:15:23  STDERR:
03:15:23  Unhandled exception
03:15:23  Type=Segmentation error vmState=0x000514ff
03:15:23  J9Generic_Signal_Number=00000018 Signal_Number=0000000b Error_Value=00000000 Signal_Code=00000002
03:15:23  Handler1=0000000102B41ACC Handler2=00000001029D1E40 InaccessibleAddress=0000000000000010
03:15:23  x0=0000000000000000 x1=0000000000000010 x2=0000000000000000 x3=0000000000000000
03:15:23  x4=00000001041E7D43 x5=0000000134288C00 x6=0000000000000000 x7=0000000000000000
03:15:23  x8=000000010408CA84 x9=000060000077E840 x10=000000000000A1C0 x11=0000000134280000
03:15:23  x12=0000000000000018 x13=00000001041961E0 x14=0000000000000000 x15=0000000000000020
03:15:23  x16=0000000000000000 x17=0000600002B50180 x18=0000000000000000 x19=000000013428A1B0
03:15:23  x20=0000000000000000 x21=0000000000000000 x22=0000000134D57760 x23=0000000000000001
03:15:23  x24=0000000000000000 x25=000000007FFFFFFF x26=00000000FFFFFFFF x27=0000000000000001
03:15:23  x28=0000000000000000 x29(FP)=000000017DC4D8F0 x30(LR)=000000010409791C x31(SP)=000000017DC47A60
03:15:23  PC=0000000104097924 SP=000000017DC47A60
03:15:23  v0=0000000200000001 (f: 1.000000, d: 4.243992e-314)
03:15:23  v1=0000000100000001 (f: 1.000000, d: 2.121996e-314)
03:15:23  v2=0000000000000000 (f: 0.000000, d: 0.000000e+00)
03:15:23  v3=0000000000000000 (f: 0.000000, d: 0.000000e+00)
03:15:23  v4=0000000000000000 (f: 0.000000, d: 0.000000e+00)
03:15:23  v5=0000000000000000 (f: 0.000000, d: 0.000000e+00)
03:15:23  v6=0000000000000000 (f: 0.000000, d: 0.000000e+00)
03:15:23  v7=0000000100000000 (f: 0.000000, d: 2.121996e-314)
03:15:23  v8=0000000000000000 (f: 0.000000, d: 0.000000e+00)
03:15:23  v9=0000000000000000 (f: 0.000000, d: 0.000000e+00)
03:15:23  v10=0000000000000000 (f: 0.000000, d: 0.000000e+00)
03:15:23  v11=0000000000000000 (f: 0.000000, d: 0.000000e+00)
03:15:23  v12=0000000000000000 (f: 0.000000, d: 0.000000e+00)
03:15:23  v13=0000000000000000 (f: 0.000000, d: 0.000000e+00)
03:15:23  v14=0000000000000000 (f: 0.000000, d: 0.000000e+00)
03:15:23  v15=0000000000000000 (f: 0.000000, d: 0.000000e+00)
03:15:23  v16=0000000000000000 (f: 0.000000, d: 0.000000e+00)
03:15:23  v17=0000000000000000 (f: 0.000000, d: 0.000000e+00)
03:15:23  v18=0000000000000000 (f: 0.000000, d: 0.000000e+00)
03:15:23  v19=0000000000000000 (f: 0.000000, d: 0.000000e+00)
03:15:23  v20=ffffffffffffffff (f: 4294967296.000000, d: nan)
03:15:23  v21=ffffffffffffffff (f: 4294967296.000000, d: nan)
03:15:23  v22=ffffffffffffffff (f: 4294967296.000000, d: nan)
03:15:23  v23=ffffffffffffffff (f: 4294967296.000000, d: nan)
03:15:23  v24=0000000000000000 (f: 0.000000, d: 0.000000e+00)
03:15:23  v25=0000000000000000 (f: 0.000000, d: 0.000000e+00)
03:15:23  v26=0000000000000000 (f: 0.000000, d: 0.000000e+00)
03:15:23  v27=0000000000000000 (f: 0.000000, d: 0.000000e+00)
03:15:23  v28=0000000000000000 (f: 0.000000, d: 0.000000e+00)
03:15:23  v29=0000000000000000 (f: 0.000000, d: 0.000000e+00)
03:15:23  v30=0000000000000000 (f: 0.000000, d: 0.000000e+00)
03:15:23  v31=0000000000000000 (f: 0.000000, d: 0.000000e+00)
03:15:23  Module=/Users/jenkins/workspace/Test_openjdk24_j9_sanity.openjdk_aarch64_mac_Personal_testList_1/jdkbinary/j2sdk-image/lib/default/libj9jit29.dylib
03:15:23  Module_base_address=0000000103AD4000 Symbol=_ZN2TR19VPMergedConstraints12intIntersectEPNS_12VPConstraintEP11ListElementIS1_EPN3OMR16ValuePropagationE
03:15:23  Symbol_address=0000000104097850
03:15:23  
03:15:23  Method_being_compiled=jdk/internal/math/ToDecimalChecker.check()Z
03:15:23  Target=2_90_20250228_21 (Mac OS X 13.4.1)
03:15:23  CPU=aarch64 (8 logical CPUs) (0x400000000 RAM)
03:15:23  ----------- Stack Backtrace -----------
03:15:23  ---------------------------------------
03:15:23  JVMDUMP039I Processing dump event "gpf", detail "" at 2025/02/28 19:14:11 - please wait.
03:15:23  JVMDUMP032I JVM requested System dump using '/Users/jenkins/workspace/Test_openjdk24_j9_sanity.openjdk_aarch64_mac_Personal_testList_1/aqa-tests/TKG/output_17407290762301/jdk_lang_j9_1/work/scratch/1/core.20250228.191411.73558.0001.dmp' in response to an event
03:15:23  TEST: jdk/internal/vm/TestTranslatedException.java

03:15:23  STDERR:
03:15:23  Unhandled exception
03:15:23  Type=Segmentation error vmState=0x000514ff
03:15:23  J9Generic_Signal_Number=00000018 Signal_Number=0000000b Error_Value=00000000 Signal_Code=00000002
03:15:23  Handler1=00000001045E1ACC Handler2=0000000104471E40 InaccessibleAddress=0000000000000010
03:15:23  x0=0000000000000000 x1=0000000000000010 x2=0000000000000000 x3=0000000000000000
03:15:23  x4=0000000105C87D43 x5=00000001118D08B8 x6=0000000000000000 x7=00000000000007C0
03:15:23  x8=0000000105B2CA84 x9=00006000033C4740 x10=000000000000EA50 x11=00000001135B0000
03:15:23  x12=00000000F7FFE7FF x13=0000010000000100 x14=0000000105C3A8B2 x15=00000000FFFFFFFF
03:15:23  x16=0000000000000000 x17=0000600001F9C040 x18=0000000000000000 x19=00000001135BEA40
03:15:23  x20=0000000000000000 x21=0000000000000000 x22=0000000112F07880 x23=0000000000000001
03:15:23  x24=0000000000000000 x25=000000007FFFFFFF x26=00000000FFFFFFFF x27=0000000000000001
03:15:23  x28=0000000000000000 x29(FP)=000000016BF958F0 x30(LR)=0000000105B3791C x31(SP)=000000016BF8E4F0
03:15:23  PC=0000000105B37924 SP=000000016BF8E4F0
03:15:23  v0=000000000000000b (f: 11.000000, d: 5.434722e-323)
03:15:23  v1=0706050403020100 (f: 50462976.000000, d: 7.949929e-275)
03:15:23  v2=0000000000000000 (f: 0.000000, d: 0.000000e+00)
03:15:23  v3=0000000200000000 (f: 0.000000, d: 4.243992e-314)
03:15:23  v4=0000000000000000 (f: 0.000000, d: 0.000000e+00)
03:15:23  v5=0000000000000000 (f: 0.000000, d: 0.000000e+00)
03:15:23  v6=0000000000000000 (f: 0.000000, d: 0.000000e+00)
03:15:23  v7=0000000000000000 (f: 0.000000, d: 0.000000e+00)
03:15:23  v8=0000000000000000 (f: 0.000000, d: 0.000000e+00)
03:15:23  v9=0000000000000000 (f: 0.000000, d: 0.000000e+00)
03:15:23  v10=0000000000000000 (f: 0.000000, d: 0.000000e+00)
03:15:23  v11=0000000000000000 (f: 0.000000, d: 0.000000e+00)
03:15:23  v12=0000000000000000 (f: 0.000000, d: 0.000000e+00)
03:15:23  v13=0000000000000000 (f: 0.000000, d: 0.000000e+00)
03:15:23  v14=0000000000000000 (f: 0.000000, d: 0.000000e+00)
03:15:23  v15=0000000000000000 (f: 0.000000, d: 0.000000e+00)
03:15:23  v16=0000000000000000 (f: 0.000000, d: 0.000000e+00)
03:15:23  v17=0000000000000000 (f: 0.000000, d: 0.000000e+00)
03:15:23  v18=0000000000000000 (f: 0.000000, d: 0.000000e+00)
03:15:23  v19=0000000000000000 (f: 0.000000, d: 0.000000e+00)
03:15:23  v20=ffffffffffffffff (f: 4294967296.000000, d: nan)
03:15:23  v21=ffffffffffffffff (f: 4294967296.000000, d: nan)
03:15:23  v22=ffffffffffffffff (f: 4294967296.000000, d: nan)
03:15:23  v23=ffffffffffffffff (f: 4294967296.000000, d: nan)
03:15:23  v24=0000000000000000 (f: 0.000000, d: 0.000000e+00)
03:15:23  v25=0000000000000000 (f: 0.000000, d: 0.000000e+00)
03:15:23  v26=0000000000000000 (f: 0.000000, d: 0.000000e+00)
03:15:23  v27=0000000000000000 (f: 0.000000, d: 0.000000e+00)
03:15:23  v28=0000000000000000 (f: 0.000000, d: 0.000000e+00)
03:15:23  v29=0000000000000000 (f: 0.000000, d: 0.000000e+00)
03:15:23  v30=0000000000000000 (f: 0.000000, d: 0.000000e+00)
03:15:23  v31=0000000000000000 (f: 0.000000, d: 0.000000e+00)
03:15:23  Module=/Users/jenkins/workspace/Test_openjdk24_j9_sanity.openjdk_aarch64_mac_Personal_testList_1/jdkbinary/j2sdk-image/lib/default/libj9jit29.dylib
03:15:23  Module_base_address=0000000105574000 Symbol=_ZN2TR19VPMergedConstraints12intIntersectEPNS_12VPConstraintEP11ListElementIS1_EPN3OMR16ValuePropagationE
03:15:23  Symbol_address=0000000105B37850
03:15:23  
03:15:23  Method_being_compiled=jdk/internal/loader/BuiltinClassLoader.loadClassOrNull(Ljava/lang/String;Z)Ljava/lang/Class;
03:15:23  Target=2_90_20250228_21 (Mac OS X 13.4.1)
03:15:23  CPU=aarch64 (8 logical CPUs) (0x400000000 RAM)
03:15:23  ----------- Stack Backtrace -----------
03:15:23  ---------------------------------------
03:15:23  JVMDUMP039I Processing dump event "gpf", detail "" at 2025/02/28 19:14:41 - please wait.
03:15:23  JVMDUMP032I JVM requested System dump using '/Users/jenkins/workspace/Test_openjdk24_j9_sanity.openjdk_aarch64_mac_Personal_testList_1/aqa-tests/TKG/output_17407290762301/jdk_lang_j9_1/work/scratch/2/core.20250228.191441.73622.0001.dmp' in response to an event

@babsingh
Copy link
Contributor

@theresa-m The failure in #21197 (comment) is related to this PR. The failures in #21197 (comment) are due to off-heap changes (a known issue: #21229).

@dmitripivkine
Copy link
Contributor

Please note off-heap is disabled by default back. It can be enabled for test purposes using -XXgc:enableVirtualLargeObjectHeap effective for -Xgcpolicy:balanced only. If you observed problem I recommend to try -Xint variation to separate VM/GC from JIT related issues.
Also please do not hesitate to ask for help with off-heap mode.

@theresa-m
Copy link
Contributor Author

Thanks. This was passing in my personal build, I'll see what I can reproduce.

@theresa-m
Copy link
Contributor Author

theresa-m commented Feb 28, 2025

It seems that the test fails with -Xint -Xgcpolicy:balanced. It fails regardless of -XXgc:enableVirtualLargeObjectHeap being set.

@theresa-m
Copy link
Contributor Author

theresa-m commented Mar 3, 2025

I think the Jep454Tests_testLinkerFfi_DownCall_HeapArray is caused by the off-heap changes, I misunderstood the options when I tested this on Friday.

In this grinder I retested including the -XXgc:disableVirtualLargeObjectHeap option for variations 1 and 2 and the test passes. https://hyc-runtimes-jenkins.swg-devops.com/view/Test_grinder/job/Grinder/48528/

test changes: theresa-m@357b1ab

edit: I also rebuilt my changes with the latest master branch and the test passes: https://hyc-runtimes-jenkins.swg-devops.com/view/Test_grinder/job/Grinder/48535/

@theresa-m
Copy link
Contributor Author

I rebased my branch with the changes that revert the off-heap by default changes.

previously failing pr build links:
https://openj9-jenkins.osuosl.org/job/Test_openjdk24_j9_sanity.functional_aarch64_mac_Personal/8/
https://openj9-jenkins.osuosl.org/job/Test_openjdk24_j9_sanity.openjdk_aarch64_mac_Personal/8/

Copy link
Contributor

@babsingh babsingh left a comment

Choose a reason for hiding this comment

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

The previous builds and recent grinder runs confirm that these changes are ready for merging.

Previous PR builds:

@babsingh babsingh merged commit 47e00d8 into eclipse-openj9:master Mar 3, 2025
2 checks passed
@babsingh
Copy link
Contributor

babsingh commented Mar 3, 2025

@theresa-m Please backport these changes to the 0.51 release branch.

@theresa-m
Copy link
Contributor Author

Pr for 0.51: #21261

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

Successfully merging this pull request may close these issues.

5 participants