Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
3973d5b
feat: store Wasm GC references as Java Objects in the interpreter
andreaTP Jun 2, 2026
ef7b2e4
feat: add Object-based API (callGc/applyGc) for GC reference support
andreaTP Jun 3, 2026
b562fc9
feat: remove GcRefStore — Java GC handles all Wasm GC references
andreaTP Jun 3, 2026
57d3b8d
fix: interpreter GC ref handling — all 62,144 runtime tests green
andreaTP Jun 5, 2026
bbbd57e
fix: compiler GC ref handling — full mvn verify passes
andreaTP Jun 6, 2026
6d90994
fix: compiler GC ref fixes + edge case tests + stress test
andreaTP Jun 9, 2026
5402288
feat: externref as Object + CallResult API — spec-compliant round-trips
andreaTP Jun 11, 2026
c3d0f61
refactor: strip externref compat workarounds, clean API
andreaTP Jun 11, 2026
63efa66
refactor: delete applyGc — applyWithRefs is the only ref API
andreaTP Jun 12, 2026
f978a85
fix: review findings — NULL_REF sentinel, apply guard, overflow
andreaTP Jun 15, 2026
9307df4
fix: compiler boundary bugs — dual long[]+Object[] at all boundaries
andreaTP Jun 15, 2026
1eb5862
feat: annotation processor supports externref as Object
andreaTP Jun 15, 2026
46d2580
fix: review findings — perf, multi-value, cleanup
andreaTP Jun 15, 2026
83b970b
fix: update verifyLotsOfArgs approval template for new bytecode
andreaTP Jun 16, 2026
850df8b
fix: remove unused variable hasRefReturn (checkstyle)
andreaTP Jun 17, 2026
6d95a27
fix: remove dead code in ModuleInterfaceCodegen (unused collections, …
andreaTP Jun 17, 2026
cbfde45
fix: PR review bugs — RETURN_CALL refs, cross-instance refs, pop() le…
andreaTP Jun 17, 2026
055a015
fix: ARRAY_COPY isReference, Builder isGcReference, V128 slot, struct…
andreaTP Jun 17, 2026
05057ae
test: add funcref array.copy test (exercises ARRAY_COPY isObjectRef fix)
andreaTP Jun 18, 2026
07d27fc
perf: direct callWithRefs dispatch in compiled Machine
andreaTP Jun 19, 2026
a4780dd
fix: callWithRefs dispatch splitting, SELECT/DROP isObjectRef, defaul…
andreaTP Jun 24, 2026
18939d6
fix: review items — template loops, Shaded guards, codegen multi-return
andreaTP Jun 24, 2026
76beadc
refactor: add builders for CallResult, WasmException, WasmStruct, Was…
andreaTP Jun 24, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import run.endive.wasm.types.Value;
import run.endive.wasm.types.ValueType;

@SuppressWarnings("deprecation")
class AllImportsTest {

@WasmModuleInterface("all-imports.wat.wasm")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package endive.test;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;

import org.junit.jupiter.api.Test;
import run.endive.annotations.WasmModuleInterface;
Expand Down Expand Up @@ -34,28 +35,25 @@ public TestModule_ModuleExports exports() {

private Object sampleObj = null;

public long getHostObject() {
public Object getHostObject() {
sampleObj = new Object();
return 123;
return sampleObj;
}

public int isNull(long arg0) {
if (arg0 != 123) {
throw new RuntimeException("unrecognized external ref");
}
return (sampleObj == null) ? 1 : 0;
public int isNull(Object arg0) {
return (arg0 == null) ? 1 : 0;
}
}

@Test
public void testExternRef() {
var module = new TestModule();

assertEquals(1, module.exports().isNull(123L));
assertEquals(1, module.exports().isNull(null));

var hostObj = module.exports().getHostObject();
assertEquals(123, hostObj);
assertNotNull(hostObj);

assertEquals(0, module.exports().isNull(123L));
assertEquals(0, module.exports().isNull(hostObj));
}
}
452 changes: 364 additions & 88 deletions codegen/src/main/java/run/endive/codegen/ModuleInterfaceCodegen.java

Large diffs are not rendered by default.

52 changes: 37 additions & 15 deletions compiler-tests/src/test/java/run/endive/testing/ArgsAdapter.java
Original file line number Diff line number Diff line change
@@ -1,36 +1,58 @@
package run.endive.testing;

import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.List;
import run.endive.runtime.CallResult;
import run.endive.runtime.ExportFunction;

public final class ArgsAdapter {
private final ArrayDeque<Long> stack;
private final List<Long> longs = new ArrayList<>();
private final List<Object> refs = new ArrayList<>();
private boolean hasRefs;

private ArgsAdapter() {
stack = new ArrayDeque<>();
}
private ArgsAdapter() {}

public static ArgsAdapter builder() {
return new ArgsAdapter();
}

public long[] build() {
var result = new long[stack.size()];
int i = stack.size() - 1;
while (!stack.isEmpty()) {
result[i--] = stack.pop();
}
return result;
public ArgsAdapter add(long arg) {
longs.add(arg);
refs.add(null);
return this;
}

public ArgsAdapter add(long[] args) {
for (var arg : args) {
stack.push(arg);
longs.add(arg);
refs.add(null);
}
return this;
}

public ArgsAdapter add(long arg) {
stack.push(arg);
public ArgsAdapter addRef(Object ref) {
longs.add(0L);
refs.add(ref);
hasRefs = true;
return this;
}

public long[] build() {
var result = new long[longs.size()];
for (int i = 0; i < longs.size(); i++) {
result[i] = longs.get(i);
}
return result;
}

public Object[] buildRefs() {
if (!hasRefs) {
return null;
}
return refs.toArray();
}

public CallResult applyWithRefs(ExportFunction func) {
return func.applyWithRefs(build(), buildRefs());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import run.endive.wasm.types.Value;

// https://github.com/WebAssembly/spec/blob/ee82c8e50c5106e0cedada0a083d4cc4129034a2/interpreter/host/spectest.ml
@SuppressWarnings("deprecation")
public final class Spectest {
private static final WasmFunctionHandle noop = (Instance instance, long... args) -> null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ run.endive.testing.Test3MachineFuncGroup_0.func_3
run.endive.testing.Test3MachineFuncGroup_0.call_3
run.endive.testing.Test3MachineMachineCall.call
run.endive.testing.Test3Machine.call
run.endive.runtime.Instance$Exports.lambda$function$0
run.endive.runtime.Instance$Exports$1.apply
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ run.endive.testing.Test3MachineFuncGroup_0.func_3
run.endive.testing.Test3MachineFuncGroup_0.call_3
run.endive.testing.Test3MachineMachineCall.call
run.endive.testing.Test3Machine.call
run.endive.runtime.Instance$Exports.lambda$function$0
run.endive.runtime.Instance$Exports$1.apply
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ private final Lrun/endive/runtime/Instance; instance
private final Lrun/endive/runtime/internal/CompilerInterpreterMachine; compilerInterpreterMachine
}

public final static INNERCLASS run/endive/runtime/ConstantEvaluators$ConstantResult run/endive/runtime/ConstantEvaluators ConstantResult

private final static Z memCopyWorkaround
}

Expand Down
Loading
Loading