Opcode Reference - greenboxal/libadreno GitHub Wiki
This page details all opcodes of the current version of AdrenoVM bytecode interpreter.
ldnull
Loads a null value onto the evaluation stack.
ldnum
Loads a integral value onto the evaluation stack.
Variants
- ldnum.m1 - Loads -1 on top of the evaluation stack
- ldnum.0 - Loads 0 on top of the evaluation stack
- ldnum.1 - Loads 1 on top of the evaluation stack
ldfloat
Loads a floating number onto the evaluation stack.
ldstr
Loads a string onto the evaluation stack.
ldhash
Loads a hash(like Ruby hashes) onto the evaluation stack.
Remarks
When compiling with debug information the original string is saved on the Assembly.
ldcls
Loads a class definition on top of the evaluation stack. Classes can be used either as a base for the new opcode or as common object.
Remarks
Like hashes, the original class name is saved only when compiling with debug information.
ldarg.s
Loads an argument (referenced by a specified index value) onto the stack.
Variants
- ldarg.0
- Loads the argument at index 0 onto the evaluation stack.
- ldarg.1
- Loads the argument at index 1 onto the evaluation stack.
- ldarg.2
- Loads the argument at index 2 onto the evaluation stack.
- ldarg.3
- Loads the argument at index 3 onto the evaluation stack.
ldargs
Load the remaining arguments starting at the index n
into an array object. Works like the following ruby code:
def func(*args)
ldloc.s
Loads the local variable at a specific index onto the evaluation stack.
Variants
- ldloc.0
- Loads the local variable at index 0 onto the evaluation stack.
- ldloc.1
- Loads the local variable at index 1 onto the evaluation stack.
- ldloc.2
- Loads the local variable at index 2 onto the evaluation stack.
- ldloc.3
- Loads the local variable at index 3 onto the evaluation stack.
Pops the current value from the top of the evaluation stack and stores it in a the local variable list at a specified index.
Variants
- stloc.0
- Pops the current value from the top of the evaluation stack and stores it in a the local variable list at index 0.
- stloc.1
- Pops the current value from the top of the evaluation stack and stores it in a the local variable list at index 1.
- stloc.2
- Pops the current value from the top of the evaluation stack and stores it in a the local variable list at index 2.
- stloc.3
- Pops the current value from the top of the evaluation stack and stores it in a the local variable list at index 3.
new
Pushes a new instance of an object or class onto the evaluation stack.
Remarks
The stack transitional behavior, in sequential order, is:
- The class or object to be copied is pushed onto the evaluation stack.
- Arguments arg1 through argn are pushed on the stack in sequence.
- Arguments argn through arg1 are popped from the stack and passed to ctor for object creation.
- A reference to the new object is pushed onto the stack.
add
Adds two values and pushes the result onto the evaluation stack.
sub
Subtracts one value from another and pushes the result onto the evaluation stack.
mul
Multiplies two values and pushes the result on the evaluation stack.
div
Divides two values and pushes the result as a float or integral(quotient) onto the evaluation stack.
rem
Divides two values and pushes the remainder onto the evaluation stack.
and
Computes the bitwise AND of two values and pushes the result onto the evaluation stack.
or
Computes the bitwise OR of two values and pushes the result onto the evaluation stack.
xor
Computes the bitwise XOR of two values and pushes the result onto the evaluation stack.
not
Computes the bitwise complement of the integer value on top of the stack and pushes the result onto the evaluation stack as the same type.
shr
Shifts an integer value (in sign) to the right by a specified number of bits, pushing the result onto the evaluation stack.
shl
Shifts an integer value (in sign) to the left by a specified number of bits, pushing the result onto the evaluation stack.
land
Performs a logical AND of two values and push the result onto the evaluation stack.
lor
Performs a logical OR of two values and push the result onto the evaluation stack.
lnot
Performs a logical NOT of a value and push the result onto the evaluation stack.
eq
Performs a comparison of two values and pushes a boolean true value if the values are equal.
neq
Performs a comparison of two values and pushes a boolean true value if the values are different.
gt
Performs a comparison of two values and pushes a boolean true value if first value is greater than the second.
ge
Performs a comparison of two values and pushes a boolean true value if first value is greater or equal the second.
lt
Performs a comparison of two values and pushes a boolean true value if first value is lesser than the second.
le
Performs a comparison of two values and pushes a boolean true value if first value is lesser or equal the second.
call
Call a function.
return
Returns from the current function.
jmp
Unconditionally jump to a specified position in the current function.
brtrue
Conditionally branch the execution if the value on top of the evaluation stack is true.
brfalse
Conditionally branch the execution if the value on top of the evaluation stack is false.