Skip to content
Closed
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
2 changes: 1 addition & 1 deletion src/wasm-ast-writer.c
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ static void write_expr(Context* ctx, const WasmExpr* expr) {
}

case WASM_EXPR_TYPE_CALL:
write_puts_space(ctx, wasm_get_opcode_name(WASM_OPCODE_CALL_FUNCTION));
write_puts_space(ctx, wasm_get_opcode_name(WASM_OPCODE_CALL));
write_var(ctx, &expr->call.var, NEXT_CHAR_NEWLINE);
break;

Expand Down
2 changes: 1 addition & 1 deletion src/wasm-binary-reader-interpreter.c
Original file line number Diff line number Diff line change
Expand Up @@ -1093,7 +1093,7 @@ static WasmResult on_call_expr(uint32_t func_index, void* user_data) {
CHECK_RESULT(emit_opcode(ctx, WASM_OPCODE_CALL_HOST));
CHECK_RESULT(emit_i32(ctx, func_index));
} else {
CHECK_RESULT(emit_opcode(ctx, WASM_OPCODE_CALL_FUNCTION));
CHECK_RESULT(emit_opcode(ctx, WASM_OPCODE_CALL));
CHECK_RESULT(emit_func_offset(ctx, func, func_index));
}
push_types(ctx, &sig->result_types);
Expand Down
6 changes: 3 additions & 3 deletions src/wasm-binary-reader.c
Original file line number Diff line number Diff line change
Expand Up @@ -1414,11 +1414,11 @@ static void read_function_body(Context* ctx,
break;
}

case WASM_OPCODE_CALL_FUNCTION: {
case WASM_OPCODE_CALL: {
uint32_t func_index;
in_u32_leb128(ctx, &func_index, "call_function function index");
in_u32_leb128(ctx, &func_index, "call function index");
RAISE_ERROR_UNLESS(func_index < num_total_funcs(ctx),
"invalid call_function function index");
"invalid call function index");
CALLBACK(on_call_expr, func_index);
CALLBACK_CTX(on_opcode_uint32, func_index);
break;
Expand Down
2 changes: 1 addition & 1 deletion src/wasm-binary-writer.c
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ static void write_expr(Context* ctx,
case WASM_EXPR_TYPE_CALL: {
int index = wasm_get_func_index_by_var(module, &expr->call.var);
assert(index >= 0 && (size_t)index < module->funcs.size);
write_opcode(&ctx->stream, WASM_OPCODE_CALL_FUNCTION);
write_opcode(&ctx->stream, WASM_OPCODE_CALL);
write_u32_leb128(&ctx->stream, index, "func index");
break;
}
Expand Down
342 changes: 171 additions & 171 deletions src/wasm-common.h

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions src/wasm-interpreter.c
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,7 @@ WasmInterpreterResult wasm_run_interpreter(WasmInterpreterModule* module,
PICK(read_u32(&pc)) = TOP();
break;

case WASM_OPCODE_CALL_FUNCTION: {
case WASM_OPCODE_CALL: {
uint32_t offset = read_u32(&pc);
PUSH_CALL();
GOTO(offset);
Expand Down Expand Up @@ -1662,7 +1662,7 @@ void wasm_trace_pc(WasmInterpreterModule* module,
TOP().i32);
break;

case WASM_OPCODE_CALL_FUNCTION:
case WASM_OPCODE_CALL:
wasm_writef(stream, "%s @%u\n", wasm_get_interpreter_opcode_name(opcode),
read_u32_at(pc));
break;
Expand Down Expand Up @@ -2017,7 +2017,7 @@ void wasm_disassemble_module(WasmInterpreterModule* module,
wasm_get_interpreter_opcode_name(opcode), read_u32(&pc));
break;

case WASM_OPCODE_CALL_FUNCTION:
case WASM_OPCODE_CALL:
wasm_writef(stream, "%s @%u\n",
wasm_get_interpreter_opcode_name(opcode), read_u32(&pc));
break;
Expand Down
38 changes: 19 additions & 19 deletions test/dump/basic.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,35 +58,35 @@
; function body 0
0000024: 00 ; func body size (guess)
0000025: 00 ; local decl count
0000026: 10 ; i32.const
0000026: 41 ; i32.const
0000027: 00 ; i32 literal
0000028: 10 ; i32.const
0000028: 41 ; i32.const
0000029: 00 ; i32 literal
000002a: 2a ; i32.load
000002a: 28 ; i32.load
000002b: 02 ; alignment
000002c: 00 ; load offset
000002d: 10 ; i32.const
000002d: 41 ; i32.const
000002e: 01 ; i32 literal
000002f: 40 ; i32.add
0000030: 33 ; i32.store
000002f: 6a ; i32.add
0000030: 36 ; i32.store
0000031: 02 ; alignment
0000032: 00 ; store offset
0000033: 14 ; get_local
0000033: 20 ; get_local
0000034: 00 ; local index
0000035: 14 ; get_local
0000035: 20 ; get_local
0000036: 01 ; local index
0000037: 40 ; i32.add
0000038: 0f ; end
0000037: 6a ; i32.add
0000038: 0b ; end
0000024: 14 ; FIXUP func body size
0000022: 16 ; FIXUP section size
func 0
000026: 10 00 | i32.const 0
000028: 10 00 | i32.const 0
00002a: 2a 02 00 | i32.load 2 0
00002d: 10 01 | i32.const 0x1
00002f: 40 | i32.add
000030: 33 02 00 | i32.store 2 0
000033: 14 00 | get_local 0
000035: 14 01 | get_local 0x1
000037: 40 | i32.add
000026: 41 00 | i32.const 0
000028: 41 00 | i32.const 0
00002a: 28 02 00 | i32.load 2 0
00002d: 41 01 | i32.const 0x1
00002f: 6a | i32.add
000030: 36 02 00 | i32.store 2 0
000033: 20 00 | get_local 0
000035: 20 01 | get_local 0x1
000037: 6a | i32.add
;;; STDOUT ;;)
18 changes: 9 additions & 9 deletions test/dump/basic_dump_only.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
(export "f" (func $f)))
(;; STDOUT ;;;
func 0
000026: 10 00 | i32.const 0
000028: 10 00 | i32.const 0
00002a: 2a 02 00 | i32.load 2 0
00002d: 10 01 | i32.const 0x1
00002f: 40 | i32.add
000030: 33 02 00 | i32.store 2 0
000033: 14 00 | get_local 0
000035: 14 01 | get_local 0x1
000037: 40 | i32.add
000026: 41 00 | i32.const 0
000028: 41 00 | i32.const 0
00002a: 28 02 00 | i32.load 2 0
00002d: 41 01 | i32.const 0x1
00002f: 6a | i32.add
000030: 36 02 00 | i32.store 2 0
000033: 20 00 | get_local 0
000035: 20 01 | get_local 0x1
000037: 6a | i32.add
;;; STDOUT ;;)
Loading