PooledShakeBytecodeInstructionGenerator

open class PooledShakeBytecodeInstructionGenerator(val constantPool: MutableConstantPool, val bytes: MutableList<Byte> = mutableListOf<Byte>()) : ShakeBytecodeInstructionGenerator(source)

A ShakeBytecodeInstructionGenerator that uses a MutableConstantPool

Since

0.1.0

Parameters

constantPool

The constant pool to use

bytes

The bytes to use

Constructors

Link copied to clipboard
constructor(constantPool: MutableConstantPool, bytes: MutableList<Byte> = mutableListOf<Byte>())

Properties

Link copied to clipboard

The bytes of the generator

Link copied to clipboard
Link copied to clipboard
val size: Int

Get the current size of the bytecode

Functions

Link copied to clipboard
fun add(type: String)

Add the top two variables on the stack Takes the type of the variables as a string

Link copied to clipboard
fun addByte(byte: Byte): Boolean

Add a byte to the bytecode

Link copied to clipboard
fun addBytes(vararg bytes: Byte): Boolean
fun addBytes(bytes: List<Byte>): Boolean

Add a list of bytes to the bytecode

Link copied to clipboard
fun and(type: String)

Bitwise and the top two variables on the stack Takes the type of the variables as a string

Link copied to clipboard
fun badd(): Boolean

Add the top two bytes on the stack

Link copied to clipboard

Load a byte from an array The index (int) should be on the stack The array address (int) should be on the stack

Link copied to clipboard
fun band(): Boolean

Bitwise and the top two bytes on the stack

Link copied to clipboard

Store a byte in an array The value (byte) should be on the stack The index (int) should be on the stack The array address (int) should be on the stack

Link copied to clipboard
fun bcmp(): Boolean

Compare the top two bytes on the stack

Link copied to clipboard
fun bdec(): Boolean

Subtract the top two bytes on the stack

Link copied to clipboard
fun bdiv(): Boolean

Divide the top two bytes on the stack

Link copied to clipboard
fun bdup(): Boolean

Duplicate the top short on the stack

Link copied to clipboard
fun binc(): Boolean

Add the top two bytes on the stack

Link copied to clipboard
fun bload(variable: UShort): Boolean

Load a byte from the local variable table onto the stack

Link copied to clipboard
fun bmod(): Boolean

Modulo the top two bytes on the stack

Link copied to clipboard
fun bmul(): Boolean

Multiply the top two bytes on the stack

Link copied to clipboard
fun bneg(): Boolean

Negate the top byte on the stack

Link copied to clipboard
fun bnot(): Boolean

Bitwise not the top byte on the stack

Link copied to clipboard
fun bor(): Boolean

Bitwise or the top two bytes on the stack

Link copied to clipboard
Link copied to clipboard
fun bpop(): Boolean

Pop the top short on the stack

Link copied to clipboard
fun bpush(value: Boolean): Boolean

Push a boolean to the stack

fun bpush(byte: Byte): Boolean

Push a byte to the stack

@JvmName(name = "bpushUByte")
fun bpush(value: UByte): Boolean

Push an unsigned byte to the stack

Link copied to clipboard
fun bret(): Boolean

Set the top byte on the stack as return value of the function

Link copied to clipboard
fun bshl(): Boolean

Shift the top byte on the stack left by the second byte on the stack

Link copied to clipboard
fun bshr(): Boolean

Shift the top byte on the stack left by the second byte on the stack

Link copied to clipboard
fun bshru(): Boolean

Shift the top byte on the stack left by the second byte on the stack

Link copied to clipboard
fun bstore(variable: UShort): Boolean

Store a byte from the stack into the local variable table

Link copied to clipboard
fun bsub(): Boolean

Subtract the top two bytes on the stack

Link copied to clipboard
fun bxor(): Boolean

Bitwise xor the top two bytes on the stack

Link copied to clipboard
fun byteRef(value: Byte): Boolean

Add a reference to a constant pool entry

Link copied to clipboard
fun ceq(): Boolean

Adds true to the stack if the comparison result was equal to

Link copied to clipboard
fun cge(): Boolean

Adds true to the stack if the comparison result was greater than or equal to

Link copied to clipboard
fun cgt(): Boolean

Adds true to the stack if the comparison result was greater than

Link copied to clipboard
fun classRef(value: String): Boolean

Add a reference to a constant pool entry

Link copied to clipboard
fun cle(): Boolean

Adds true to the stack if the comparison result was less than or equal to

Link copied to clipboard
fun clt(): Boolean

Adds true to the stack if the comparison result was less than

Link copied to clipboard
fun cmp(type: String)

Compare the top two variables on the stack Takes the type of the variables as a string

Link copied to clipboard
fun cne(): Boolean

Adds true to the stack if the comparison result was not equal to

Link copied to clipboard
fun dadd(): Boolean

Add the top two doubles on the stack

Link copied to clipboard
fun dcmp(): Boolean

Compare the top two doubles on the stack

Link copied to clipboard
fun ddec(): Boolean

Subtract the top two doubles on the stack

Link copied to clipboard
fun ddiv(): Boolean

Divide the top two doubles on the stack

Link copied to clipboard
fun dec(type: String)

Subtract the top two variables on the stack Takes the type of the variables as a string

Link copied to clipboard
fun dinc(): Boolean

Add the top two doubles on the stack

Link copied to clipboard
fun div(type: String)

Divide the top two variables on the stack Takes the type of the variables as a string

Link copied to clipboard
fun dmod(): Boolean

Modulo the top two doubles on the stack

Link copied to clipboard
fun dmul(): Boolean

Multiply the top two doubles on the stack

Link copied to clipboard
fun dneg(): Boolean

Negate the top double on the stack

Link copied to clipboard
fun doubleRef(value: Double): Boolean

Add a reference to a constant pool entry

Link copied to clipboard
fun dsub(): Boolean

Subtract the top two doubles on the stack

Link copied to clipboard
fun dup(): Boolean

Duplicate the top byte on the stack

fun dup(type: String)

Duplicate the top variable on the stack Takes the type of the variable as a string

Link copied to clipboard
fun fadd(): Boolean

Add the top two floats on the stack

Link copied to clipboard
fun fcmp(): Boolean

Compare the top two floats on the stack

Link copied to clipboard
fun fdec(): Boolean

Subtract the top two floats on the stack

Link copied to clipboard
fun fdiv(): Boolean

Divide the top two floats on the stack

Link copied to clipboard
fun finc(): Boolean

Add the top two floats on the stack

Link copied to clipboard
fun floatRef(value: Float): Boolean

Add a reference to a constant pool entry

Link copied to clipboard
fun fmod(): Boolean

Modulo the top two floats on the stack

Link copied to clipboard
fun fmul(): Boolean

Multiply the top two floats on the stack

Link copied to clipboard
fun fneg(): Boolean

Negate the top float on the stack

Link copied to clipboard
fun fsub(): Boolean

Subtract the top two floats on the stack

Link copied to clipboard
fun iadd(): Boolean

Add the top two ints on the stack

Link copied to clipboard

Load an int from an array The index (int) should be on the stack The array address (int) should be on the stack

Link copied to clipboard
fun iand(): Boolean

Bitwise and the top two ints on the stack

Link copied to clipboard

Store an int in an array The value (int) should be on the stack The index (int) should be on the stack The array address (int) should be on the stack

Link copied to clipboard
fun icmp(): Boolean

Compare the top two ints on the stack

Link copied to clipboard
fun idec(): Boolean

Subtract the top two ints on the stack

Link copied to clipboard
fun idiv(): Boolean

Divide the top two ints on the stack

Link copied to clipboard
fun idup(): Boolean

Duplicate the top long on the stack

Link copied to clipboard
fun iinc(): Boolean

Add the top two ints on the stack

Link copied to clipboard
fun iload(variable: UShort): Boolean

Load an int from the local variable table onto the stack

Link copied to clipboard
fun imod(): Boolean

Modulo the top two ints on the stack

Link copied to clipboard
fun imul(): Boolean

Multiply the top two ints on the stack

Link copied to clipboard
fun inc(type: String)

Add the top two variables on the stack Takes the type of the variables as a string

Link copied to clipboard
fun ineg(): Boolean

Negate the top int on the stack

Link copied to clipboard
fun inot(): Boolean

Bitwise not the top int on the stack

Link copied to clipboard
fun intRef(value: Int): Boolean

Add a reference to a constant pool entry

Link copied to clipboard
fun invoke_static(descriptor: String)

Invoke a function

Invoke a function The address int should point to an utf8 constant pool entry in the constant pool Parameters should be on the stack

fun invoke_static(address: Int): Boolean

Invoke a function The address int should point to an utf8 constant pool entry in the constant pool

Link copied to clipboard
fun invoke_virtual(descriptor: String)

Invoke a function on an object

fun invoke_virtual(address: Int): Boolean

Invoke a function on an object The address int should point to an utf8 constant pool entry in the constant pool Parameters, and the object should be on the stack. The object should be on the stack

Link copied to clipboard
fun ior(): Boolean

Bitwise or the top two ints on the stack

Link copied to clipboard
Link copied to clipboard
fun ipop(): Boolean

Pop the top long on the stack

Link copied to clipboard
fun ipush(value: Float): Boolean

Push a float to the stack

fun ipush(int: Int): Boolean

Push an int to the stack

@JvmName(name = "ipushUInt")
fun ipush(value: UInt): Boolean

Push an unsigned int to the stack

Link copied to clipboard
fun iret(): Boolean

Set the top int on the stack as return value of the function

Link copied to clipboard
fun ishl(): Boolean

Shift the top int on the stack left by the second int on the stack

Link copied to clipboard
fun ishr(): Boolean

Shift the top int on the stack left by the second int on the stack

Link copied to clipboard
fun ishru(): Boolean

Shift the top int on the stack left by the second int on the stack

Link copied to clipboard
fun istore(variable: UShort): Boolean

Store an int from the stack into the local variable table

Link copied to clipboard
fun isub(): Boolean

Subtract the top two ints on the stack

Link copied to clipboard
fun ixor(): Boolean

Bitwise xor the top two ints on the stack

Link copied to clipboard
fun je(address: Int): Boolean

Jump to the given address if the comparison result was equal to

Link copied to clipboard
fun jge(address: Int): Boolean

Jump to the given address if the comparison result was greater than or equal to

Link copied to clipboard
fun jgt(address: Int): Boolean

Jump to the given address if the comparison result was greater than

Link copied to clipboard
fun jle(address: Int): Boolean

Jump to the given address if the comparison result was less than or equal to

Link copied to clipboard
fun jlt(address: Int): Boolean

Jump to the given address if the comparison result was less than

Link copied to clipboard
fun jmp(address: Int): Boolean

Jump to the given address

Link copied to clipboard
fun jne(address: Int): Boolean

Jump to the given address if the comparison result was not equal to

Link copied to clipboard
fun jnz(address: Int): Boolean

Jump to the given address if the top variable byte on the stack is not 0

Link copied to clipboard
fun jz(address: Int): Boolean

Jump to the given address if the top variable byte on the stack is 0

Link copied to clipboard
fun ladd(): Boolean

Add the top two longs on the stack

Link copied to clipboard

Load a long from an array The index (int) should be on the stack The array address (int) should be on the stack

Link copied to clipboard
fun land(): Boolean

Bitwise and the top two longs on the stack

Link copied to clipboard

Store a long in an array The value (long) should be on the stack The index (int) should be on the stack The array address (int) should be on the stack

Link copied to clipboard
fun lcmp(): Boolean

Compare the top two longs on the stack

Link copied to clipboard
fun ldec(): Boolean

Subtract the top two longs on the stack

Link copied to clipboard
fun ldiv(): Boolean

Divide the top two longs on the stack

Link copied to clipboard
fun ldup(): Boolean

Duplicate the top float on the stack

Link copied to clipboard
fun linc(): Boolean

Add the top two longs on the stack

Link copied to clipboard
fun lload(variable: UShort): Boolean

Load a long from the local variable table onto the stack

Link copied to clipboard
fun lmod(): Boolean

Modulo the top two longs on the stack

Link copied to clipboard
fun lmul(): Boolean

Multiply the top two longs on the stack

Link copied to clipboard
fun lneg(): Boolean

Negate the top long on the stack

Link copied to clipboard
fun lnot(): Boolean

Bitwise not the top long on the stack

Link copied to clipboard
fun load(type: String, variable: UShort)

Load a variable from the local variable table onto the stack Takes the type of the variable as a string

Link copied to clipboard
fun load_static(descriptor: String)

Load a static variable

fun load_static(address: Int): Boolean

Load a static variable The address int should point to an utf8 constant pool entry

Link copied to clipboard
fun load_virtual(descriptor: String)

Load a virtual variable

fun load_virtual(address: Int): Boolean

Load a virtual variable The address int should point to an utf8 constant pool entry

Link copied to clipboard
fun longRef(value: Long): Boolean

Add a reference to a constant pool entry

Link copied to clipboard
fun lor(): Boolean

Bitwise or the top two longs on the stack

Link copied to clipboard
Link copied to clipboard
fun lpop(): Boolean

Pop the top float on the stack

Link copied to clipboard
fun lpush(value: Double): Boolean

Push a double to the stack

fun lpush(long: Long): Boolean

Push a long to the stack

@JvmName(name = "lpushULong")
fun lpush(value: ULong): Boolean

Push an unsigned long to the stack

Link copied to clipboard
fun lret(): Boolean

Set the top long on the stack as return value of the function

Link copied to clipboard
fun lshl(): Boolean

Shift the top long on the stack left by the second long on the stack

Link copied to clipboard
fun lshr(): Boolean

Shift the top long on the stack left by the second long on the stack

Link copied to clipboard
fun lshru(): Boolean

Shift the top long on the stack left by the second long on the stack

Link copied to clipboard
fun lstore(variable: UShort): Boolean

Store a long from the stack into the local variable table

Link copied to clipboard
fun lsub(): Boolean

Subtract the top two longs on the stack

Link copied to clipboard
fun lxor(): Boolean

Bitwise xor the top two longs on the stack

Link copied to clipboard
fun mod(type: String)

Modulo the top two variables on the stack Takes the type of the variables as a string

Link copied to clipboard
fun mul(type: String)

Multiply the top two variables on the stack Takes the type of the variables as a string

Link copied to clipboard
fun neg(type: String)

Negate the top variable on the stack Takes the type of the variable as a string

Link copied to clipboard
fun new_array(descriptor: String)
fun new_array(type: Int): Boolean

Create a new array The type is stored in an utf8 constant pool entry

Link copied to clipboard
fun new_obj(descriptor: String)
fun new_obj(type: Int): Boolean

Create a new object The type is stored in an utf8 constant pool entry

Link copied to clipboard
fun nop(): Boolean

Add a nop instruction to the bytecode

Link copied to clipboard
fun not(type: String)

Bitwise not the top variable on the stack Takes the type of the variable as a string

Link copied to clipboard
fun or(type: String)

Bitwise or the top two variables on the stack Take the type of the variables as a string

Link copied to clipboard
fun pcast(from: String, to: String)

fun pcast(from: UByte, to: UByte): Boolean

Perform a cast operation on the top of the stack

Link copied to clipboard
fun pointer(): Int

Get a pointer to the current position in the bytecode

Link copied to clipboard
fun pop(): Boolean

Pop the top byte on the stack

fun pop(type: String)

Pop the top variable on the stack Takes the type of the variable as a string

Link copied to clipboard
fun ret(): Boolean

Return from the current function

fun ret(type: String)

Return the given type from the current function Takes the type of the return value as a string

Link copied to clipboard
fun sadd(): Boolean

Add the top two shorts on the stack

Link copied to clipboard

Load a short from an array The index (int) should be on the stack The array address (int) should be on the stack

Link copied to clipboard
fun sand(): Boolean

Bitwise and the top two shorts on the stack

Link copied to clipboard

Store a short in an array The value (short) should be on the stack The index (int) should be on the stack The array address (int) should be on the stack

Link copied to clipboard
fun scmp(): Boolean

Compare the top two shorts on the stack

Link copied to clipboard
fun sdec(): Boolean

Subtract the top two shorts on the stack

Link copied to clipboard
fun sdiv(): Boolean

Divide the top two shorts on the stack

Link copied to clipboard
fun sdup(): Boolean

Duplicate the top int on the stack

Link copied to clipboard
fun shl(type: String)

Shift the top variable on the stack left by the second variable on the stack Takes the type of the variables as a string

Link copied to clipboard
fun shortRef(value: Short): Boolean

Add a reference to a constant pool entry

Link copied to clipboard
fun shr(type: String)

Shift the top variable on the stack left by the second variable on the stack Takes the type of the variables as a string

Link copied to clipboard
fun shru(type: String)

Shift the top variable on the stack left by the second variable on the stack Takes the type of the variables as a string

Link copied to clipboard
fun sinc(): Boolean

Add the top two shorts on the stack

Link copied to clipboard
fun sload(variable: UShort): Boolean

Load a short from the local variable table onto the stack

Link copied to clipboard
fun smod(): Boolean

Modulo the top two shorts on the stack

Link copied to clipboard
fun smul(): Boolean

Multiply the top two shorts on the stack

Link copied to clipboard
fun sneg(): Boolean

Negate the top short on the stack

Link copied to clipboard
fun snot(): Boolean

Bitwise not the top short on the stack

Link copied to clipboard
fun sor(): Boolean

Bitwise or the top two shorts on the stack

Link copied to clipboard
Link copied to clipboard
fun spop(): Boolean

Pop the top int on the stack

Link copied to clipboard
fun spush(value: Char): Boolean

Push a char to the stack

fun spush(short: Short): Boolean

Push a short to the stack

@JvmName(name = "spushUShort")
fun spush(value: UShort): Boolean

Push an unsigned short to the stack

Link copied to clipboard
fun sret(): Boolean

Set the top short on the stack as return value of the function

Link copied to clipboard
fun sshl(): Boolean

Shift the top short on the stack left by the second short on the stack

Link copied to clipboard
fun sshr(): Boolean

Shift the top short on the stack left by the second short on the stack

Link copied to clipboard
fun sshru(): Boolean

Shift the top short on the stack left by the second short on the stack

Link copied to clipboard
fun sstore(variable: UShort): Boolean

Store a short from the stack into the local variable table

Link copied to clipboard
fun ssub(): Boolean

Subtract the top two shorts on the stack

Link copied to clipboard
fun store(type: String, variable: UShort)

Store a variable from the stack into the local variable table Takes the type of the variable as a string

Link copied to clipboard
fun store_static(descriptor: String)

Store a static variable

fun store_static(address: Int): Boolean

Store a static variable The address int should point to an utf8 constant pool entry The value should be on the stack

Link copied to clipboard
fun store_virtual(descriptor: String)

Store a virtual variable

fun store_virtual(address: Int): Boolean

Store a virtual variable The address int should point to an utf8 constant pool entry The value should be on the stack

Link copied to clipboard
fun sub(type: String)

Subtract the top two variables on the stack Takes the type of the variables as a string

Link copied to clipboard
fun sxor(): Boolean

Bitwise xor the top two shorts on the stack

Link copied to clipboard

Output a ByteArray of the bytecode

Link copied to clipboard
fun ubcmp(): Boolean

Compare the top two unsigned bytes on the stack

Link copied to clipboard
fun ubdiv(): Boolean

Divide the top two unsigned bytes on the stack

Link copied to clipboard
fun ubmod(): Boolean

Modulo the top two unsigned bytes on the stack

Link copied to clipboard
fun ubmul(): Boolean

Multiply the top two unsigned bytes on the stack

Link copied to clipboard
fun ubsub(): Boolean

Subtract the top two unsigned bytes on the stack

Link copied to clipboard
fun uicmp(): Boolean

Compare the top two unsigned ints on the stack

Link copied to clipboard
fun uidiv(): Boolean

Divide the top two unsigned ints on the stack

Link copied to clipboard
fun uimod(): Boolean

Modulo the top two unsigned ints on the stack

Link copied to clipboard
fun uimul(): Boolean

Multiply the top two unsigned ints on the stack

Link copied to clipboard
fun uisub(): Boolean

Subtract the top two unsigned ints on the stack

Link copied to clipboard
fun ulcmp(): Boolean

Compare the top two unsigned longs on the stack

Link copied to clipboard
fun uldiv(): Boolean

Divide the top two unsigned longs on the stack

Link copied to clipboard
fun ulmod(): Boolean

Modulo the top two unsigned longs on the stack

Link copied to clipboard
fun ulmul(): Boolean

Multiply the top two unsigned longs on the stack

Link copied to clipboard
fun ulsub(): Boolean

Subtract the top two unsigned longs on the stack

Link copied to clipboard
fun uscmp(): Boolean

Compare the top two unsigned shorts on the stack

Link copied to clipboard
fun usdiv(): Boolean

Divide the top two unsigned shorts on the stack

Link copied to clipboard
fun usmod(): Boolean

Modulo the top two unsigned shorts on the stack

Link copied to clipboard
fun usmul(): Boolean

Multiply the top two unsigned shorts on the stack

Link copied to clipboard
fun ussub(): Boolean

Subtract the top two unsigned shorts on the stack

Link copied to clipboard
fun utf8Ref(value: String): Boolean

Add a reference to a constant pool entry

Link copied to clipboard
fun xor(type: String)

Bitwise xor the top two variables on the stack Takes the type of the variables as a string