public class BeforeLoadLocal extends InjectionPoint
This injection point is a companion for the ModifyVariable
injector which searches for LOAD operations which match the local variables
described by the injector's defined discriminators.
This allows you consumers to specify an injection immediately before a local variable is accessed in a method. Specify an ordinal of n to match the n + 1th access of the variable in question.
Example:
@ModifyVariable(
method = "md",
ordinal = 1,
at = @At(
value = "LOAD",
ordinal = 0
)
)
Note that if value is the only parameter specified, it can be omitted:
@At("LOAD")
InjectionPoint.AtCode, InjectionPoint.RestrictTargetLevel, InjectionPoint.Selector| Modifier and Type | Field and Description |
|---|---|
protected LocalVariableDiscriminator |
discriminator
Discriminator, parsed from parent annotation
|
protected IMixinContext |
mixin |
protected int |
opcode
Target opcode, inflected from return type
|
protected int |
ordinal
Target ordinal
|
protected org.objectweb.asm.Type |
returnType
Return type of the handler, also the type of the local variable we're
interested in
|
DEFAULT_ALLOWED_SHIFT_BY, MAX_ALLOWED_SHIFT_BY| Modifier | Constructor and Description |
|---|---|
protected |
BeforeLoadLocal(InjectionPointData data) |
protected |
BeforeLoadLocal(InjectionPointData data,
int opcode,
boolean opcodeAfter) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addMessage(java.lang.String format,
java.lang.Object... args)
Notify method for subclasses to log when notable but non-fatal failures
occur, for example allows subclasses to add notes when they return no
results.
|
boolean |
find(java.lang.String desc,
org.objectweb.asm.tree.InsnList insns,
java.util.Collection<org.objectweb.asm.tree.AbstractInsnNode> nodes)
Find injection points in the supplied insn list
|
java.lang.String |
toString() |
java.lang.String |
toString(LocalVariableDiscriminator.Context context) |
protected final org.objectweb.asm.Type returnType
protected final LocalVariableDiscriminator discriminator
protected final int opcode
protected final int ordinal
protected final IMixinContext mixin
protected BeforeLoadLocal(InjectionPointData data)
protected BeforeLoadLocal(InjectionPointData data, int opcode, boolean opcodeAfter)
protected void addMessage(java.lang.String format,
java.lang.Object... args)
InjectionPointaddMessage in class InjectionPointformat - Message formatargs - Format argspublic java.lang.String toString()
toString in class InjectionPointpublic java.lang.String toString(LocalVariableDiscriminator.Context context)
public boolean find(java.lang.String desc,
org.objectweb.asm.tree.InsnList insns,
java.util.Collection<org.objectweb.asm.tree.AbstractInsnNode> nodes)
InjectionPointfind in class InjectionPointdesc - Method descriptor, supplied to allow return types and
arguments etc. to be determinedinsns - Insn list to search in, the strategy MUST ONLY add nodes
from this list to the nodes collectionnodes - Collection of nodes to populate. Injectors should NOT make
any assumptions about the state of this collection and should only
call the add() method