From 182f234ed238784d7150547950fddc660bd9dc9a Mon Sep 17 00:00:00 2001 From: gingerBill Date: Mon, 15 Jun 2026 14:37:25 +0100 Subject: [PATCH] Minimize rsp Instruction and Operand --- core/rexcode/rsp/instructions.odin | 6 +++--- core/rexcode/rsp/operands.odin | 5 ++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/core/rexcode/rsp/instructions.odin b/core/rexcode/rsp/instructions.odin index c37fd472c..b3f0c964c 100644 --- a/core/rexcode/rsp/instructions.odin +++ b/core/rexcode/rsp/instructions.odin @@ -11,14 +11,14 @@ Instruction_Flags :: bit_field u8 { } Instruction :: struct #packed { - ops: [4]Operand `fmt:"v,operand_count"`, // 64 bytes + ops: [4]Operand `fmt:"v,operand_count"`, // 48 bytes mnemonic: Mnemonic, // 2 bytes operand_count: u8, // 1 byte flags: Instruction_Flags, // 1 byte length: u8, // 1 byte (always 4) - _: [3]u8, // 3 bytes + _: [11]u8, // 11 bytes } -#assert(size_of(Instruction) == 72) +#assert(size_of(Instruction) == 64) // ============================================================================= // Builders (mirror x86/mips conventions) diff --git a/core/rexcode/rsp/operands.odin b/core/rexcode/rsp/operands.odin index f291c3e9c..de96ef6d9 100644 --- a/core/rexcode/rsp/operands.odin +++ b/core/rexcode/rsp/operands.odin @@ -46,7 +46,6 @@ vmem :: #force_inline proc "contextless" (base: Register, element: u8, offset: i return Vector_Mem{base = base, element = element, offset = offset} } -// Operand: 16-byte tagged union. Operand :: struct #packed { using _: struct #raw_union { reg: Register, // for REGISTER and VECTOR_REG @@ -58,9 +57,9 @@ Operand :: struct #packed { kind: Operand_Kind, // 1 byte size: u8, // 1 byte element: u8, // 1 byte — for VECTOR_REG - _: [5]u8, + _: [1]u8, } -#assert(size_of(Operand) == 16) +#assert(size_of(Operand) == 12) @(require_results) op_reg :: #force_inline proc "contextless" (r: Register) -> Operand {