use of org.objectweb.asm.tree.TypeInsnNode in project maple-ir by LLVM-but-worse.
the class TypeInsnNodeSerializer method deserialize.
@Override
public TypeInsnNode deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
JsonObject jsonObject = (JsonObject) json;
int opcode = jsonObject.get("opcode").getAsInt();
String desc = jsonObject.get("desc").getAsString();
return new TypeInsnNode(opcode, desc);
}
use of org.objectweb.asm.tree.TypeInsnNode in project drill by apache.
the class ReplacingInterpreter method newOperation.
@Override
public BasicValue newOperation(final AbstractInsnNode insn) throws AnalyzerException {
if (insn.getOpcode() == Opcodes.NEW) {
final TypeInsnNode t = (TypeInsnNode) insn;
// if this is for a holder class, we'll replace it
final ValueHolderIden iden = HOLDERS.get(t.desc);
if (iden != null) {
return ReplacingBasicValue.create(Type.getObjectType(t.desc), iden, index++, valueList);
}
}
return super.newOperation(insn);
}
use of org.objectweb.asm.tree.TypeInsnNode in project bytecode-viewer by Konloch.
the class ASMResourceUtil method renameClassNode.
public static void renameClassNode(final String oldName, final String newName) {
for (ClassNode c : BytecodeViewer.getLoadedClasses()) {
for (InnerClassNode oo : c.innerClasses) {
if (oo.innerName != null && oo.innerName.equals(oldName))
oo.innerName = newName;
if (oo.name.equals(oldName))
oo.name = newName;
if (oo.outerName != null && oo.outerName.equals(oldName))
oo.outerName = newName;
}
if (c.signature != null)
c.signature = c.signature.replace(oldName, newName);
if (c.superName.equals(oldName))
c.superName = newName;
for (Object o : c.fields.toArray()) {
FieldNode f = (FieldNode) o;
f.desc = f.desc.replace(oldName, newName);
}
for (Object o : c.methods.toArray()) {
MethodNode m = (MethodNode) o;
if (m.localVariables != null)
for (LocalVariableNode node : m.localVariables) node.desc = node.desc.replace(oldName, newName);
if (m.signature != null)
m.signature = m.signature.replace(oldName, newName);
for (int i = 0; i < m.exceptions.size(); i++) if (m.exceptions.get(i).equals(oldName))
m.exceptions.set(i, newName);
for (AbstractInsnNode i : m.instructions.toArray()) {
if (i instanceof TypeInsnNode) {
TypeInsnNode t = (TypeInsnNode) i;
if (t.desc.equals(oldName))
t.desc = newName;
}
if (i instanceof MethodInsnNode) {
MethodInsnNode mi = (MethodInsnNode) i;
if (mi.owner.equals(oldName))
mi.owner = newName;
mi.desc = mi.desc.replace(oldName, newName);
}
if (i instanceof FieldInsnNode) {
FieldInsnNode fi = (FieldInsnNode) i;
if (fi.owner.equals(oldName))
fi.owner = newName;
fi.desc = fi.desc.replace(oldName, newName);
}
}
}
}
}
use of org.objectweb.asm.tree.TypeInsnNode in project jphp by jphp-compiler.
the class ClosureValueCompiler method writePushUses.
protected void writePushUses(Collection<ArgumentStmtToken> parameters) {
if (parameters.isEmpty()) {
add(new InsnNode(ACONST_NULL));
expr.stackPush(Memory.Type.REFERENCE);
return;
}
expr.writePushSmallInt(parameters.size());
add(new TypeInsnNode(ANEWARRAY, Type.getInternalName(Memory.class)));
expr.stackPop();
expr.stackPush(Memory.Type.REFERENCE);
int i = 0;
for (ArgumentStmtToken param : parameters) {
expr.writePushDup();
expr.writePushSmallInt(i);
LocalVariable local = method.getLocalVariable(param.getName().getName());
if (local == null)
expr.writePushNull();
else
expr.writeVarLoad(local);
if (!param.isReference())
expr.writePopBoxing(true);
add(new InsnNode(AASTORE));
expr.stackPop();
expr.stackPop();
expr.stackPop();
i++;
}
}
Aggregations