mirror of
https://github.com/ziglang/zig.git
synced 2026-01-20 14:25:16 +00:00
wasm: fix return ret_load with zero-size type
When we have a `ret_load` instruction with a zero-sized type which was not an error, we would not emit any instruction. This resulted in no `return` instruction and also not correctly resetting the global stack_pointer. This commit also enables the regular test runner for the WebAssembly backend.
This commit is contained in:
parent
43e89026ac
commit
6c06944b59
@ -12,9 +12,7 @@ var cmdline_buffer: [4096]u8 = undefined;
|
||||
var fba = std.heap.FixedBufferAllocator.init(&cmdline_buffer);
|
||||
|
||||
pub fn main() void {
|
||||
if (builtin.zig_backend == .stage2_wasm or
|
||||
builtin.zig_backend == .stage2_aarch64)
|
||||
{
|
||||
if (builtin.zig_backend == .stage2_aarch64) {
|
||||
return mainSimple() catch @panic("test failure");
|
||||
}
|
||||
|
||||
|
||||
@ -2122,16 +2122,13 @@ fn airRetLoad(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
|
||||
const un_op = func.air.instructions.items(.data)[inst].un_op;
|
||||
const operand = try func.resolveInst(un_op);
|
||||
const ret_ty = func.air.typeOf(un_op).childType();
|
||||
|
||||
const fn_info = func.decl.ty.fnInfo();
|
||||
if (!ret_ty.hasRuntimeBitsIgnoreComptime()) {
|
||||
if (ret_ty.isError()) {
|
||||
try func.addImm32(0);
|
||||
} else {
|
||||
return func.finishAir(inst, .none, &.{});
|
||||
}
|
||||
}
|
||||
|
||||
const fn_info = func.decl.ty.fnInfo();
|
||||
if (!firstParamSRet(fn_info.cc, fn_info.return_type, func.target)) {
|
||||
} else if (!firstParamSRet(fn_info.cc, fn_info.return_type, func.target)) {
|
||||
// leave on the stack
|
||||
_ = try func.load(operand, ret_ty, 0);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user