JDK-8334872 : BigEndian: java/lang/invoke/condy Tests failing since JDK-8294960
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang.invoke
  • Affected Version: 24
  • Priority: P2
  • Status: In Progress
  • Resolution: Unresolved
  • OS: generic
  • CPU: ppc
  • Submitted: 2024-06-24
  • Updated: 2024-06-25
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 24
24Unresolved
Related Reports
Relates :  
Description
The following tests are failing since JDK-8294960 on PPC64 big endian platforms (Linux and AIX).
On PPC64 little endian platforms they do succeed.

java/lang/invoke/condy/CondyBSMException.java
java/lang/invoke/condy/BootstrapMethodJumboArgsTest.java
java/lang/invoke/condy/CondyBSMInvocation.java
java/lang/invoke/condy/CondyBSMValidationTest.java
java/lang/invoke/condy/CondyInterfaceWithOverpassMethods.java
java/lang/invoke/condy/CondyTypeValidationTest.java
java/lang/invoke/condy/CondyNameValidationTest.java
java/lang/invoke/condy/CondyNestedTest.java
java/lang/invoke/condy/CondyRepeatFailedResolution.java
java/lang/invoke/condy/CondyReturnPrimitiveTest.java
java/lang/invoke/condy/CondyStaticArgumentsTest.java
java/lang/invoke/condy/CondyWithGarbageTest.java
java/lang/invoke/condy/CondyWrongType.java
java/lang/invoke/condy/ConstantBootstrapsTest.java

They fail because of StackOverflowError.

This is the error when running java/lang/invoke/condy/ConstantBootstrapsTest.java with additional arguments -XX:MaxJavaStackTraceDepth=100k -XX:+ShowHiddenFrames 
(@run testng/othervm -XX:+UnlockDiagnosticVMOptions -XX:UseBootstrapCallInfo=3 -XX:MaxJavaStackTraceDepth=100k -XX:+ShowHiddenFrames ConstantBootstrapsTest)

java.lang.StackOverflowError
	at java.base/java.lang.Math.ceil(Math.java:500)
	at java.base/jdk.internal.classfile.impl.EntryMap.arraySize(EntryMap.java:181)
	at java.base/jdk.internal.classfile.impl.EntryMap.<init>(EntryMap.java:72)
	at java.base/jdk.internal.classfile.impl.SplitConstantPool$2.<init>(SplitConstantPool.java:187)
	at java.base/jdk.internal.classfile.impl.SplitConstantPool.map(SplitConstantPool.java:187)
	at java.base/jdk.internal.classfile.impl.SplitConstantPool.tryFindUtf8(SplitConstantPool.java:330)
	at java.base/jdk.internal.classfile.impl.SplitConstantPool.utf8Entry(SplitConstantPool.java:366)
	at java.base/jdk.internal.classfile.impl.SplitConstantPool.utf8Entry(SplitConstantPool.java:59)
	at java.base/java.lang.classfile.constantpool.ConstantPoolBuilder.classEntry(ConstantPoolBuilder.java:161)
	at java.base/java.lang.classfile.ClassFile.build(ClassFile.java:333)
	at java.base/java.lang.invoke.ClassSpecializer$Factory.generateConcreteSpeciesCodeFile(ClassSpecializer.java:617)
	at java.base/java.lang.invoke.ClassSpecializer$Factory.generateConcreteSpeciesCode(ClassSpecializer.java:578)
	at java.base/java.lang.invoke.ClassSpecializer$Factory.loadSpecies(ClassSpecializer.java:498)
	at java.base/java.lang.invoke.ClassSpecializer.findSpecies(ClassSpecializer.java:202)
	at java.base/java.lang.invoke.BoundMethodHandle$SpeciesData.extendWith(BoundMethodHandle.java:360)
	at java.base/java.lang.invoke.LambdaFormEditor.newSpeciesData(LambdaFormEditor.java:516)
	at java.base/java.lang.invoke.LambdaFormEditor.bindArgumentForm(LambdaFormEditor.java:579)
	at java.base/java.lang.invoke.LambdaFormEditor.bindArgumentL(LambdaFormEditor.java:523)
	at java.base/java.lang.invoke.BoundMethodHandle.bindArgumentL(BoundMethodHandle.java:72)
	at java.base/java.lang.invoke.MethodHandle.bindArgumentL(MethodHandle.java:1713)
Rec N+1	at java.base/java.lang.invoke.MethodHandle.bindTo(MethodHandle.java:1619)
	at java.base/java.lang.invoke.BootstrapMethodInvoker.pushMePullYou(BootstrapMethodInvoker.java:541)
	at java.base/java.lang.invoke.BootstrapMethodInvoker.invoke(BootstrapMethodInvoker.java:76)
	at java.base/java.lang.invoke.CallSite.makeSite(CallSite.java:316)
	at java.base/java.lang.invoke.MethodHandleNatives.linkCallSiteImpl(MethodHandleNatives.java:275)
	at java.base/java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:265)
	at java.base/java.lang.classfile.ClassBuilder.withField(ClassBuilder.java:202)
	at java.base/java.lang.invoke.ClassSpecializer$Factory$1.accept(ClassSpecializer.java:625)
	at java.base/java.lang.invoke.ClassSpecializer$Factory$1.accept(ClassSpecializer.java:617)
	at java.base/jdk.internal.classfile.impl.ClassFileImpl.build(ClassFileImpl.java:113)
	at java.base/java.lang.classfile.ClassFile.build(ClassFile.java:333)
	at java.base/java.lang.invoke.ClassSpecializer$Factory.generateConcreteSpeciesCodeFile(ClassSpecializer.java:617)
	at java.base/java.lang.invoke.ClassSpecializer$Factory.generateConcreteSpeciesCode(ClassSpecializer.java:578)
	at java.base/java.lang.invoke.ClassSpecializer$Factory.loadSpecies(ClassSpecializer.java:498)
	at java.base/java.lang.invoke.ClassSpecializer.findSpecies(ClassSpecializer.java:202)
	at java.base/java.lang.invoke.BoundMethodHandle$SpeciesData.extendWith(BoundMethodHandle.java:360)
	at java.base/java.lang.invoke.LambdaFormEditor.newSpeciesData(LambdaFormEditor.java:516)
	at java.base/java.lang.invoke.LambdaFormEditor.bindArgumentForm(LambdaFormEditor.java:579)
	at java.base/java.lang.invoke.LambdaFormEditor.bindArgumentL(LambdaFormEditor.java:523)
	at java.base/java.lang.invoke.BoundMethodHandle.bindArgumentL(BoundMethodHandle.java:72)
	at java.base/java.lang.invoke.MethodHandle.bindArgumentL(MethodHandle.java:1713)
Rec N	at java.base/java.lang.invoke.MethodHandle.bindTo(MethodHandle.java:1619)
...
...
...
Rec 2	at java.base/java.lang.invoke.MethodHandle.bindTo(MethodHandle.java:1619)
	at java.base/java.lang.invoke.BootstrapMethodInvoker.pushMePullYou(BootstrapMethodInvoker.java:541)
	at java.base/java.lang.invoke.BootstrapMethodInvoker.invoke(BootstrapMethodInvoker.java:76)
	at java.base/java.lang.invoke.CallSite.makeSite(CallSite.java:316)
	at java.base/java.lang.invoke.MethodHandleNatives.linkCallSiteImpl(MethodHandleNatives.java:275)
	at java.base/java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:265)
	at java.base/java.lang.classfile.ClassBuilder.withField(ClassBuilder.java:202)
	at java.base/java.lang.invoke.ClassSpecializer$Factory$1.accept(ClassSpecializer.java:625)
	at java.base/java.lang.invoke.ClassSpecializer$Factory$1.accept(ClassSpecializer.java:617)
	at java.base/jdk.internal.classfile.impl.ClassFileImpl.build(ClassFileImpl.java:113)
	at java.base/java.lang.classfile.ClassFile.build(ClassFile.java:333)
	at java.base/java.lang.invoke.ClassSpecializer$Factory.generateConcreteSpeciesCodeFile(ClassSpecializer.java:617)
	at java.base/java.lang.invoke.ClassSpecializer$Factory.generateConcreteSpeciesCode(ClassSpecializer.java:578)
	at java.base/java.lang.invoke.ClassSpecializer$Factory.loadSpecies(ClassSpecializer.java:498)
	at java.base/java.lang.invoke.ClassSpecializer.findSpecies(ClassSpecializer.java:202)
	at java.base/java.lang.invoke.BoundMethodHandle$SpeciesData.extendWith(BoundMethodHandle.java:360)
	at java.base/java.lang.invoke.LambdaFormEditor.newSpeciesData(LambdaFormEditor.java:516)
	at java.base/java.lang.invoke.LambdaFormEditor.bindArgumentForm(LambdaFormEditor.java:579)
	at java.base/java.lang.invoke.LambdaFormEditor.bindArgumentL(LambdaFormEditor.java:523)
	at java.base/java.lang.invoke.BoundMethodHandle.bindArgumentL(BoundMethodHandle.java:72)
	at java.base/java.lang.invoke.MethodHandle.bindArgumentL(MethodHandle.java:1713)
Rec 1	at java.base/java.lang.invoke.MethodHandle.bindTo(MethodHandle.java:1619)
	at java.base/java.lang.invoke.MethodHandleImpl.makePairwiseConvertByEditor(MethodHandleImpl.java:316)
	at java.base/java.lang.invoke.MethodHandleImpl.makePairwiseConvert(MethodHandleImpl.java:271)
	at java.base/java.lang.invoke.MethodHandleImpl.makePairwiseConvert(MethodHandleImpl.java:388)
	at java.base/java.lang.invoke.MethodHandle.asTypeUncached(MethodHandle.java:905)
	at java.base/java.lang.invoke.MethodHandle.asType(MethodHandle.java:870)
	at java.base/jdk.internal.reflect.MethodHandleAccessorFactory.makeSpecializedTarget(MethodHandleAccessorFactory.java:285)
	at java.base/jdk.internal.reflect.MethodHandleAccessorFactory.getDirectMethod(MethodHandleAccessorFactory.java:221)
	at java.base/jdk.internal.reflect.MethodHandleAccessorFactory.newMethodAccessor(MethodHandleAccessorFactory.java:80)
	at java.base/jdk.internal.reflect.ReflectionFactory.newMethodAccessor(ReflectionFactory.java:154)
	at java.base/java.lang.reflect.Method.acquireMethodAccessor(Method.java:726)
	at java.base/java.lang.reflect.Method.invoke(Method.java:577)
	at com.sun.javatest.regtest.agent.MainWrapper$MainTask.run(MainWrapper.java:138)
	at java.base/java.lang.Thread.runWith(Thread.java:1588)
	at java.base/java.lang.Thread.run(Thread.java:1575)

Comments
A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/19863 Date: 2024-06-24 16:01:41 +0000
24-06-2024

I've prepared a patch in https://github.com/openjdk/jdk/pull/19863 Please test on the affected platforms.
24-06-2024

Yes, I'm aware of that and working on the fix. Unfortunately ClassSpecilizer lambdas have to be desugared to anonymous inner classes.
24-06-2024

[~amitkumar] reported that at least `java/lang/invoke/condy/ConstantBootstrapsTest.java` succeeds on s390x. I can reproduce the issue on AIX and Linux PPC64 (big endian).
24-06-2024

[~asotona] I think this is because we are using LMF in BoundMethodHandle; we assumed there's no dependency in https://github.com/openjdk/jdk/pull/17108#discussion_r1629360525 but turns out for some platforms, invocation of bootstrap methods have a dependency on BoundMethodHandle species generation :(
24-06-2024