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

Passing --strict-image-heap causes bytecode parse exception with Kotlin #7483

Closed
sgammon opened this issue Sep 23, 2023 · 2 comments
Closed
Assignees

Comments

@sgammon
Copy link

sgammon commented Sep 23, 2023

Describe the issue
Using the latest release of GraalVM, passing --strict-image-heap causes an exception at build time

Steps to reproduce the issue
Please include both build steps as well as run steps

  1. git clone https://github.com/elide-dev/elide.git
  2. Open the file packages/cli/build.gradle.kts, change enableStrictHeap to true (line ~110)
  3. Build with ./gradlew :packages:cli:nativeCompile

Describe GraalVM and your environment:

  • GraalVM version: GraalVM 21+35.1 (build 21+35-jvmci-23.1-b15)
  • JDK major version: 21
  • OS: macOS Ventura 13.5.1
  • Architecture: aarch64 (M2)
Error: java.util.concurrent.ExecutionException: org.graalvm.compiler.debug.GraalError: org.graalvm.compiler.java.BytecodeParser$BytecodeParserError: com.oracle.svm.core.util.VMError$HostedError: Boolean option value can be only + or -
        at parsing kotlin.jvm.internal.MutablePropertyReference1Impl.<init>(MutablePropertyReference1Impl.java:24)
com.oracle.graal.pointsto.util.AnalysisError: java.util.concurrent.ExecutionException: org.graalvm.compiler.debug.GraalError: org.graalvm.compiler.java.BytecodeParser$BytecodeParserError: com.oracle.svm.core.util.VMError$HostedError: Boolean option value can be only + or -
        at parsing kotlin.jvm.internal.MutablePropertyReference1Impl.<init>(MutablePropertyReference1Impl.java:24)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.AnalysisError.shouldNotReachHere(AnalysisError.java:169)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.AnalysisFuture.ensureDone(AnalysisFuture.java:66)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.AnalysisType.getOrComputeData(AnalysisType.java:691)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.heap.ImageHeapScanner.onFieldRead(ImageHeapScanner.java:125)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.AnalysisField.registerAsAccessed(AnalysisField.java:269)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.AnalysisField.registerAsUnsafeAccessed(AnalysisField.java:327)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.AnalysisField.registerAsUnsafeAccessed(AnalysisField.java:322)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.reflect.ReflectionDataBuilder.registerTypesForField(ReflectionDataBuilder.java:638)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.reflect.ReflectionDataBuilder.registerField(ReflectionDataBuilder.java:444)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.reflect.ReflectionDataBuilder.lambda$registerInternal$31(ReflectionDataBuilder.java:407)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.CompletionExecutor.executeCommand(CompletionExecutor.java:187)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.CompletionExecutor.lambda$executeService$0(CompletionExecutor.java:171)
        at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1423)
        at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:387)
        at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1312)
        at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1843)
        at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1808)
        at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:188)
Caused by: java.util.concurrent.ExecutionException: org.graalvm.compiler.debug.GraalError: org.graalvm.compiler.java.BytecodeParser$BytecodeParserError: com.oracle.svm.core.util.VMError$HostedError: Boolean option value can be only + or -
        at parsing kotlin.jvm.internal.MutablePropertyReference1Impl.<init>(MutablePropertyReference1Impl.java:24)
        at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
        at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.AnalysisFuture.ensureDone(AnalysisFuture.java:64)
        ... 16 more
Caused by: org.graalvm.compiler.debug.GraalError: org.graalvm.compiler.java.BytecodeParser$BytecodeParserError: com.oracle.svm.core.util.VMError$HostedError: Boolean option value can be only + or -
        at parsing kotlin.jvm.internal.MutablePropertyReference1Impl.<init>(MutablePropertyReference1Impl.java:24)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.AnalysisFuture.setException(AnalysisFuture.java:49)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:322)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.AnalysisFuture.ensureDone(AnalysisFuture.java:63)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.ameta.AnalysisConstantReflectionProvider.readSimulatedValue(AnalysisConstantReflectionProvider.java:252)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.ameta.AnalysisConstantReflectionProvider.readHostedFieldValue(AnalysisConstantReflectionProvider.java:214)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.heap.SVMImageHeapScanner.readHostedFieldValue(SVMImageHeapScanner.java:124)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.heap.ImageHeapScanner.computeTypeData(ImageHeapScanner.java:166)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.AnalysisType.lambda$new$2(AnalysisType.java:314)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.AnalysisFuture.ensureDone(AnalysisFuture.java:63)
        ... 16 more
Caused by: org.graalvm.compiler.java.BytecodeParser$BytecodeParserError: com.oracle.svm.core.util.VMError$HostedError: Boolean option value can be only + or -
        at parsing kotlin.jvm.internal.MutablePropertyReference1Impl.<init>(MutablePropertyReference1Impl.java:24)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.throwParserError(BytecodeParser.java:2558)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.throwParserError(SharedGraphBuilderPhase.java:181)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.iterateBytecodesForBlock(BytecodeParser.java:3439)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.iterateBytecodesForBlock(SharedGraphBuilderPhase.java:741)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.handleBytecodeBlock(BytecodeParser.java:3391)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.processBlock(BytecodeParser.java:3233)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.build(BytecodeParser.java:1137)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.build(SharedGraphBuilderPhase.java:161)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.buildRootMethod(BytecodeParser.java:1029)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.GraphBuilderPhase$Instance.run(GraphBuilderPhase.java:101)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase.run(SharedGraphBuilderPhase.java:115)
        at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.run(Phase.java:49)
        at jdk.internal.vm.compiler/org.graalvm.compiler.phases.BasePhase.apply(BasePhase.java:434)
        at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.apply(Phase.java:42)
        at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.apply(Phase.java:38)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.AnalysisParsedGraph.parseBytecode(AnalysisParsedGraph.java:146)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.AnalysisMethod.parseGraph(AnalysisMethod.java:895)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.AnalysisMethod.ensureGraphParsedHelper(AnalysisMethod.java:860)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.AnalysisMethod.ensureGraphParsed(AnalysisMethod.java:843)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.phases.InlineBeforeAnalysisGraphDecoder.lookupEncodedGraph(InlineBeforeAnalysisGraphDecoder.java:175)
        at jdk.internal.vm.compiler/org.graalvm.compiler.replacements.PEGraphDecoder.doInline(PEGraphDecoder.java:1211)
        at jdk.internal.vm.compiler/org.graalvm.compiler.replacements.PEGraphDecoder.tryInline(PEGraphDecoder.java:1194)
        at jdk.internal.vm.compiler/org.graalvm.compiler.replacements.PEGraphDecoder.trySimplifyInvoke(PEGraphDecoder.java:1049)
        at jdk.internal.vm.compiler/org.graalvm.compiler.replacements.PEGraphDecoder.handleInvokeWithCallTarget(PEGraphDecoder.java:1001)
        at jdk.internal.vm.compiler/org.graalvm.compiler.replacements.PEGraphDecoder.handleInvoke(PEGraphDecoder.java:987)
        at jdk.internal.vm.compiler/org.graalvm.compiler.nodes.GraphDecoder.processNextNode(GraphDecoder.java:921)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.phases.InlineBeforeAnalysisGraphDecoder.processNextNode(InlineBeforeAnalysisGraphDecoder.java:344)
        at jdk.internal.vm.compiler/org.graalvm.compiler.nodes.GraphDecoder.decode(GraphDecoder.java:650)
        at jdk.internal.vm.compiler/org.graalvm.compiler.replacements.PEGraphDecoder.decode(PEGraphDecoder.java:892)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.classinitialization.SimulateClassInitializerGraphDecoder.decode(SimulateClassInitializerGraphDecoder.java:151)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.classinitialization.SimulateClassInitializerSupport.decodeGraph(SimulateClassInitializerSupport.java:480)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.classinitialization.SimulateClassInitializerSupport.addClassInitializerDependencies(SimulateClassInitializerSupport.java:453)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.classinitialization.SimulateClassInitializerSupport.trySimulateClassInitializer(SimulateClassInitializerSupport.java:363)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.classinitialization.SimulateClassInitializerSupport.trySimulateClassInitializer(SimulateClassInitializerSupport.java:217)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.analysis.DynamicHubInitializer.buildClassInitializationInfo(DynamicHubInitializer.java:196)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.analysis.DynamicHubInitializer.initializeMetaData(DynamicHubInitializer.java:106)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.analysis.NativeImagePointsToAnalysis.initializeMetaData(NativeImagePointsToAnalysis.java:124)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.AnalysisUniverse.initializeMetaData(AnalysisUniverse.java:706)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.AnalysisType.lambda$new$1(AnalysisType.java:311)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
        ... 24 more
Caused by: com.oracle.svm.core.util.VMError$HostedError: Boolean option value can be only + or -
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.util.VMError.shouldNotReachHere(VMError.java:78)
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.util.VMError.guarantee(VMError.java:122)
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.option.SubstrateOptionsParser.commandArgument(SubstrateOptionsParser.java:188)
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.option.SubstrateOptionsParser.commandArgument(SubstrateOptionsParser.java:235)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.classinitialization.ClassInitializationFeature.checkImageHeapInstance(ClassInitializationFeature.java:179)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.AnalysisUniverse.replaceObject(AnalysisUniverse.java:616)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.ameta.AnalysisConstantReflectionProvider.replaceObject(AnalysisConstantReflectionProvider.java:296)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.ameta.AnalysisConstantReflectionProvider.interceptValue(AnalysisConstantReflectionProvider.java:263)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.ameta.AnalysisConstantReflectionProvider.readValue(AnalysisConstantReflectionProvider.java:208)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.ameta.AnalysisConstantReflectionProvider.readFieldValue(AnalysisConstantReflectionProvider.java:178)
        at jdk.internal.vm.compiler/org.graalvm.compiler.nodes.util.ConstantFoldUtil$1.readValue(ConstantFoldUtil.java:55)
        at jdk.internal.vm.compiler/org.graalvm.compiler.core.common.spi.JavaConstantFieldProvider.readConstantField(JavaConstantFieldProvider.java:78)
------------------------------------------------------------------------------------------------------------------------
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.meta.SharedConstantFieldProvider.readConstantField(SharedConstantFieldProvider.java:61)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.ameta.AnalysisConstantFieldProvider.readConstantField(AnalysisConstantFieldProvider.java:52)
        at jdk.internal.vm.compiler/org.graalvm.compiler.nodes.util.ConstantFoldUtil.tryConstantFold(ConstantFoldUtil.java:51)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.ConstantFoldLoadFieldPlugin.tryConstantFold(ConstantFoldLoadFieldPlugin.java:68)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.ConstantFoldLoadFieldPlugin.handleLoadStaticField(ConstantFoldLoadFieldPlugin.java:62)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.genGetStatic(BytecodeParser.java:4954)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.genGetStatic(BytecodeParser.java:4925)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.processBytecode(BytecodeParser.java:5435)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.iterateBytecodesForBlock(BytecodeParser.java:3431)
        ... 62 more
                        2.0s (8.2% of total time) in 27 GCs | Peak RSS: 2.88GB | CPU load: 3.94
========================================================================================================================
Finished generating 'elide.debug' in 24.3s.
@fniephaus
Copy link
Member

This is a known issue. From the release notes:

Note that there is a known issue when a build that does not satisfy the new policy would fail with the following error: Boolean option value can be only + or -. This will be resolved in a patch release on October 24, 2023 and we will share more details on the new policy and best practices in the upcoming blog post.

(Note that the root cause is a VMError, but it later gets wrapped into a BytecodeParserError.)

@fniephaus fniephaus self-assigned this Sep 24, 2023
@sgammon
Copy link
Author

sgammon commented Sep 27, 2023

Understood, sorry for missing that @fniephaus, thank you for the pointer 👍🏻

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

No branches or pull requests

2 participants