Bytecode
State of the contract's bytecode.
Properties
union(enum) {
raw: []u8
analyzed: AnalyzedBytecode
}Deinit
Clears the analyzed jump table.
Signature
pub fn deinit(self: @This(), allocator: Allocator) voidGetJumpTable
Returns the jump_table is the bytecode state is analyzed
otherwise it will return null.
Signature
pub fn getJumpTable(self: @This()) ?JumpTableGetCodeBytes
Grabs the bytecode independent of the current state.
Signature
pub fn getCodeBytes(self: @This()) []u8AnalyzedBytecode
Representation of the analyzed bytecode.
Properties
struct {
bytecode: []u8
original_length: usize
jump_table: JumpTable
}Init
Creates an instance of AnalyzedBytecode.
Signature
pub fn init(allocator: Allocator, raw: []u8) Allocator.Error!AnalyzedBytecodeDeinit
Free's the underlaying allocated memory Assumes that the bytecode was already padded and memory was allocated.
Signature
pub fn deinit(self: @This(), allocator: Allocator) voidJumpTable
Essentially a BitVec
Properties
struct {
bytes: []u8
}Init
Creates the jump table. Provided size must follow the two's complement.
Signature
pub fn init(
allocator: Allocator,
value: bool,
size: usize,
) Allocator.Error!JumpTableDeinit
Free's the underlaying buffer.
Signature
pub fn deinit(self: @This(), allocator: Allocator) voidSet
Sets or unset a bit at the given position.
Signature
pub fn set(
self: @This(),
position: usize,
value: bool,
) voidPeek
Gets if a bit is set at a given position.
Signature
pub fn peek(self: @This(), position: usize) u1IsValid
Check if the provided position results in a valid bit set.
Signature
pub fn isValid(self: @This(), position: usize) bool