sysjs: improve self-hosted compiler support

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2022-09-09 23:37:50 -07:00
parent f15cea9492
commit 4c3a19fc26

View file

@ -211,7 +211,7 @@ export fn wasmCallFunction(id: *anyopaque, args: u32, len: u32, captures: [*]Val
if (builtin.zig_backend == .stage1) {
obj.set("return_value", functions.items[@ptrToInt(id) - 1](obj, len, captures_slice));
} else {
var func = @ptrCast(*FunType, @alignCast(std.meta.alignment(*FunType), id));
var func = @ptrCast(FunType, @alignCast(std.meta.alignment(FunType), id));
obj.set("return_value", func(obj, len, captures_slice));
}
}
@ -260,7 +260,7 @@ pub fn createFunction(fun: FunType, captures: []Value) Function {
functions.append(std.heap.page_allocator, fun) catch unreachable;
return .{ .ref = js.zigCreateFunction(@intToPtr(*anyopaque, functions.items.len), captures.ptr, @intCast(u32, captures.len)) };
}
return .{ .ref = js.zigCreateFunction(&fun, captures.ptr, captures.len) };
return .{ .ref = js.zigCreateFunction(fun, captures.ptr, captures.len) };
}
pub fn constructType(t: []const u8, args: []const Value) Object {