Skip to content

Commit 91aabaf

Browse files
committed
fix bug
1 parent 1d5d1b3 commit 91aabaf

File tree

9 files changed

+260
-250
lines changed

9 files changed

+260
-250
lines changed

main/miniwasm.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,6 @@ static int web49_file_main(const char *inarg, const char **args) {
169169
} else if (!strcmp(todo.fun_fun, "assert_malformed")) {
170170
continue;
171171
} else {
172-
// printf("%zu %zu\n", (size_t) todo.start, (size_t) todo.end);
173172
fprintf(stderr, "wasm spec test: dont know how to handle: (%s ...)\n", todo.fun_fun);
174173
return 1;
175174
}

src/config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
#define WEB49_COUNT_ALLOC 0
66
#define WEB49_USE_SWITCH 0
7-
#define WEB49_OPT_CONST0 1
7+
#define WEB49_OPT_CONST 1
88
#define WEB49_PRINT_AST 0
99
#define WEB49_PRINT_INSTR 0
1010
#define WEB49_PRINT_INSTR_DEPTH 0

src/interp/interp.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,12 @@ uint32_t web49_interp_read_instr(web49_read_block_state_t *state, web49_instr_t
509509
break;
510510
case WEB49_IMMEDIATE_DATA_INDEX:
511511
break;
512+
case WEB49_IMMEDIATE_LANE:
513+
build->code[build->ncode++].data.i32_u = cur.immediate.lane;
514+
break;
515+
case WEB49_IMMEDIATE_V128:
516+
build->code[build->ncode++].data.v128 = WEB49_INTERP_V128(cur.immediate.u128);
517+
break;
512518
default:
513519
fprintf(stderr, "bad immediate: %zu\n", (size_t)cur.immediate.id);
514520
__builtin_trap();
@@ -653,6 +659,7 @@ web49_interp_data_t *web49_interp_block_run(web49_interp_t *ptr_interp, web49_in
653659
#define TABLE_PUT0(x) TABLE_PUTV(x, x)
654660
#define TABLE_PUT1(x) TABLE_PUTV(x, x##_R), TABLE_PUTV(x + WEB49_OPCODE_WITH_CONST0, x##_C0)
655661
#define TABLE_PUT2(x) TABLE_PUTV(x, x##_R), TABLE_PUTV(x + WEB49_OPCODE_WITH_CONST0, x##_C0), TABLE_PUTV(x + WEB49_OPCODE_WITH_CONST1, x##_C1), TABLE_PUTV(x + WEB49_OPCODE_WITH_CONST0 + WEB49_OPCODE_WITH_CONST1, x##_C01)
662+
#define TABLE_SIMD(x) TABLE_PUTV(x, x)
656663
#else
657664
#define TABLE_PUT0(x) TABLE_PUTV(x, x)
658665
#define TABLE_PUT1(x) TABLE_PUTV(x, x##_R)

src/interp/interp.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,13 @@ void web49_free_interp(web49_interp_t interp);
201201
}; \
202202
(ptrtype) & sub_.memory[xptr_]; \
203203
})
204-
#define WEB49_INTERP_READ(elemtype, interp, dest) (*WEB49_INTERP_ADDR(elemtype *, interp, dest, sizeof(elemtype)))
204+
#define WEB49_INTERP_READ(elemtype, interp, src) (*WEB49_INTERP_ADDR(elemtype *, interp, src, sizeof(elemtype)))
205205
#define WEB49_INTERP_WRITE(elemtype, interp, dest, src) (*WEB49_INTERP_ADDR(elemtype *, interp, dest, sizeof(elemtype)) = (src))
206+
#define WEB49_INTERP_V128(n) \
207+
({ \
208+
simde_v128_t *ptr = web49_malloc(sizeof(simde_v128_t));\
209+
*(__uint128_t *)ptr = *(__uint128_t *)&(n); \
210+
ptr; \
211+
})
206212

207213
#endif

0 commit comments

Comments
 (0)