From c8de23f6787b4205b405d80c82bed9d7b3427ec3 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Sun, 14 Jun 2026 19:22:31 +0100 Subject: [PATCH] Minimize arm64 decoding table --- core/rexcode/arm64/decoding_tables.odin | 30 +++++++++---------- core/rexcode/arm64/encoding_table.odin | 2 +- .../arm64/tools/gen_decode_tables.odin | 6 ++-- 3 files changed, 17 insertions(+), 21 deletions(-) diff --git a/core/rexcode/arm64/decoding_tables.odin b/core/rexcode/arm64/decoding_tables.odin index 94f0e2461..c0b43c17a 100644 --- a/core/rexcode/arm64/decoding_tables.odin +++ b/core/rexcode/arm64/decoding_tables.odin @@ -1230,21 +1230,19 @@ DECODE_ENTRIES := [1198]Decode_Entry{ @(rodata) DECODE_INDEX_OP0 := [16]Decode_Index{ - /* 0 */ {0, 75}, - /* 1 */ {0, 0}, - /* 2 */ {75, 379}, - /* 3 */ {0, 0}, - /* 4 */ {454, 76}, - /* 5 */ {530, 50}, - /* 6 */ {580, 8}, - /* 7 */ {588, 93}, - /* 8 */ {681, 16}, - /* 9 */ {697, 34}, - /* A */ {731, 98}, - /* B */ {829, 21}, - /* C */ {850, 150}, - /* D */ {1000, 84}, - /* E */ {1084, 13}, - /* F */ {1097, 101}, + 0x00 = {0, 75}, + 0x02 = {75, 379}, + 0x04 = {454, 76}, + 0x05 = {530, 50}, + 0x06 = {580, 8}, + 0x07 = {588, 93}, + 0x08 = {681, 16}, + 0x09 = {697, 34}, + 0x0A = {731, 98}, + 0x0B = {829, 21}, + 0x0C = {850, 150}, + 0x0D = {1000, 84}, + 0x0E = {1084, 13}, + 0x0F = {1097, 101}, } diff --git a/core/rexcode/arm64/encoding_table.odin b/core/rexcode/arm64/encoding_table.odin index 36aea822d..50664ece8 100644 --- a/core/rexcode/arm64/encoding_table.odin +++ b/core/rexcode/arm64/encoding_table.odin @@ -26,7 +26,7 @@ package rexcode_arm64 // immediate encoding (N:imms:immr); they're deferred to a follow-up // turn that adds the bitmask encoder helper. @(rodata) -ENCODING_TABLE: [Mnemonic][]Encoding = #partial { +ENCODING_TABLE := #partial [Mnemonic][]Encoding{ .INVALID = {}, // ========================================================================= diff --git a/core/rexcode/arm64/tools/gen_decode_tables.odin b/core/rexcode/arm64/tools/gen_decode_tables.odin index 2065db0e8..6ac09a025 100644 --- a/core/rexcode/arm64/tools/gen_decode_tables.odin +++ b/core/rexcode/arm64/tools/gen_decode_tables.odin @@ -177,10 +177,8 @@ emit_range_table :: proc(sb: ^strings.Builder, name: string, ranges: []Range) { fmt.sbprintfln(sb, "@(rodata)") fmt.sbprintfln(sb, "%s := [%d]Decode_Index{{", name, len(ranges)) for r, i in ranges { - if r.count == 0 { - fmt.sbprintfln(sb, "\t/* %X */ {{0, 0}},", i) - } else { - fmt.sbprintfln(sb, "\t/* %X */ {{%d, %d}},", i, r.start, r.count) + if r.count != 0 { + fmt.sbprintfln(sb, "\t0x%02X = {{%d, %d}},", i, r.start, r.count) } } strings.write_string(sb, "}\n\n")