Skip to content
This repository has been archived by the owner on Oct 20, 2024. It is now read-only.

Redundant code tables at the end of the bytecode #304

Open
spacelan opened this issue Oct 12, 2023 · 0 comments
Open

Redundant code tables at the end of the bytecode #304

spacelan opened this issue Oct 12, 2023 · 0 comments

Comments

@spacelan
Copy link

spacelan commented Oct 12, 2023

It seems that referencing the same code table in different macros causes huff compiler to repeatedly append the code table to the end of the bytecode:

#define table CODETABLE {
    0x00abcd00
}

#define macro MAIN() = takes(0) returns(0) {
    __tablestart(CODETABLE)
    FOO()
}

#define macro FOO() = takes(0) returns(0) {
    __tablestart(CODETABLE)
}

$ huffc tmp.huff -r
⠙ Compiling... 
61000a61000a00abcd0000abcd00

But the code table addresses are same:

$ cast da 61000a61000a00abcd0000abcd00
00000000: PUSH2 0xa
00000003: PUSH2 0xa
00000006: STOP
00000007: INVALID
00000008: INVALID
00000009: STOP
0000000a: STOP
0000000b: INVALID
0000000c: INVALID
0000000d: STOP

@clabby

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant