Initial redline port#92
Open
andreaTP wants to merge 7 commits into
Open
Conversation
Make Machine extend AutoCloseable (default no-op) and Instance implement AutoCloseable, delegating close() to machine.close(). This enables principled resource cleanup for native backends without wrappers. Add redline/ module skeleton with the API module (redline-api-experimental) containing: RedlineTarget (enum for platform detection), NativeCodeSerializer, Interruptible, CtxBuffer (native call context layout), and TypeMapUtils (canonical type map for call_indirect). Activated via -Predline profile.
Port the Cranelift bridge: a Java wrapper around cranelift_bridge.wasm (the Cranelift compiler itself compiled to Wasm and run by endive). - CraneliftBridge: renamed from RedlineBridge, uses moduleInterface plugin property instead of @WasmModuleInterface annotation - Removed WasmResource template, antrun path normalization, templating plugin, and annotations dependency - Fixed getBytes() to use StandardCharsets.UTF_8 - Removed dead null check in close() - Inlined thin wrapper methods, extracted readCompiledCode() - Enforcer check fails with clear message if wasm binary is missing - Rust sources in redline/wasm-build/ (cargo build --target wasm32-wasip1) - cranelift_bridge.wasm gitignored (build with: cd redline/wasm-build && make all)
Port NativeCompiler, NativeEmitters, EmitContext, NativeValueStack from chicory-redline. Removed NativeAnalyzer — dead code handling consolidated into the compiler's control stack (frame.unreachable), single source of truth. Removed scope/restore mechanism from NativeValueStack (only served the analyzer). Updated all imports to run.endive.*, ChicoryException to WasmEngineException, RedlineBridge to CraneliftBridge.
Port NativeMachineFactory, NativeMachine, NativeMemory, NativeTable, NativeGlobalInstance, PanamaExecutor from chicory-redline. Key changes from original: - Removed Cleaner from NativeMachine and NativeMemory — direct AutoCloseable only, no GC safety net - Dropped RedlineInstance wrapper — builder returns Instance directly - Dropped NativeInstance alias and PanamaMachineFactoryProvider (no SPI) - RedlineTarget.detectHost() now returns Optional<RedlineTarget> - Fixed Interruptable -> Interruptible spelling - All imports updated to run.endive.*
Wire up endive's test-gen-plugin to generate and run the WebAssembly spec test suite against the redline native compiler + Panama runner. 28,713 tests passing (99.89% of spec suite). 32 tests excluded — all externref-related, due to the gap between redline's i64-based ref representation and endive's Object-based GC ref handling. To be addressed separately. Adapter classes: NativeInstanceBuilder (compiles at runtime via NativeCompiler), TestModule, Spectest (with NativeMemory for imports), ArgsAdapter (from endive's runtime-tests, with GC ref support). No RedlineInstanceTracker — Instance is AutoCloseable, cleanup is natural via try-with-resources in the generated tests.
Separate workflow for the redline native compiler. Runs on ubuntu and macOS with JDK 25. Installs Rust with wasm32-wasip1 target, builds cranelift_bridge.wasm from source, then runs the full spec test suite.
All redline Java packages now include 'experimental' to clearly signal the API stability level: run.endive.redline.experimental.api, .bridge, .compiler.internal, .runner, .runner.internal. Directory names under redline/ unchanged (api/, bridge/, etc.). Artifact IDs already had -experimental suffix.
b8c1311 to
b039e74
Compare
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.
I'm starting to port the redline compiler(based on Cranelift) to this repo.
This seems an initial bulk to enable the loop with the generated testsuite.