-
Notifications
You must be signed in to change notification settings - Fork 0
Bytecode & Length patching
hydrophobis edited this page Mar 25, 2025
·
2 revisions
These functions manage the bytecode section of the Java class file. The bytecode section contains the actual instructions that the JVM will execute.
-
void bytecode_start()
Initializes the bytecode section. Reserves space for thebytecode_lengthand sets the offset for the bytecode. -
void ldc(1)Loads the first constant onto the stack -
void bytecode_end()
Finalizes the bytecode section by patching thebytecode_lengthat the reserved location.
-
void patch_u4(size_t pos, uint32_t v)
Updates a 4-byte value in the buffer (used to finalizebytecode_length). -
size_t current_offset()
Returns the current offset in the bytecode buffer.
bytecode_start();
// bytecode functions go here
bytecode_end();This will create a bytecode section with the proper length.