module JInstruction:sig..end
Conversion between low and high level representations of instructions.
val opcodes2code : JBasics.constant array ->
JBasics.bootstrap_method array -> JClassLow.opcode array -> JCode.jopcodesMaps an arrray of low level bytecode to a high level code. Each instruction is at the index corresponding to its absolute offset. The array is padded with the OpInvalid instruction. The absolute and relative offset that appear in the instructions are therefore valid positions in the array. OpInvalid may be interpreted as nop, or the direct successor of an instruction can alternatively by defined as the first following non-OpInvalid instruction.
val code2opcodes : JBasics.constant JLib.DynArray.t ->
JBasics.bootstrap_method JLib.DynArray.t ->
JCode.jopcodes -> JClassLow.opcode arrayMaps a high level code to a valid arrray of low level bytecode instructions. The distance between the offset of two successive non-OpInvalid instructions is assumed to be at least the length of the optimal coding for the first instruction (for example, iload_0 vs iload 0). The opcode may be encoded with the non-optimal form to fill the available space.
Class_structure_error if the length of an opcode produced is greater
than the available space (number of OpInvalid + 1) except if
JBasics.set_permissive has been called with true. Note that this
will only be an issue when dumping the code to a class file.val opcode2instruction : JBasics.constant array ->
JBasics.bootstrap_method array -> JClassLow.opcode -> JCode.jopcodeLow level to high level bytecode instruction.
val instruction2opcode : JBasics.constant JLib.DynArray.t ->
JBasics.bootstrap_method JLib.DynArray.t ->
int -> JCode.jopcode -> JClassLow.opcodeHigh level to low level bytecode instruction.
instruction2opcode consts length instr tries to produce an
opcode which could be unparsed in length byte(s).
JBasics.Class_structure_error if the class has not a valid structure.