本文整理汇总了Java中org.objectweb.asm.Opcodes.ALOAD属性的典型用法代码示例。如果您正苦于以下问题:Java Opcodes.ALOAD属性的具体用法?Java Opcodes.ALOAD怎么用?Java Opcodes.ALOAD使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.objectweb.asm.Opcodes
的用法示例。
在下文中一共展示了Opcodes.ALOAD属性的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SkillsHook
public SkillsHook() {
super(new Regex(
new Instruction(Opcodes.GETSTATIC, true),
new Instruction(Opcodes.ALOAD, false),
new Instruction(Opcodes.ILOAD, false),
new Instruction(Opcodes.IINC, false),
new Instruction(Opcodes.IALOAD, false),
new Instruction(Opcodes.IALOAD, false),
new Instruction(Opcodes.ISTORE, false),
new Instruction(Opcodes.ILOAD, false),
new Or(new Instruction(Opcodes.ICONST_2, false), new Instruction(Opcodes.IF_ICMPNE, false), false),
new Or(new Instruction(Opcodes.ICONST_2, false), new Instruction(Opcodes.IF_ICMPNE, false), false),
new Instruction(Opcodes.GETSTATIC, true),
new Instruction(Opcodes.ALOAD, false),
new Instruction(Opcodes.ILOAD, false),
new Instruction(Opcodes.IINC, false),
new Instruction(Opcodes.IALOAD, false),
new Instruction(Opcodes.IALOAD, false),
new Instruction(Opcodes.ISTORE, false),
new Or(new Instruction(Opcodes.ILOAD, false), new Instruction(Opcodes.ICONST_3, false), false),
new Or(new Instruction(Opcodes.ILOAD, false), new Instruction(Opcodes.ICONST_3, false), false),
new Instruction(Opcodes.IF_ICMPNE, false),
new Instruction(Opcodes.GETSTATIC, true)
));
}
示例2: visitVarInsn
/**
* Imports variable load and store operations, as well as RET?!?
*
* @param opcode Opcode.
* @param var Variable index.
*/
@Override
public void visitVarInsn(final int opcode, final int var) {
switch(opcode) {
case Opcodes.ILOAD: createVarRead(var, Type.INT); break;
case Opcodes.LLOAD: createVarRead(var, Type.LONG); break;
case Opcodes.FLOAD: createVarRead(var, Type.FLOAT); break;
case Opcodes.DLOAD: createVarRead(var, Type.DOUBLE); break;
case Opcodes.ALOAD: createVarRead(var, Type.getFreshRef()); break;
case Opcodes.ISTORE: createVarWrite(var, Type.INT); break;
case Opcodes.LSTORE: createVarWrite(var, Type.LONG); break;
case Opcodes.FSTORE: createVarWrite(var, Type.FLOAT); break;
case Opcodes.DSTORE: createVarWrite(var, Type.DOUBLE); break;
case Opcodes.ASTORE: createVarWrite(var, Type.getFreshRef()); break;
// TODO: RET (paired with JSR)
case Opcodes.RET: throw new RuntimeException("visitVarInsn: RET");
}
}
示例3: visitVarInsn
@Override
public void visitVarInsn(final int opcode, final int var) {
ReplacingBasicValue v;
if (opcode == Opcodes.ASTORE && (v = peekFromTop(0)) != null) {
final ValueHolderSub from = oldToNew.get(v.getIndex());
final ReplacingBasicValue current = getLocal(var);
// if local var is set, then transfer to it to the existing holders in the local position.
if (current != null) {
final ValueHolderSub newSub = oldToNew.get(current.getIndex());
if (newSub.iden() == from.iden()) {
final int targetFirst = newSub.first();
from.transfer(this, targetFirst);
return;
}
}
// if local var is not set, then check map to see if existing holders are mapped to local var.
if (oldLocalToFirst.containsKey(var)) {
final ValueHolderSub sub = oldToNew.get(oldLocalToFirst.lget());
if (sub.iden() == from.iden()) {
// if they are, then transfer to that.
from.transfer(this, sub.first());
return;
}
}
// map from variables to global space for future use.
oldLocalToFirst.put(var, v.getIndex());
return;
} else if (opcode == Opcodes.ALOAD && (v = getLocal(var)) != null) {
/*
* Not forwarding this removes a now unnecessary ALOAD for a holder. The required LOAD/STORE
* sequences will be generated by the ASTORE code above.
*/
return;
}
super.visitVarInsn(opcode, var);
}
示例4: processDeferredAload
/**
* Process a deferred ALOAD instruction, if there is one.
*
* If there is no deferred ALOAD, does nothing, and returns false.
*
* If there is a deferred ALOAD, and we're on a POP instruction
* (indicated by onPop), does nothing (the ALOAD is not forwarded),
* and returns true.
*
* If there is a deferred ALOAD and we're not on a POP instruction,
* forwards the deferred ALOAD, and returns false
*
* @param onPop true if the current instruction is POP
* @return true if onPop and there was a deferred ALOAD, false otherwise;
* basically, returns true if the ALOAD-POP optimization is required
*/
private boolean processDeferredAload(final boolean onPop) {
// if the previous instruction wasn't an ALOAD, then there's nothing to do
if (var == NONE) {
return false;
}
// clear the variable index, but save it for local use
final int localVar = var;
var = NONE;
// if the next instruction is a POP, don't emit the deferred ALOAD
if (onPop) {
return true;
}
// if we got here, we're not on a POP, so emit the deferred ALOAD
super.visitVarInsn(Opcodes.ALOAD, localVar);
return false;
}
示例5: visitMethodInsn
@Override
public void visitMethodInsn(int opcode, String owner, String name, String desc, boolean itf) {
if (Transformer.CL_LOGWRAPPER.equals(owner)
&& Transformer.MD_FINEST.equals(name)
&& Transformer.DESC_FINEST.equals(desc)) {
super.visitMethodInsn(opcode, owner, name, desc, itf);
if (this.ordinal > 0 && this.ordinal < 3) {
super.visitVarInsn(Opcodes.ALOAD, 6);
String method = this.ordinal == 1 ? "before" : "after";
super.visitMethodInsn(Opcodes.INVOKESTATIC, Transformer.CL_AGENT, method, Transformer.DESC_STRING, false);
}
this.ordinal++;
} else if (this.local > 0
&& this.ordinal > 3
&& Transformer.CL_TRANSFORMER.equals(owner)
&& Transformer.MD_TRANSFORM.equals(name)) {
super.visitVarInsn(Opcodes.ALOAD, this.local);
super.visitMethodInsn(Opcodes.INVOKESTATIC, Transformer.CL_AGENT, "before", Transformer.DESC_OBJECT, false);
super.visitMethodInsn(opcode, owner, name, desc, itf);
super.visitVarInsn(Opcodes.ALOAD, this.local);
super.visitMethodInsn(Opcodes.INVOKESTATIC, Transformer.CL_AGENT, "after", Transformer.DESC_OBJECT, false);
} else {
super.visitMethodInsn(opcode, owner, name, desc, itf);
}
}
示例6: visitVarInsn
@Override
public void visitVarInsn(final int opcode, final int var) {
switch (opcode) {
case Opcodes.ILOAD:
load(var, Type.INT_TYPE);
break;
case Opcodes.LLOAD:
load(var, Type.LONG_TYPE);
break;
case Opcodes.FLOAD:
load(var, Type.FLOAT_TYPE);
break;
case Opcodes.DLOAD:
load(var, Type.DOUBLE_TYPE);
break;
case Opcodes.ALOAD:
load(var, OBJECT_TYPE);
break;
case Opcodes.ISTORE:
store(var, Type.INT_TYPE);
break;
case Opcodes.LSTORE:
store(var, Type.LONG_TYPE);
break;
case Opcodes.FSTORE:
store(var, Type.FLOAT_TYPE);
break;
case Opcodes.DSTORE:
store(var, Type.DOUBLE_TYPE);
break;
case Opcodes.ASTORE:
store(var, OBJECT_TYPE);
break;
case Opcodes.RET:
ret(var);
break;
default:
throw new IllegalArgumentException();
}
}
示例7: CanvasHook
public CanvasHook() {
super(new Regex(
new Instruction(Opcodes.GOTO, false),
new Instruction(Opcodes.GETSTATIC, true),
new Instruction(Opcodes.CHECKCAST, false),
new Instruction(Opcodes.ALOAD, false),
new Instruction(Opcodes.GETFIELD, false),
new Instruction(Opcodes.LDC, false),
new Instruction(Opcodes.INVOKEVIRTUAL, true),
new Instruction(Opcodes.GOTO, false)
));
}
示例8: visitInsn
@Override
public void visitInsn(int opcode) {
if(opcode == Opcodes.RETURN) {
// Load this.
super.visitVarInsn(Opcodes.ALOAD, 0);
// Execute drill init.
super.visitMethodInsn(Opcodes.INVOKEVIRTUAL, className, SignatureHolder.DRILL_INIT_METHOD, "()V", false);
}
super.visitInsn(opcode);
}
示例9: visitVarInsn
@Override
public void visitVarInsn(final int opcode, final int var) {
processDeferredAload(false);
// if we see an ALOAD, defer forwarding it until we know what the next instruction is
if (Opcodes.ALOAD == opcode) {
this.var = var;
} else {
super.visitVarInsn(opcode, var);
}
}
示例10: getLoadInsn
static VarInsnNode getLoadInsn(Type type, int position) {
int opCode;
switch (type.getDescriptor().charAt(0)) {
case 'B':
opCode = Opcodes.ILOAD;
break;
case 'C':
opCode = Opcodes.ILOAD;
break;
case 'D':
opCode = Opcodes.DLOAD;
break;
case 'F':
opCode = Opcodes.FLOAD;
break;
case 'I':
opCode = Opcodes.ILOAD;
break;
case 'J':
opCode = Opcodes.LLOAD;
break;
case 'L':
opCode = Opcodes.ALOAD;
break;
case '[':
opCode = Opcodes.ALOAD;
break;
case 'Z':
opCode = Opcodes.ILOAD;
break;
case 'S':
opCode = Opcodes.ILOAD;
break;
default:
throw new ClassFormatError("Invalid method signature: "
+ type.getDescriptor());
}
return new VarInsnNode(opCode, position);
}
示例11: visitCode
@Override
public void visitCode() {
/*
* 0 iload_0 [displayWidth]
* 1 iload_1 [displayHeight]
* 2 aload_2 [framebufferMc]
* 3 invokestatic mcheli.multiplay.MCH_MultiplayClient.sendScreenShot(int, int, net.minecraft.client.shader.Framebuffer) : void [21]
* 6 return
*/
super.visitVarInsn(Opcodes.ILOAD, 0);
super.visitVarInsn(Opcodes.ILOAD, 1);
super.visitVarInsn(Opcodes.ALOAD, 2);
super.visitMethodInsn(Opcodes.INVOKESTATIC, "net/teamfruit/mchelishield/MCH_MultiplayClient", "sendScreenShot", DescHelper.toDesc(void.class, int.class, int.class, "net.minecraft.client.shader.Framebuffer"), false);
super.visitInsn(Opcodes.RETURN);
}
示例12: isRead
static boolean isRead(int opcode) {
return opcode == Opcodes.ALOAD || opcode == Opcodes.ILOAD || opcode == Opcodes.FLOAD
|| opcode == Opcodes.LLOAD || opcode == Opcodes.DLOAD;
}
示例13: isALOAD0
private static boolean isALOAD0(AbstractInsnNode i) {
return i.getOpcode() == Opcodes.ALOAD && ((VarInsnNode) i).var == 0;
}