Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
5ebcc5a
feat: store Wasm GC references as Java Objects in the interpreter
andreaTP Jun 2, 2026
4465b16
feat: add Object-based API (callGc/applyGc) for GC reference support
andreaTP Jun 3, 2026
51ab0e0
feat: remove GcRefStore — Java GC handles all Wasm GC references
andreaTP Jun 3, 2026
ad207f4
fix: interpreter GC ref handling — all 62,144 runtime tests green
andreaTP Jun 5, 2026
0cac8ea
fix: compiler GC ref handling — full mvn verify passes
andreaTP Jun 6, 2026
c7f2896
fix: compiler GC ref fixes + edge case tests + stress test
andreaTP Jun 9, 2026
e17629c
feat: externref as Object + CallResult API — spec-compliant round-trips
andreaTP Jun 11, 2026
08ef611
refactor: strip externref compat workarounds, clean API
andreaTP Jun 11, 2026
2f14323
refactor: delete applyGc — applyWithRefs is the only ref API
andreaTP Jun 12, 2026
da4aa6d
fix: review findings — NULL_REF sentinel, apply guard, overflow
andreaTP Jun 15, 2026
fcf5d03
fix: compiler boundary bugs — dual long[]+Object[] at all boundaries
andreaTP Jun 15, 2026
02c155e
feat: annotation processor supports externref as Object
andreaTP Jun 15, 2026
b109e44
fix: review findings — perf, multi-value, cleanup
andreaTP Jun 15, 2026
afb9d33
fix: update verifyLotsOfArgs approval template for new bytecode
andreaTP Jun 16, 2026
84e9460
fix: remove unused variable hasRefReturn (checkstyle)
andreaTP Jun 17, 2026
b8272c7
fix: remove dead code in ModuleInterfaceCodegen (unused collections, …
andreaTP Jun 17, 2026
2acf59d
fix: PR review bugs — RETURN_CALL refs, cross-instance refs, pop() le…
andreaTP Jun 17, 2026
0246f50
fix: ARRAY_COPY isReference, Builder isGcReference, V128 slot, struct…
andreaTP Jun 17, 2026
a224060
test: add funcref array.copy test (exercises ARRAY_COPY isObjectRef fix)
andreaTP Jun 18, 2026
7676994
perf: direct callWithRefs dispatch in compiled Machine
andreaTP Jun 19, 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
@@ -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));
}
}
447 changes: 359 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 @@ -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