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

compile whamm monitor by default #234

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
15 changes: 15 additions & 0 deletions src/engine/Engine.v3
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,21 @@ class Engine {
return FileLoadResult.ParseError(code, filename, section, error_index, error_pos, error_msg);
}
}

def loadWasmFileWithTiering(path: string, tiering_override: ExecutionStrategy) -> FileLoadResult {
var data = System.fileLoad(path);
if (data == null) return FileLoadResult.FileNotFound(path);
var limits = Limits.new().set(extensions);
var bp = BinParser.new(extensions, limits, path);
bp.tiering = tiering_override;
var r = bp.push(data, 0, data.length).finish();
match (r) {
Ok(module) =>
return FileLoadResult.Ok(module);
Error(code, filename, section, error_index, error_pos, error_msg) =>
return FileLoadResult.ParseError(code, filename, section, error_index, error_pos, error_msg);
}
}
}
type FileLoadResult {
case Ok(module: Module);
Expand Down
9 changes: 9 additions & 0 deletions src/engine/Execute.v3
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,15 @@ component ExecuteOptions {
}
return false;
}
// Returns the execution strategy for a given flag, or default if not found.
def getModeOrDefault(name: string) -> ExecutionStrategy {
for (l = modes; l != null; l = l.tail) {
var t = l.head;
if (Strings.equal(t.0,name)) return t.1;
}
return default;
}

// Print help for the supported modes.
def printHelp(out: TraceBuilder) {
var H = out.putsln, L = out.ln;
Expand Down
4 changes: 2 additions & 2 deletions src/monitors/MonitorOptions.v3
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ component MonitorOptions {
if (Strings.endsWith(name, ".wasm")) {
var engine = Engine.new();
engine.extensions = Extension.set.all;

var result = engine.loadWasmFile(name); // TODO: limits
var tiering_override = ExecuteOptions.getModeOrDefault("jit");
var result = engine.loadWasmFileWithTiering(name, tiering_override); // TODO: limits
match (result) {
Ok(m) => {
monitors.put(WhammMonitor.new(m));
Expand Down
Loading