~jb55/protoverse

2434b2fe3979559eb3bdf69fff1c30cada3ad9a9 — William Casarin a month ago 3850ab1
return if break has no local label target
1 files changed, 19 insertions(+), 18 deletions(-)

M src/wasm.c
M src/wasm.c => src/wasm.c +19 -18
@@ 4180,12 4180,30 @@ static int unresolved_break(struct wasm_interp *interp, int index)
	return 1;
}

static int interp_return(struct wasm_interp *interp)
{
	int count;

	if (unlikely(!count_local_resolvers(interp, &count))) {
		return interp_error(interp, "failed to count fn labels?");
	}

	if (unlikely(!cursor_dropn(&interp->resolver_stack,
					sizeof(struct resolver), count))) {
		return interp_error(interp, "failed to drop %d local labels",
				count);
	}

	return drop_callframe(interp);
}


static int interp_br_jump(struct wasm_interp *interp, u32 index)
{
	struct label *label;

	if (unlikely(!(label = top_label(interp, index)))) {
		return interp_error(interp, "no label?");
		return interp_return(interp);
	}

	if (is_label_resolved(label)) {


@@ 5148,23 5166,6 @@ static int interp_select(struct wasm_interp *interp, struct select_instr *select
		return stack_pushval(interp, &top);
}

static int interp_return(struct wasm_interp *interp)
{
	int count;

	if (unlikely(!count_local_resolvers(interp, &count))) {
		return interp_error(interp, "failed to count fn labels?");
	}

	if (unlikely(!cursor_dropn(&interp->resolver_stack,
					sizeof(struct resolver), count))) {
		return interp_error(interp, "failed to drop %d local labels",
				count);
	}

	return drop_callframe(interp);
}

enum interp_end {
	interp_end_err,
	interp_end_next,