Repository navigation
Port runtime improvements with Android and NGE TeaVM coverage - #2
Merged
riccardobl merged 14 commits intoOct 27, 2026
Merged
riccardobl merged 14 commits into
riccardobl merged 14 commits into
Conversation
Port the Validator fix from upstream 43d9100 and soxdev 7679b1d1. Active and passive elements declare function references just as declarative elements do. Regression tests reproduced both rejected valid modules before the fix.
Port the interpreter fix from upstream 43d9100 and soxdev 7679b1d1. Real BR_IF-only and BR_TABLE-only loops now stop on thread interruption. Both regressions failed on the original implementation with bounded worker cleanup.
Port soxdev f1154c78. Read operands directly from the existing instruction while retaining the protected CALL, evalDefault and readMemPtr Operands hooks. Cover listener order, retained extension operands, memory failures and numeric/GC handlers.
Port and qualify soxdev a1f0240e. Reuse at most 64 inactive control frames only when every immutable field matches. Preserve detached frames, deep stack behavior, tail calls and exception unwinding. The 10000-iteration interpreter workload reduces median allocated bytes per call from 640344 to 320384 on JDK 25 with default escape analysis.
Select the production compiler fixes from upstream 43d9100. Deduplicate equivalent JVM multi-value bridges, register only reachable exception ranges with inner handlers first, and handle already-exited branch scopes. The original compiler reproduced duplicate-method ClassFormatError and ASM frame-analysis NullPointerException on the added binary fixtures. Compare execution with the interpreter and preserve cross-instance indirect tail calls to both compiled and interpreted targets.
Port upstream ea8351c while bounding chunk sizes for zero, negative and extreme chicory.hugeMethodLimit values. Keep indirect-call chunking unchanged. Check generated method sizes and dispatch across chunk boundaries, and include the upstream JMH workload. On JDK 25, the 2000-function microbenchmark measured 6.25-6.40 ns/op with the default budget versus 43.60-46.16 ns/op with the previous chunk dimensions.
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.
Conditional/table-only interpreter loops can ignore thread interruption, valid active/passive element references can be rejected, and JVM compilation can fail on equivalent reference bridges or unreachable/nested exception handlers. Fix these cases and reduce interpreter allocation and JVM dispatch overhead while retaining NGE's paged memory, atomic/parser implementations and
org.ngengine.chicorycoordinates. Add explicit allocated-page validation so scalar out-of-bounds accesses keep raising Wasm traps after compilation by TeaVM, where implicit JVM array/null checks may be omitted.All integration commits are authored by Mr Robot toaster@rblb.it. Upstream production fixes are selected from
43d9100b; JIT-aware direct dispatch is adapted fromea8351c4with bounded configuration values, generated-method size checks, documentation and a reproducible JMH workload.mainfix/upstream-runtime-7717679b1d1: independently reproduced interruption and element-declaration fixes.fix/operands-allocation-807f1154c78: consume existing instructions in built-in handlers while retaining protectedOperandsextension hooks.experiment/control-frame-reuse-817a1f0240e: immutable reuse bounded to 64 inactive control frames per activation.fix/tdb-lua-guard-503archive/source-20261026/work/guarded-stage2-606work/shared-local-exits-20261025Upstream tail-call trampoline
1303ad00is excluded: a cross-instance indirect tail call returns 42 with the original compiler but throwsChicoryExceptionwith that candidate. Regression coverage preserves calls to both compiled and interpreted foreign instances. Unrelated upstream documentation, dependency, CI and fuzzer rewrites are omitted.Validation:
mvn -B -ntp -pl runtime-tests,compiler-tests,machine-tests,simd,jmh -am verify -Dmaven.javadoc.skip=true: all 21 reactor modules succeeded, including formatting, Checkstyle, Error Prone and dependency checks.org.ngengine:0.16.0-SNAPSHOT: compiled the actual parser/interpreter to JavaScript and ran it in headless Chrome; 10,000 loop iterations, 10,000 interpreter tail calls, activeref.func, memory reads/writes and bounds traps passed.Android and TeaVM compatibility:
WebAssembly/wasi-testsuiteto6345da2237c562d9a94e281332c653b5528fdd52, the last prebuilt revision with the specification format supported by the generator. Keep both CI checkouts and the downloader aligned; archives now accept commit refs. The moving branch introducedrootand broke Maven preparation before Android tests started.ByteArrayOutputStream.writeBytesin the new runtime regression fixtures with the compatiblewrite(byte[], offset, length)API. Android API 28 reported 13NoSuchMethodErrorfailures with the Java 11 convenience method.javascriptandwasm-gc, using publishedorg.ngengine:teavm-*0.16.0-SNAPSHOTartifacts from the NGE fork with snapshot refresh enabled..metais bundled through the NGE resource policy SPI; JVM compiler/ASM remain build-time dependencies.--experimental-wasm-exnreffor the exception-handling instructions emitted by this TeaVM version.Follow-up local validation:
00102c7a26dc7a0c9d808f4b4c16f0e3556c7399; local/remote divergence0 0.CI audit follow-up:
continue-on-error: Linux ARM Java 11 and 17 failedSpecV1CommentsTestwhile validating a quoted WAT module in embedded wasm-tools. The remaining 18 CI jobs passed. The failure was reproduced on both jobs in run 40510508884.UseSIMDForMemoryOpsenabled. Disabling either feature passes. The original page guard fails; changing only that guard passes all 36,158 specification cases (36,075 passing, 83 existing skips), twice, with both features enabled. No JVM optimization is disabled in CI.Remote validation on
00102c7a:This compatibility workload does not claim complete WebAssembly specification coverage inside TeaVM.