commit 97238188cfb3c8165308a368f110e0238be5841b
parent c401c898f3c491850114c73b6565ff10c28634e8
Author: Gabriel G. de Brito (AKA 96) <gabrielgbrito@icloud.com>
Date: Thu, 12 Sep 2024 17:05:51 -0300
Merge pull request #26 from PBnJK/struct_reorder
Restructured structs to save on memory
Diffstat:
2 files changed, 13 insertions(+), 14 deletions(-)
diff --git a/assembler/assembler.go b/assembler/assembler.go
@@ -26,21 +26,21 @@ var InterCtx *intergo.InterContext
// Can be a label, an instruction, an argument or a literal. All directives are
// resolved in the tokenizer stage.
type Token struct {
- Line int
File *string
- Type int
Value []byte
+ Line int
+ Type int
}
// This token is specifically an instruction. An array of these is passed to the
// debugger.
type DebuggerToken struct {
- Line int
- File *string
Instruction string
+ Label string
+ File *string
Args []string
Address uint64
- Label string
+ Line int
}
// This kind of token can be only instructions and literals (only instructions
@@ -48,22 +48,22 @@ type DebuggerToken struct {
// field is reserved for architecture-specific use (example: storing information
// regarding the addressing mode in 6502).
type ResolvedToken struct {
- Line int
File *string
- Type int
- Address uint64
- Value []byte
Args []uint64
+ Value []byte
+ Address uint64
+ Line int
+ Type int
Reserved uintptr
}
// For intermediate reasons.
type Instruction struct {
- Line int
- File *string
Mnemonic string
+ File *string
Args []string
Size uint64
+ Line int
Reserved uintptr
}
diff --git a/debugger.go b/debugger.go
@@ -19,10 +19,10 @@ import (
type Breakpoint struct {
// nil if no file.
File *string
- // This is only valid if File is non-nil, of course.
- Line int
// Empty if no label
Label string
+ // This is only valid if File is non-nil, of course.
+ Line int
// This one always exists.
Address uint64
}
@@ -390,7 +390,6 @@ func parseBreakpoint(arg string, sym []assembler.DebuggerToken) (Breakpoint, err
}
}
}
-
}
}