当前位置: 首页>>代码示例>>Java>>正文


Java InvokeDynamicInsnNode类代码示例

本文整理汇总了Java中org.objectweb.asm.tree.InvokeDynamicInsnNode的典型用法代码示例。如果您正苦于以下问题:Java InvokeDynamicInsnNode类的具体用法?Java InvokeDynamicInsnNode怎么用?Java InvokeDynamicInsnNode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


InvokeDynamicInsnNode类属于org.objectweb.asm.tree包,在下文中一共展示了InvokeDynamicInsnNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: build

import org.objectweb.asm.tree.InvokeDynamicInsnNode; //导入依赖的package包/类
private void build(InvokeDynamicInsnNode insn, IRBuilder builder) {
  // Bootstrap method
  Handle bsmHandle = insn.bsm;
  if (bsmHandle.getTag() != Opcodes.H_INVOKESTATIC &&
      bsmHandle.getTag() != Opcodes.H_NEWINVOKESPECIAL) {
    throw new Unreachable(
        "Bootstrap handle is not yet supported: tag == " + bsmHandle.getTag());
  }
  // Resolve the bootstrap method.
  DexMethodHandle bootstrapMethod = getMethodHandle(application, bsmHandle);

  // Decode static bootstrap arguments
  List<DexValue> bootstrapArgs = new ArrayList<>();
  for (Object arg : insn.bsmArgs) {
    bootstrapArgs.add(decodeBootstrapArgument(arg));
  }

  // Construct call site
  DexCallSite callSite = application
      .getCallSite(insn.name, insn.desc, bootstrapMethod, bootstrapArgs);

  buildInvoke(insn.desc, null /* Not needed */,
      false /* Receiver is passed explicitly */, builder,
      (types, registers) -> builder.addInvokeCustom(callSite, types, registers));
}
 
开发者ID:inferjay,项目名称:r8,代码行数:26,代码来源:JarSourceCode.java

示例2: findInvokeDynamic

import org.objectweb.asm.tree.InvokeDynamicInsnNode; //导入依赖的package包/类
private int findInvokeDynamic() {
    AtomicInteger total = new AtomicInteger();
    classNodes().forEach(classNode -> {
        classNode.methods.forEach(methodNode -> {
            for (int i = 0; i < methodNode.instructions.size(); i++) {
                AbstractInsnNode abstractInsnNode = methodNode.instructions.get(i);
                if (abstractInsnNode instanceof InvokeDynamicInsnNode) {
                    InvokeDynamicInsnNode dyn = (InvokeDynamicInsnNode) abstractInsnNode;
                    if (dyn.bsmArgs.length > 0 && dyn.bsmArgs[0] instanceof String) {
                        total.incrementAndGet();
                    }
                }
            }
        });
    });
    return total.get();
}
 
开发者ID:java-deobfuscator,项目名称:deobfuscator,代码行数:18,代码来源:InvokedynamicTransformer.java

示例3: naryOperation

import org.objectweb.asm.tree.InvokeDynamicInsnNode; //导入依赖的package包/类
@Override
public ConstValue naryOperation(final AbstractInsnNode insn,
        final List<? extends ConstValue> values) {

    int opcode = insn.getOpcode();

    if (opcode == Opcodes.MULTIANEWARRAY) {
        return new ConstValue(1);
    } else if (opcode == Opcodes.INVOKEDYNAMIC) {
        return new ConstValue(Type.getReturnType(
                ((InvokeDynamicInsnNode) insn).desc).getSize());
    } else {

        int size = Type.getReturnType(((MethodInsnNode) insn).desc)
                .getSize();
        Object cst = InvocationInterpreter.getInstance().execute(
                (MethodInsnNode) insn, values);
        return new ConstValue(size, cst);
    }

}
 
开发者ID:mur47x111,项目名称:svm-fasttagging,代码行数:22,代码来源:ConstInterpreter.java

示例4: naryOperation

import org.objectweb.asm.tree.InvokeDynamicInsnNode; //导入依赖的package包/类
@Override
public BasicValue naryOperation(final AbstractInsnNode insn,
        final List<? extends BasicValue> values) throws AnalyzerException {
    int opcode = insn.getOpcode();
    if (opcode == MULTIANEWARRAY) {
        return newValue(Type.getType(((MultiANewArrayInsnNode) insn).desc));
    } else if (opcode == INVOKEDYNAMIC) {
        return newValue(Type
                .getReturnType(((InvokeDynamicInsnNode) insn).desc));
    } else {
        return newValue(Type.getReturnType(((MethodInsnNode) insn).desc));
    }
}
 
开发者ID:ItzSomebody,项目名称:DirectLeaks-AntiReleak-Remover,代码行数:14,代码来源:BasicInterpreter.java

示例5: naryOperation

import org.objectweb.asm.tree.InvokeDynamicInsnNode; //导入依赖的package包/类
@Override
public SourceValue naryOperation(final AbstractInsnNode insn,
        final List<? extends SourceValue> values) {
    int size;
    int opcode = insn.getOpcode();
    if (opcode == MULTIANEWARRAY) {
        size = 1;
    } else {
        String desc = (opcode == INVOKEDYNAMIC) ? ((InvokeDynamicInsnNode) insn).desc
                : ((MethodInsnNode) insn).desc;
        size = Type.getReturnType(desc).getSize();
    }
    return new SourceValue(size, insn);
}
 
开发者ID:ItzSomebody,项目名称:DirectLeaks-AntiReleak-Remover,代码行数:15,代码来源:SourceInterpreter.java

示例6: patchMethod

import org.objectweb.asm.tree.InvokeDynamicInsnNode; //导入依赖的package包/类
public void patchMethod(MethodNode methodNode, String patchName, String clazzName) {
	methodNode.desc = methodNode.desc.replace(patchName, clazzName);
	for (Iterator<AbstractInsnNode> iterator = methodNode.instructions.iterator(); iterator.hasNext();) {
		AbstractInsnNode insn = iterator.next();
		if (insn instanceof TypeInsnNode) {
			TypeInsnNode type = (TypeInsnNode) insn;
			type.desc = replace(type.desc, patchName, clazzName);
		} else if (insn instanceof FieldInsnNode) {
			FieldInsnNode field = (FieldInsnNode) insn;
			field.owner = replace(field.owner, patchName, clazzName);
		} else if (insn instanceof MethodInsnNode) {
			MethodInsnNode method = (MethodInsnNode) insn;
			if (method.owner.equals(patchName) && method.getOpcode() == INVOKEVIRTUAL)
				method.setOpcode(INVOKESPECIAL);
			method.owner = replace(method.owner, patchName, clazzName);
		} else if (insn instanceof InvokeDynamicInsnNode) {
			InvokeDynamicInsnNode dynamic = (InvokeDynamicInsnNode) insn;
			String patchDesc = ASMHelper.getClassDesc(patchName), clazzDesc = ASMHelper.getClassDesc(clazzName);
			dynamic.desc = replace(dynamic.desc, patchDesc, clazzDesc);
			for (int i = 0; i < dynamic.bsmArgs.length; i++)
				if (dynamic.bsmArgs[i] instanceof Handle) {
					Handle handle = (Handle) dynamic.bsmArgs[i];
					dynamic.bsmArgs[i] = new Handle(handle.getTag(), replace(handle.getOwner(), patchName, clazzName),
							handle.getName(), replace(handle.getDesc(), patchDesc, clazzDesc), handle.isInterface());
				}
		} else if (insn instanceof FrameNode) {
			FrameNode frame = (FrameNode) insn;
			if (frame.local != null)
				frame.local.replaceAll((o -> o instanceof String ? replace((String) o, patchName, clazzName) : o));
			if (frame.stack != null)
				frame.stack.replaceAll((o -> o instanceof String ? replace((String) o, patchName, clazzName) : o));
		}
	}
}
 
开发者ID:NekoCaffeine,项目名称:Alchemy,代码行数:35,代码来源:TransformerPatch.java

示例7: naryOperation

import org.objectweb.asm.tree.InvokeDynamicInsnNode; //导入依赖的package包/类
@Override
public ConstValue naryOperation(AbstractInsnNode insn, List<? extends ConstValue> values) {
  int opcode = insn.getOpcode();
  if (opcode == MULTIANEWARRAY) {
    return ConstValue.ONE_SLOT;
  } else {
    String desc = (opcode == INVOKEDYNAMIC) ? ((InvokeDynamicInsnNode) insn).desc
        : ((MethodInsnNode) insn).desc;
    return ConstValue.slot(Type.getReturnType(desc).getSize());
  }
}
 
开发者ID:forax,项目名称:pro,代码行数:12,代码来源:ConstInterpreter.java

示例8: handle

import org.objectweb.asm.tree.InvokeDynamicInsnNode; //导入依赖的package包/类
@Override
public void handle(AbstractInsnNode node) throws IncorrectNodeException {
	super.handle(node);
	LOG.debug(logNode(node));
	checkType(node, InvokeDynamicInsnNode.class);
	InvokeDynamicInsnNode invokeNode = (InvokeDynamicInsnNode) node;
	mState.getActiveStack().push(new LambdaExpression(invokeNode.name, invokeNode.desc, invokeNode.bsm, invokeNode.bsmArgs));
}
 
开发者ID:JozefCeluch,项目名称:thesis-disassembler,代码行数:9,代码来源:InvokeDynamicInsnNodeHandler.java

示例9: cloneInvokeNode

import org.objectweb.asm.tree.InvokeDynamicInsnNode; //导入依赖的package包/类
/**
 * Clones an invokevirtual/invokespecial/invokeinterface/invokedynamic node and returns it as an instruction list.
 * @param insnNode instruction to clone
 * @throws NullPointerException if any argument is {@code null}
 * @throws IllegalArgumentException if node isn't of invoke type
 * @return instruction list with cloned instruction
 */
public static InsnList cloneInvokeNode(AbstractInsnNode insnNode) {
    Validate.notNull(insnNode);
    Validate.isTrue(insnNode instanceof MethodInsnNode || insnNode instanceof InvokeDynamicInsnNode);

    InsnList ret = new InsnList();
    ret.add(insnNode.clone(new HashMap<>()));

    return ret;
}
 
开发者ID:offbynull,项目名称:coroutines,代码行数:17,代码来源:GenericGenerators.java

示例10: visitInvokeDynamicInsn

import org.objectweb.asm.tree.InvokeDynamicInsnNode; //导入依赖的package包/类
public void visitInvokeDynamicInsn(String name, String desc, Handle bsm, Object... bsmArgs) {
    final InvokeDynamicInsnNode mnode = new InvokeDynamicInsnNode(name, desc, bsm, bsmArgs);
    if (needsFrameGuard(INVOKEDYNAMIC, bsm.getOwner(), name, desc)) {
        Label label = new Label();
        super.visitLabel(label);
        labels.add(label);
        nodes.add(mnode);
    }
    instructions.add(mnode);
}
 
开发者ID:vsilaev,项目名称:tascalate-javaflow,代码行数:11,代码来源:ContinuableMethodNode.java

示例11: findCallSiteInvocationInsertionIndex

import org.objectweb.asm.tree.InvokeDynamicInsnNode; //导入依赖的package包/类
int findCallSiteInvocationInsertionIndex(final MethodInsnNode mnode) {
    int inSelected = -1;
    for (AbstractInsnNode otherIns = mnode; otherIns != null && inSelected < 0; ) {
        otherIns = otherIns.getNext();
        if (otherIns instanceof MethodInsnNode || otherIns instanceof InvokeDynamicInsnNode) {
            inSelected = nodes.indexOf(otherIns);
        }
    }
    return inSelected;
}
 
开发者ID:vsilaev,项目名称:tascalate-javaflow,代码行数:11,代码来源:ContinuableMethodNode.java

示例12: naryOperation

import org.objectweb.asm.tree.InvokeDynamicInsnNode; //导入依赖的package包/类
@Override
public BasicValue naryOperation(final AbstractInsnNode insn,
        final List<? extends BasicValue> values) throws AnalyzerException {
    int opcode = insn.opcode();
    if (opcode == MULTIANEWARRAY) {
        return newValue(Type.getType(((MultiANewArrayInsnNode) insn).desc));
    } else if (opcode == INVOKEDYNAMIC) {
        return newValue(Type
                .getReturnType(((InvokeDynamicInsnNode) insn).desc));
    } else {
        return newValue(Type.getReturnType(((MethodInsnNode) insn).desc));
    }
}
 
开发者ID:8BitPlus,项目名称:BitPlus,代码行数:14,代码来源:BasicInterpreter.java

示例13: naryOperation

import org.objectweb.asm.tree.InvokeDynamicInsnNode; //导入依赖的package包/类
@Override
public SourceValue naryOperation(final AbstractInsnNode insn,
        final List<? extends SourceValue> values) {
    int size;
    int opcode = insn.opcode();
    if (opcode == MULTIANEWARRAY) {
        size = 1;
    } else {
        String desc = (opcode == INVOKEDYNAMIC) ? ((InvokeDynamicInsnNode) insn).desc
                : ((MethodInsnNode) insn).desc;
        size = Type.getReturnType(desc).getSize();
    }
    return new SourceValue(size, insn);
}
 
开发者ID:8BitPlus,项目名称:BitPlus,代码行数:15,代码来源:SourceInterpreter.java

示例14: invokedynamic

import org.objectweb.asm.tree.InvokeDynamicInsnNode; //导入依赖的package包/类
public CodeBlock invokedynamic(final String name, final String descriptor,
    final Handle bootstrapMethod, final Object... bootstrapArguments)
{
    instructionList.add(new InvokeDynamicInsnNode(name, descriptor,
        bootstrapMethod, bootstrapArguments));
    return this;
}
 
开发者ID:fge,项目名称:grappa,代码行数:8,代码来源:CodeBlock.java

示例15: visitInvokeDynamicInsn

import org.objectweb.asm.tree.InvokeDynamicInsnNode; //导入依赖的package包/类
public CodeBlock visitInvokeDynamicInsn(final String name,
    final String desc, final Handle bootstrapMethod,
    final Object... bootstrapArguments)
{
    instructionList.add(new InvokeDynamicInsnNode(name, desc,
        bootstrapMethod, bootstrapArguments));
    return this;
}
 
开发者ID:fge,项目名称:grappa,代码行数:9,代码来源:CodeBlock.java


注:本文中的org.objectweb.asm.tree.InvokeDynamicInsnNode类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。