Repository navigation
Fix a JIT-failure loop, and read JMODs with file-absolute zip offsets - #14
Merged
atgreen merged 2 commits intoOct 18, 2026
Merged
Conversation
When %compile-method fails, %install-jit-error-stub replaces the lazy compile stub with one that signals. It interned the method's name in the class loader's package, but instance methods dispatch on a generic function in :openldk: that is where the lazy stub's defmethod goes and where %build-method-definition puts a compiled method. For a class from a user loader (OPENLDK.APP for the classpath) the error stub therefore went onto an unrelated generic function and the lazy stub survived. Each call then ran %compile-method, which returns at once for a method already marked :done, and invoked the same stub again, so the call never returned and the process spun at full CPU. Static methods were unaffected: their stub and their error stub both live in the loader's package. Reproduced with a version-49 class whose constructor calls an instance method that uses jsr, which OpenLDK does not translate. Before: hangs after "JIT-ERROR in p/Jsr.m()V: The function :JSR is undefined." After: signals OPENLDK-INTERNAL-ERROR "JIT compilation failed for p/Jsr.m()V".
open-jmod-zipfile always skipped 4 bytes, the JM\1\0 header, so it expected the zip offsets inside a JMOD to count from after the header. That holds for all 69 JMODs in Oracle OpenJDK 25.0.2, but 30 of the 84 in GraalVM CE 25.0.1 (java.desktop, java.instrument, java.management, java.prefs, jdk.compiler and others) count from the start of the file. Those were read 4 bytes past their central directory and failed zip's signature assertion. Since OpenLDK reads the JDK from jmods/ when it exists, any class lookup that reached one of them failed, including INITIALIZE's preload of jdk/internal/org/objectweb/asm/ClassWriter, which JDK 24 removed, so OpenLDK could not start on that JDK. The new ZIP-PREFIX-LENGTH computes the prefix the way Info-ZIP does for an archive with one: the end record's position less the end of the central directory it describes. It gives 4 or 0 for the two layouts, and NIL (keep 4) when there is no end record or it is a zip64 one. open-jmod-zipfile also closes the file if reading it fails. - Unit test ZIP-PREFIX-LENGTH in test/tests.lisp
burinc
added a commit
to jlt-commons/jolt-openldk
that referenced
this pull request
Oct 14, 2026
burinc
added a commit
to jlt-commons/jolt-openldk
that referenced
this pull request
Oct 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two bugs that together made a call hang at full CPU on GraalVM CE 25.0.1. Each reproduces on OpenLDK alone.
1. A failed JIT compile of an instance method loops forever.
%install-jit-error-stubinterns the stub in the class loader's package (OPENLDK.APPfor the classpath), but instance methods dispatch on a generic function in:openldk. The error stub lands on the wrong function, the lazy stub survives, and every call finds the method already marked compiled and calls the stub again. The fix interns instance-method stubs in:openldk. Static methods are unchanged.2. JMODs whose zip offsets count from the start of the file.
open-jmod-zipfilealways skips the 4-byteJM\1\0header. That's right for all 69 jmods in Oracle OpenJDK 25.0.2, but 30 of the 84 in GraalVM CE 25.0.1 count from the file start, so they fail zip's signature check, andinitializecan't start on that JDK. The newzip-prefix-lengthcomputes the prefix from the end record, Info-ZIP's way, and keeps 4 when it can't tell (no end record, zip64). The file is also closed if reading it fails.q.JsrMain(an instance method usingjsr)initializefails the zip checkChecks: unit tests 25/25 (5 new),
ocicl lintmatches master, andmake check-regressiongives the same per-test results as master. macOS arm64, SBCL 2.6.9.Reproduction
jsr.pywrites the class:q/JsrMain.java:python3 jsr.py javac --release 8 -cp classes -d classes q/JsrMain.java (cd classes && jar cf ../jsrmain.jar q/JsrMain.class p/Jsr.class)Run with
(openldk::main "q.JsrMain" nil :classpath "jsrmain.jar")after(openldk::initialize).