21 lines
732 B
C
21 lines
732 B
C
// compact.h -- Release build bytecode compaction
|
|
//
|
|
// Removes OP_LINE instructions from the module's bytecode and
|
|
// rewrites all code-address references (proc entries, CALL operands,
|
|
// JMP/FOR_NEXT/ON_ERROR relative offsets, GOSUB return addresses,
|
|
// and formVarInfo init code addresses).
|
|
//
|
|
// Safe by construction: if any sanity check fails (unknown opcode,
|
|
// offset overflow, walk not landing on codeLen, etc.), the module
|
|
// is left unchanged and the function returns 0.
|
|
|
|
#ifndef DVXBASIC_COMPACT_H
|
|
#define DVXBASIC_COMPACT_H
|
|
|
|
#include "../runtime/vm.h"
|
|
#include <stdint.h>
|
|
|
|
// Returns the number of bytes removed, or 0 if compaction was skipped.
|
|
int32_t basCompactBytecode(BasModuleT *mod);
|
|
|
|
#endif // DVXBASIC_COMPACT_H
|