Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finish all the validation for the interpreter #440

Merged
merged 1 commit into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -64,6 +64,7 @@ public void verifyTrap() {
private static void verifyGeneratedBytecode(String name) {
var instance =
Module.builder("compiled/" + name)
.withImportValidation(false)
.withMachineFactory(AotMachine::new)
.withStart(false)
.build()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,78 +10,55 @@
import com.dylibso.chicory.runtime.HostTable;
import com.dylibso.chicory.runtime.TableInstance;
import com.dylibso.chicory.wasm.types.Limits;
import com.dylibso.chicory.wasm.types.MutabilityType;
import com.dylibso.chicory.wasm.types.Table;
import com.dylibso.chicory.wasm.types.Value;
import com.dylibso.chicory.wasm.types.ValueType;

public class SpecV1ElemHostFuncs {

private static GlobalInstance glob = new GlobalInstance(Value.i32(123));

public static HostImports fallback() {
return new HostImports();
return HostImports.builder()
.addGlobal(
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note to self: this API is better than before, but is still too verbose and detailed for 90% of the use cases.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, i have some words to say about this in #441

new HostGlobal("test", "global-i32", new GlobalInstance(Value.i32(0))),
new HostGlobal("spectest", "global_i32", glob),
new HostGlobal(
"test",
"global-mut-i32",
new GlobalInstance(Value.i32(0)),
MutabilityType.Var),
new HostGlobal(
"test", "g", new GlobalInstance(Value.i32(0)), MutabilityType.Var))
.addTable(
new HostTable(
"spectest",
"table",
new TableInstance(new Table(ValueType.FuncRef, new Limits(10)))))
.build();
}

public static HostImports testModule3() {
public static HostImports testModule17() {
return new HostImports(
new HostTable[] {
new HostTable(
"spectest",
"table",
new TableInstance(new Table(ValueType.FuncRef, new Limits(1))))
new TableInstance(new Table(ValueType.FuncRef, new Limits(1, 100))))
});
}

public static HostImports testModule5() {
public static HostImports testModule19() {
return new HostImports(
new HostTable[] {
new HostTable(
"spectest",
"table",
new TableInstance(new Table(ValueType.FuncRef, new Limits(10))))
});
}

public static HostImports testModule6() {
return new HostImports(
new HostGlobal[] {
new HostGlobal("spectest", "global_i32", new GlobalInstance(Value.i32(123)))
new TableInstance(new Table(ValueType.FuncRef, new Limits(10, 30))))
});
}

public static HostImports testModule7() {
return new HostImports(
new HostGlobal[] {
new HostGlobal("spectest", "global_i32", new GlobalInstance(Value.i32(321)))
});
}

public static HostImports testModule11() {
return testModule5();
}

public static HostImports testModule13() {
return testModule3();
}

public static HostImports testModule16() {
return testModule3();
}

public static HostImports testModule17() {
return testModule3();
}

public static HostImports testModule18() {
return testModule5();
}

public static HostImports testModule19() {
return testModule5();
}

public static HostImports testModule23() {
return testModule5();
}

private static HostTable module1SharedTable() {
return new HostTable("module1", "shared-table", module1Instance.table(0));
}
Expand Down
Loading
Loading