From 614a9351d99e2bf36bfc032fce726c433a3a7edc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nezih=20Arhan=20T=C3=B6zenbilek?= Date: Mon, 16 Nov 2026 15:47:24 +0300 Subject: [PATCH] Name the sign extension instructions in trace output The opcode names used by opcode_repr ended at 0xbf, so in trace mode the sign extension instructions added in #333 (0xc0 to 0xc4) were printed as "OPCODE out of bounds". Add their names and take the bound from the size of the table, so a new name only has to be added in one place. Fixes #345 --- src/Utils/macros.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Utils/macros.cpp b/src/Utils/macros.cpp index 9f6a28d90..46155c8b6 100644 --- a/src/Utils/macros.cpp +++ b/src/Utils/macros.cpp @@ -201,10 +201,15 @@ const char *debug_opcodes[] = {"0x00 unreachable", "0xbc i32.reinterpret/f32", "0xbd i64.reinterpret/f64", "0xbe f32.reinterpret/i32", - "0xbf f64.reinterpret/i64"}; + "0xbf f64.reinterpret/i64", + "0xc0 i32.extend8_s", + "0xc1 i32.extend16_s", + "0xc2 i64.extend8_s", + "0xc3 i64.extend16_s", + "0xc4 i64.extend32_s"}; const char *opcode_repr(uint8_t opcode) { - if (opcode < 192) { + if (opcode < sizeof(debug_opcodes) / sizeof(debug_opcodes[0])) { return debug_opcodes[opcode]; } else { return "OPCODE out of bounds";