insn.op
Bytecode helpers. Fns for opcodes with an underscore in their name
(e.g., IF_ICMPEQ) use a dash instead (e.g., if-icmpeq).
aconst-null
(aconst-null v)
aload
(aload v idx)
Push or write local variable at index `idx`.
anew
(anew v)
Alias for new since new is a special form in clojure.
anewarray
(anewarray v stype)
Special type instruction.
arraylength
(arraylength v)
astore
(astore v idx)
Push or write local variable at index `idx`.
checkcast
(checkcast v stype)
Special type instruction.
compile
(compile ops)
Compile a sequence of op seqs to a fn that accepts an ASM
MethodVisitor to emit method bytecode.
Nested bytecode sequences will be flattened, and nils removed.
dload
(dload v idx)
Push or write local variable at index `idx`.
dstore
(dstore v idx)
Push or write local variable at index `idx`.
fload
(fload v idx)
Push or write local variable at index `idx`.
fstore
(fstore v idx)
Push or write local variable at index `idx`.
getfield
(getfield v cls fname)
(getfield v cls fname ftype)
Read or write type `ftype` instance or static field named `fname` of
class `cls`.
If the type is not provided, it will be determined through reflection.
In this case, the class must be given as a string or Class object.
getstatic
(getstatic v cls fname)
(getstatic v cls fname ftype)
Read or write type `ftype` instance or static field named `fname` of
class `cls`.
If the type is not provided, it will be determined through reflection.
In this case, the class must be given as a string or Class object.
goto
(goto v label)
Unconditionally jump to offset `label`.
if-acmpeq
(if-acmpeq v label)
Conditionally jump to offset `label`.
if-acmpne
(if-acmpne v label)
Conditionally jump to offset `label`.
if-icmpeq
(if-icmpeq v label)
Conditionally jump to offset `label`.
if-icmpge
(if-icmpge v label)
Conditionally jump to offset `label`.
if-icmpgt
(if-icmpgt v label)
Conditionally jump to offset `label`.
if-icmple
(if-icmple v label)
Conditionally jump to offset `label`.
if-icmplt
(if-icmplt v label)
Conditionally jump to offset `label`.
if-icmpne
(if-icmpne v label)
Conditionally jump to offset `label`.
ifeq
(ifeq v label)
Conditionally jump to offset `label`.
ifge
(ifge v label)
Conditionally jump to offset `label`.
ifgt
(ifgt v label)
Conditionally jump to offset `label`.
ifle
(ifle v label)
Conditionally jump to offset `label`.
iflt
(iflt v label)
Conditionally jump to offset `label`.
ifne
(ifne v label)
Conditionally jump to offset `label`.
ifnonnull
(ifnonnull v label)
Conditionally jump to offset `label`.
ifnull
(ifnull v label)
Conditionally jump to offset `label`.
iinc
(iinc v idx n)
Increment int local variable index `idx` by amount `n`.
iload
(iload v idx)
Push or write local variable at index `idx`.
instanceof
(instanceof v stype)
Special type instruction.
invokedynamic
(invokedynamic v mname desc boot)
(invokedynamic v mname desc boot args)
Call bootstrap method `boot` to return callsite for method `mname`
with arguments and return type given by `desc`. Note that this
instruction requires version 7 bytecode and above.
The bootstrap method can be a ASM Handle (see `insn.util`) or an op
sequence of the form specified by the invokeX instructions.
An optional seq of constant arguments `args` may be given and each
must be either an Integer, Float, Long, Double, String, ASM Type, ASM
Handle, or ASM ConstantDynamic object. These are passed to the
bootstrap method.
invokeinterface
(invokeinterface v cls mname)
(invokeinterface v cls mname desc-or-arity)
(invokeinterface v cls mname desc-or-arity iface)
Call method named `mname` of class `cls` with the method arguments
and return type given by `desc`.
If the type descriptor is not provided or is a numeric arity, it will
be determined through reflection. In this case, the class must be
given as a string or Class object.
The last argument `iface` can be used to specify the method's owner
class is an interface (e.g., a default implementation).
invokespecial
(invokespecial v cls mname)
(invokespecial v cls mname desc-or-arity)
(invokespecial v cls mname desc-or-arity iface)
Call method named `mname` of class `cls` with the method arguments
and return type given by `desc`.
If the type descriptor is not provided or is a numeric arity, it will
be determined through reflection. In this case, the class must be
given as a string or Class object.
The last argument `iface` can be used to specify the method's owner
class is an interface (e.g., a default implementation).
invokestatic
(invokestatic v cls mname)
(invokestatic v cls mname desc-or-arity)
(invokestatic v cls mname desc-or-arity iface)
Call method named `mname` of class `cls` with the method arguments
and return type given by `desc`.
If the type descriptor is not provided or is a numeric arity, it will
be determined through reflection. In this case, the class must be
given as a string or Class object.
The last argument `iface` can be used to specify the method's owner
class is an interface (e.g., a default implementation).
invokevirtual
(invokevirtual v cls mname)
(invokevirtual v cls mname desc-or-arity)
(invokevirtual v cls mname desc-or-arity iface)
Call method named `mname` of class `cls` with the method arguments
and return type given by `desc`.
If the type descriptor is not provided or is a numeric arity, it will
be determined through reflection. In this case, the class must be
given as a string or Class object.
The last argument `iface` can be used to specify the method's owner
class is an interface (e.g., a default implementation).
istore
(istore v idx)
Push or write local variable at index `idx`.
jsr
(jsr v label)
Unconditionally jump to offset `label`.
ldc
(ldc v x)
Load constant null, int, float, String, Type, Handle, or
ConstantDynamic value `x`.
ldc2
(ldc2 v x)
Load constant long or double value `x`.
line-number
(line-number v n label)
Add a reference to source line `n` starting at `label`. If the label
has not yet been visited (marked), an error will be thrown.
lload
(lload v idx)
Push or write local variable at index `idx`.
local-variable
(local-variable v vname vtype start end idx)
Add a reference to a local variable `vname` of type `vtype` with
index number `idx`. The variable scope is demarcated by labels `start`
and `end`. If either label has not yet been visited (marked), an
error will be thrown.
lookupswitch
(lookupswitch v default m)
Like `lookupswitch*` with the keys and labels given as a map.
lookupswitch*
(lookupswitch* v default tkeys tlabels)
Jump to a corresponding label given in `tlabels` by an int table
lookup of the pre-sorted `tkeys` (as per `zipmap`.) If no mapping is
found, jump to the `default` label.
lstore
(lstore v idx)
Push or write local variable at index `idx`.
monitorenter
(monitorenter v)
monitorexit
(monitorexit v)
multianewarray
(multianewarray v atype dims)
Make a new array of type `atype` with `dims` dimensions.
new
(new v stype)
Special type instruction.
newarray
(newarray v atype)
Make a new primitive array of operand type `atype`.
op-seq
(op-seq xs)
Return a flattened sequence of ops.
pop1
(pop1 v)
Alias for pop since clojure.core also defines pop.
putfield
(putfield v cls fname)
(putfield v cls fname ftype)
Read or write type `ftype` instance or static field named `fname` of
class `cls`.
If the type is not provided, it will be determined through reflection.
In this case, the class must be given as a string or Class object.
putstatic
(putstatic v cls fname)
(putstatic v cls fname ftype)
Read or write type `ftype` instance or static field named `fname` of
class `cls`.
If the type is not provided, it will be determined through reflection.
In this case, the class must be given as a string or Class object.
ret
(ret v idx)
Continue from address given by local variable at index `idx`.
tableswitch
(tableswitch v imin imax default labels)
Constant-time index of int table between `imin` and `imax` inclusive,
jumping to corresponding label in `labels`. If the value 'off' is not
within range, jump to the `default` label. Otherwise, jump to the
label index given by: (- (- imax imin) (- imax off))
trycatch
(trycatch v start end handler etype)
Mark region between `start` and `end` labels as protected by label
`handler` against throwable `etype`. To handle all exceptions, pass
nil as the throwable type.
visit-label!
(visit-label! v label)
Set label offset to current visitor position.