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

Redundant code tables at the end of the bytecode #304

@spacelan

Description

@spacelan

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions