org.objectweb.asm.tree.LabelNode Java Examples
The following examples show how to use
org.objectweb.asm.tree.LabelNode.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LookupSwitchInsnNodeSerializer.java From maple-ir with GNU General Public License v3.0 | 6 votes |
@Override public LookupSwitchInsnNode deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { JsonObject jsonObject = (JsonObject) json; LabelNode dflt = context.deserialize(jsonObject.get("dflt"), LabelNode.class); List<Integer> keysList = context.deserialize(jsonObject.get("keys"), List.class); List<LabelNode> labelsList = context.deserialize(jsonObject.get("labels"), List.class); int[] keys = new int[keysList.size()]; for(int i=0; i < keys.length; i++){ keys[i] = keysList.get(i); } LabelNode[] labels = new LabelNode[labelsList.size()]; for(int i=0; i < labels.length; i++){ labels[i] = labelsList.get(i); } return new LookupSwitchInsnNode(dflt, keys, labels); }
Example #2
Source File: InstructionComparator.java From NOVA-Core with GNU Lesser General Public License v3.0 | 6 votes |
public static InsnList getImportantList(InsnList list) { if (list.size() == 0) { return list; } HashMap<LabelNode, LabelNode> labels = new HashMap<LabelNode, LabelNode>(); for (AbstractInsnNode insn = list.getFirst(); insn != null; insn = insn.getNext()) { if (insn instanceof LabelNode) { labels.put((LabelNode) insn, (LabelNode) insn); } } InsnList importantNodeList = new InsnList(); for (AbstractInsnNode insn = list.getFirst(); insn != null; insn = insn.getNext()) { if (insn instanceof LabelNode || insn instanceof LineNumberNode) { continue; } importantNodeList.add(insn.clone(labels)); } return importantNodeList; }
Example #3
Source File: ForEachLoopFilter.java From pitest with Apache License 2.0 | 6 votes |
private static SequenceQuery<AbstractInsnNode> conditionalAtStart() { final Slot<LabelNode> loopStart = Slot.create(LabelNode.class); final Slot<LabelNode> loopEnd = Slot.create(LabelNode.class); return QueryStart .any(AbstractInsnNode.class) .zeroOrMore(QueryStart.match(anyInstruction())) .then(aMethodCallReturningAnIterator().and(mutationPoint())) .then(opCode(Opcodes.ASTORE)) .then(aLabelNode(loopStart.write())) .then(opCode(Opcodes.ALOAD)) .then(methodCallTo(ClassName.fromString("java/util/Iterator"), "hasNext").and(mutationPoint())) .then(aConditionalJump().and(jumpsTo(loopEnd.write())).and(mutationPoint())) .then(opCode(Opcodes.ALOAD)) .then(methodCallTo(ClassName.fromString("java/util/Iterator"), "next").and(mutationPoint())) .zeroOrMore(QueryStart.match(anyInstruction())) .then(opCode(Opcodes.GOTO).and(jumpsTo(loopStart.read()))) .then(labelNode(loopEnd.read())) .zeroOrMore(QueryStart.match(anyInstruction())); }
Example #4
Source File: JClassPatcher.java From rscplus with GNU General Public License v3.0 | 6 votes |
private void patchMenu(ClassNode node) { Logger.Info("Patching menu (" + node.name + ".class)"); Iterator<MethodNode> methodNodeList = node.methods.iterator(); while (methodNodeList.hasNext()) { MethodNode methodNode = methodNodeList.next(); // Menu swap hook if (methodNode.name.equals("e") && methodNode.desc.equals("(II)V")) { AbstractInsnNode first = methodNode.instructions.getFirst(); LabelNode label = new LabelNode(); methodNode.instructions.insertBefore(first, new VarInsnNode(Opcodes.ALOAD, 0)); methodNode.instructions.insertBefore( first, new MethodInsnNode( Opcodes.INVOKESTATIC, "Game/Menu", "switchList", "(Ljava/lang/Object;)Z")); methodNode.instructions.insertBefore(first, new JumpInsnNode(Opcodes.IFGT, label)); methodNode.instructions.insertBefore(first, new InsnNode(Opcodes.RETURN)); methodNode.instructions.insertBefore(first, label); } } }
Example #5
Source File: IForgeRegistryEntryTransformer.java From NOVA-Core with GNU Lesser General Public License v3.0 | 6 votes |
@Override public void transform(ClassNode cnode) { Game.logger().info("Transforming IForgeRegistryEntry class for correct NOVA mod id mapping."); ObfMapping mapping = new ObfMapping("net/minecraftforge/fml/common/registry/IForgeRegistryEntry$Impl", "setRegistryName", "(Ljava/lang/String;)Lnet/minecraftforge/fml/common/registry/IForgeRegistryEntry;"); MethodNode method = ASMHelper.findMethod(mapping, cnode); if (method == null) { throw new IllegalStateException("[NOVA] Lookup " + mapping + " failed!"); } Game.logger().info("Transforming method {}", method.name); InsnList list = new InsnList(); list.add(new VarInsnNode(ALOAD, 5)); list.add(new MethodInsnNode(INVOKESTATIC, "nova/core/wrapper/mc/forge/v1_11_2/asm/StaticForwarder", "isNovaPrefix", "(Ljava/lang/String;)Z", false)); list.add(new JumpInsnNode(IFNE, (LabelNode) method.instructions.get(120))); method.instructions.insert(method.instructions.get(101), list); Game.logger().info("Injected instruction to method: {}", method.name); }
Example #6
Source File: InstructionComparator.java From NOVA-Core with GNU Lesser General Public License v3.0 | 6 votes |
public static InsnList getImportantList(InsnList list) { if (list.size() == 0) { return list; } HashMap<LabelNode, LabelNode> labels = new HashMap<LabelNode, LabelNode>(); for (AbstractInsnNode insn = list.getFirst(); insn != null; insn = insn.getNext()) { if (insn instanceof LabelNode) { labels.put((LabelNode) insn, (LabelNode) insn); } } InsnList importantNodeList = new InsnList(); for (AbstractInsnNode insn = list.getFirst(); insn != null; insn = insn.getNext()) { if (insn instanceof LabelNode || insn instanceof LineNumberNode) { continue; } importantNodeList.add(insn.clone(labels)); } return importantNodeList; }
Example #7
Source File: BoatPatch.java From ForgeHax with MIT License | 6 votes |
@Inject(description = "Add hook to disable boat gravity") public void inject(MethodNode main) { AbstractInsnNode gravityNode = ASMHelper.findPattern( main.instructions.getFirst(), new int[]{ALOAD, DUP, GETFIELD, DLOAD, DADD, PUTFIELD}, "xxxxxx"); Objects.requireNonNull(gravityNode, "Find pattern failed for gravityNode"); AbstractInsnNode putFieldNode = gravityNode; for (int i = 0; i < 5; i++) { putFieldNode = putFieldNode.getNext(); } LabelNode newLabelNode = new LabelNode(); InsnList insnList = new InsnList(); insnList.add( ASMHelper.call(GETSTATIC, TypesHook.Fields.ForgeHaxHooks_isNoBoatGravityActivated)); insnList.add(new JumpInsnNode(IFNE, newLabelNode)); // if nogravity is enabled main.instructions.insertBefore(gravityNode, insnList); // insert if main.instructions.insert(putFieldNode, newLabelNode); // end if }
Example #8
Source File: ExceptionObfuscationTX.java From zelixkiller with GNU General Public License v3.0 | 6 votes |
private void check(ClassNode cn, MethodNode mn, TryCatchBlockNode tcb, LabelNode handler) { AbstractInsnNode ain = handler; while (ain.getOpcode() == -1) { // skip labels and frames ain = ain.getNext(); } if (ain.getOpcode() == ATHROW) { removeTCB(mn, tcb); } else if (ain instanceof MethodInsnNode && ain.getNext().getOpcode() == ATHROW) { MethodInsnNode min = (MethodInsnNode) ain; if (min.owner.equals(cn.name)) { MethodNode getter = ClassUtils.getMethod(cn, min.name, min.desc); AbstractInsnNode getterFirst = getter.instructions.getFirst(); while (getterFirst.getOpcode() == -1) { getterFirst = ain.getNext(); } if (getterFirst instanceof VarInsnNode && getterFirst.getNext().getOpcode() == ARETURN) { if (((VarInsnNode) getterFirst).var == 0) { removeTCB(mn, tcb); } } } } }
Example #9
Source File: CaseAdapter.java From jumbune with GNU Lesser General Public License v3.0 | 6 votes |
/** * <p> * This method Handled the Switch block of TableSwitchInsnNode type in a * method * </p>. * * @param currentTableSwithInsn Type of switch block */ private void processTableSwitchBlock( TableSwitchInsnNode currentTableSwithInsn) { LabelNode currentLabel = currentTableSwithInsn.dflt; int switchStartIndex = CollectionUtil.getObjectIndexInArray(insnArr, currentTableSwithInsn); int switchTargetIndex = CollectionUtil.getObjectIndexInArray(insnArr, currentLabel); if (switchTargetIndex > switchStartIndex) { LOGGER.debug("switch block ended at: " + switchTargetIndex); switchCount++; AbstractInsnNode[] ainSwitchBlock = new AbstractInsnNode[] { currentTableSwithInsn.getPrevious(), currentLabel }; Integer[] lineNumbers = getLineNumbersForSwitchBlock(ainSwitchBlock); InsnList[] il = getInsnForswitchBlock(switchCount, lineNumbers); addInsnForswitchBlock(il, ainSwitchBlock); scanIndexForswitch = switchTargetIndex; handleTableSwitchCases(currentTableSwithInsn); } }
Example #10
Source File: Tableswitch.java From nuls-v2 with MIT License | 6 votes |
public static void tableswitch(final Frame frame) { TableSwitchInsnNode table = frame.tableSwitchInsnNode(); LabelNode labelNode = table.dflt; int index = frame.operandStack.popInt(); int min = table.min; int max = table.max; int size = max - min + 1; for (int i = 0; i < size; i++) { if (index == (i + min)) { labelNode = table.labels.get(i); break; } } frame.jump(labelNode); //Log.opcode(frame.getCurrentOpCode()); }
Example #11
Source File: ASMMethodVariables.java From pinpoint with Apache License 2.0 | 6 votes |
public void initLocalVariables(final InsnList instructions) { // find enter & exit instruction. final LabelNode variableStartLabelNode = new LabelNode(); final LabelNode variableEndLabelNode = new LabelNode(); if(instructions.getFirst() != null) { instructions.insertBefore(instructions.getFirst(), variableStartLabelNode); } else { instructions.insert(variableStartLabelNode); } instructions.insert(instructions.getLast(), variableEndLabelNode); if (!isStatic()) { addLocalVariable("this", Type.getObjectType(this.declaringClassInternalName).getDescriptor(), variableStartLabelNode, variableEndLabelNode); } for (Type type : this.argumentTypes) { addLocalVariable(JavaAssistUtils.javaClassNameToVariableName(type.getClassName()), type.getDescriptor(), variableStartLabelNode, variableEndLabelNode); } }
Example #12
Source File: InstructionComparator.java From NOVA-Core with GNU Lesser General Public License v3.0 | 6 votes |
private static InsnListSection insnListMatchesL(InsnList haystack, InsnList needle, int start, HashSet<LabelNode> controlFlowLabels) { int h = start, n = 0; for (; h < haystack.size() && n < needle.size(); h++) { AbstractInsnNode insn = haystack.get(h); if (insn.getType() == 15) { continue; } if (insn.getType() == 8 && !controlFlowLabels.contains(insn)) { continue; } if (!insnEqual(haystack.get(h), needle.get(n))) { return null; } n++; } if (n != needle.size()) { return null; } return new InsnListSection(haystack, start, h - 1); }
Example #13
Source File: DoCompiler.java From jphp with Apache License 2.0 | 6 votes |
@Override public void write(DoStmtToken token) { expr.writeDefineVariables(token.getLocal()); LabelNode start = expr.writeLabel(node, token.getMeta().getStartLine()); LabelNode end = new LabelNode(); method.pushJump(end, start); expr.write(token.getBody()); method.popJump(); expr.writeConditional(token.getCondition(), end); add(new JumpInsnNode(GOTO, start)); add(end); add(new LineNumberNode(token.getMeta().getEndLine(), end)); expr.writeUndefineVariables(token.getLocal()); }
Example #14
Source File: InstructionComparator.java From NOVA-Core with GNU Lesser General Public License v3.0 | 6 votes |
private static InsnListSection insnListMatchesL(InsnList haystack, InsnList needle, int start, HashSet<LabelNode> controlFlowLabels) { int h = start, n = 0; for (; h < haystack.size() && n < needle.size(); h++) { AbstractInsnNode insn = haystack.get(h); if (insn.getType() == 15) { continue; } if (insn.getType() == 8 && !controlFlowLabels.contains(insn)) { continue; } if (!insnEqual(haystack.get(h), needle.get(n))) { return null; } n++; } if (n != needle.size()) { return null; } return new InsnListSection(haystack, start, h - 1); }
Example #15
Source File: NormalInvokeContinuationPoint.java From coroutines with GNU Lesser General Public License v3.0 | 5 votes |
NormalInvokeContinuationPoint( Integer lineNumber, MethodInsnNode invokeInstruction, Frame<BasicValue> frame) { // lineNumber is null if it doesn't exist Validate.notNull(invokeInstruction); // stateModifierMethod is null if it doesn't exist Validate.notNull(frame); this.lineNumber = lineNumber; this.invokeInstruction = invokeInstruction; this.continueExecutionLabel = new LabelNode(); this.frame = frame; }
Example #16
Source File: VisGraphPatch.java From ForgeHax with MIT License | 5 votes |
@Inject( description = "Add hook that adds or logic to the jump that checks if setAllVisible(true) should be called" ) public void inject(MethodNode main) { AbstractInsnNode node = ASMHelper.findPattern(main.instructions.getFirst(), new int[]{SIPUSH, IF_ICMPGE}, "xx"); Objects.requireNonNull(node, "Find pattern failed for node"); // gets opcode IF_ICMPGE JumpInsnNode greaterThanJump = (JumpInsnNode) node.getNext(); LabelNode nextIfStatement = greaterThanJump.label; LabelNode orLabel = new LabelNode(); // remove IF_ICMPGE main.instructions.remove(greaterThanJump); InsnList insnList = new InsnList(); insnList.add(new JumpInsnNode(IF_ICMPLT, orLabel)); insnList.add( ASMHelper.call(INVOKESTATIC, TypesHook.Methods.ForgeHaxHooks_shouldDisableCaveCulling)); insnList.add(new JumpInsnNode(IFEQ, nextIfStatement)); insnList.add(orLabel); main.instructions.insert(node, insnList); }
Example #17
Source File: ConfigureMapReduceAdapter.java From jumbune with GNU Lesser General Public License v3.0 | 5 votes |
/** * <p> * This method provides instruction to inject method call to load the logger * </p>. * * @return InsnList Instructions */ private InsnList loadLogger() { LOGGER.debug(MessageFormat.format(InstrumentationMessageLoader .getMessage(MessageConstants.LOG_LOAD_LOGGER), getClassName())); InsnList il = new InsnList(); il.add(new LabelNode()); String logFileDir = workerLogLocation.substring(0, workerLogLocation.lastIndexOf('/') + 1); // getting task attempt id il.add(new LdcInsnNode(logFileDir)); il.add(new VarInsnNode(Opcodes.ALOAD, 1)); il.add(new LdcInsnNode(isMapperClass())); String methodDesc = null; if (isOldApiClazz()) { il.add(new VarInsnNode(Opcodes.ALOAD, 0)); il.add(new FieldInsnNode(Opcodes.GETFIELD, ConfigurationUtil .convertQualifiedClassNameToInternalName(getClassName()), InstrumentConstants.FIELD_LOADLOGGER, "Z")); il.add(new VarInsnNode(Opcodes.ALOAD, 0)); il.add(new FieldInsnNode(Opcodes.GETFIELD, ConfigurationUtil .convertQualifiedClassNameToInternalName(getClassName()), InstrumentConstants.FIELD_LOGGERNUMBER, "I")); methodDesc = Type.getMethodDescriptor(Type.VOID_TYPE, TYPE_STRING, TYPE_JOBCONF, Type.BOOLEAN_TYPE, Type.BOOLEAN_TYPE, Type.INT_TYPE); } else { methodDesc = Type.getMethodDescriptor(Type.VOID_TYPE, TYPE_STRING, TYPE_TASKINPUTOUTPUTCONTEXT, Type.BOOLEAN_TYPE); } il.add(new MethodInsnNode(Opcodes.INVOKESTATIC, Type .getInternalName(MapReduceExecutionUtil.class), "configureLogging", methodDesc)); return il; }
Example #18
Source File: KotlinInterceptor.java From pitest-kotlin with Apache License 2.0 | 5 votes |
private static SequenceQuery<AbstractInsnNode> safeCast() { Slot<LabelNode> nullJump = Slot.create(LabelNode.class); return QueryStart .any(AbstractInsnNode.class) .then(opCode(Opcodes.INSTANCEOF).and(mutationPoint())) .then(opCode(Opcodes.IFNE).and(jumpsTo(nullJump.write()).and(mutationPoint()))) .then(opCode(Opcodes.POP)) .then(opCode(Opcodes.ACONST_NULL)) .then(labelNode(nullJump.read())); }
Example #19
Source File: ASMHelper.java From NOVA-Core with GNU Lesser General Public License v3.0 | 5 votes |
public static InsnList cloneInsnList(Map<LabelNode, LabelNode> labelMap, InsnList insns) { InsnList clone = new InsnList(); for (AbstractInsnNode insn = insns.getFirst(); insn != null; insn = insn.getNext()) { clone.add(insn.clone(labelMap)); } return clone; }
Example #20
Source File: ASMUtilsTest.java From radon with GNU General Public License v3.0 | 5 votes |
@Test public void testIsInstruction() { Assert.assertFalse(ASMUtils.isInstruction( PowerMockito.mock(FrameNode.class))); Assert.assertFalse(ASMUtils.isInstruction( PowerMockito.mock(LabelNode.class))); Assert.assertFalse(ASMUtils.isInstruction( PowerMockito.mock(LineNumberNode.class))); Assert.assertTrue(ASMUtils.isInstruction( PowerMockito.mock(InsnNode.class))); }
Example #21
Source File: MethodUtils.java From zelixkiller with GNU General Public License v3.0 | 5 votes |
/** * copy InsnList start included, end excluded * * @param list * @param start * @param end * @return */ public static InsnList copy(InsnList list, AbstractInsnNode start, AbstractInsnNode end) { InsnList newList = new InsnList(); Map<LabelNode, LabelNode> labelMap = getLabelMap(list); AbstractInsnNode ain = start == null ? list.getFirst() : start; while (ain != null && ain != end) { newList.add(ain.clone(labelMap)); ain = ain.getNext(); } return newList; }
Example #22
Source File: ReturnInstructionUnifier.java From grappa with Apache License 2.0 | 5 votes |
@Override public void process(@Nonnull final ParserClassNode classNode, @Nonnull final RuleMethod method) throws Exception { Objects.requireNonNull(classNode, "classNode"); Objects.requireNonNull(method, "method"); AbstractInsnNode current = method.instructions.getLast(); // find last return while (current.getOpcode() != ARETURN) current = current.getPrevious(); final LabelNode lastReturnLabel = new LabelNode(); method.instructions.insertBefore(current, lastReturnLabel); // iterate backwards up to first instructions while ((current = current.getPrevious()) != null) { // replace returns with gotos if (current.getOpcode() != ARETURN) continue; final JumpInsnNode insn = new JumpInsnNode(GOTO, lastReturnLabel); method.instructions.set(current, insn); current = insn; } }
Example #23
Source File: ASMBlock.java From CodeChickenLib with GNU Lesser General Public License v2.1 | 5 votes |
public ASMBlock copy() { BiMap<String, LabelNode> labels = HashBiMap.create(); Map<LabelNode, LabelNode> labelMap = list.cloneLabels(); for(Entry<String, LabelNode> entry : this.labels.entrySet()) labels.put(entry.getKey(), labelMap.get(entry.getValue())); return new ASMBlock(list.copy(labelMap), labels); }
Example #24
Source File: TableSwitchInsnNodeSerializer.java From maple-ir with GNU General Public License v3.0 | 5 votes |
@Override public TableSwitchInsnNode deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { JsonObject jsonObject = (JsonObject) json; int min = jsonObject.get("min").getAsInt(); int max = jsonObject.get("max").getAsInt(); LabelNode dflt = context.deserialize(jsonObject.get("dflt"), LabelNode.class); List<LabelNode> labelList = context.deserialize(jsonObject.get("labels"), List.class); LabelNode[] labels = new LabelNode[labelList.size()]; for(int i=0; i < labels.length; i++){ labels[i] = labelList.get(i); } return new TableSwitchInsnNode(min, max, dflt, labels); }
Example #25
Source File: GenericGenerators.java From coroutines with GNU Lesser General Public License v3.0 | 5 votes |
/** * Generates instructions for a switch table. This does not automatically generate jumps at the end of each default/case statement. It's * your responsibility to either add the relevant jumps, throws, or returns at each default/case statement, otherwise the code will * just fall through (which is likely not what you want). * @param indexInsnList instructions to calculate the index -- must leave an int on the stack * @param defaultInsnList instructions to execute on default statement -- must leave the stack unchanged * @param caseStartIdx the number which the case statements start at * @param caseInsnLists instructions to execute on each case statement -- must leave the stack unchanged * @return instructions for a table switch * @throws NullPointerException if any argument is {@code null} or contains {@code null} * @throws IllegalArgumentException if any numeric argument is {@code < 0}, or if {@code caseInsnLists} is empty */ public static InsnList tableSwitch(InsnList indexInsnList, InsnList defaultInsnList, int caseStartIdx, InsnList... caseInsnLists) { Validate.notNull(defaultInsnList); Validate.notNull(indexInsnList); Validate.isTrue(caseStartIdx >= 0); Validate.notNull(caseInsnLists); Validate.noNullElements(caseInsnLists); Validate.isTrue(caseInsnLists.length > 0); InsnList ret = new InsnList(); LabelNode defaultLabelNode = new LabelNode(); LabelNode[] caseLabelNodes = new LabelNode[caseInsnLists.length]; for (int i = 0; i < caseInsnLists.length; i++) { caseLabelNodes[i] = new LabelNode(); } ret.add(indexInsnList); ret.add(new TableSwitchInsnNode(caseStartIdx, caseStartIdx + caseInsnLists.length - 1, defaultLabelNode, caseLabelNodes)); for (int i = 0; i < caseInsnLists.length; i++) { LabelNode caseLabelNode = caseLabelNodes[i]; InsnList caseInsnList = caseInsnLists[i]; if (caseInsnList != null) { ret.add(caseLabelNode); ret.add(caseInsnList); } } if (defaultInsnList != null) { ret.add(defaultLabelNode); ret.add(defaultInsnList); } return ret; }
Example #26
Source File: ChainedTaskMethodAdapter.java From jumbune with GNU Lesser General Public License v3.0 | 5 votes |
/** * <p> * Adds a local variable for chained mapper task * </p>. * * @param varIndex Variable index */ @SuppressWarnings({ "unchecked" }) private void addLocalJobConf(int varIndex) { LabelNode begin = new LabelNode(); LabelNode end = new LabelNode(); instructions.insertBefore(instructions.getFirst(), begin); instructions.insert(instructions.getLast(), end); LocalVariableNode lv = new LocalVariableNode(LOCAL_CONF_VARIABLE_NAME + ++localJobConfAdded, Type.getDescriptor(JobConf.class), null, begin, end, varIndex); localVariables.add(lv); }
Example #27
Source File: InstructionMatchers.java From pitest with Apache License 2.0 | 5 votes |
private static Match<AbstractInsnNode> storeJumpTarget( final SlotWrite<LabelNode> label) { return (c, t) -> { if (t instanceof JumpInsnNode ) { c.store(label, ((JumpInsnNode) t).label); return true; } return false; }; }
Example #28
Source File: ClinitCutter.java From zelixkiller with GNU General Public License v3.0 | 5 votes |
private static boolean blockContainsSetter(AbstractInsnNode ain) { if (ain.getOpcode() == PUTSTATIC && ((FieldInsnNode) ain).desc.endsWith("Ljava/lang/String;")) { return true; } AbstractInsnNode ain2 = ain; while (ain2 != null && !(ain2 instanceof LabelNode)) { if (ain2.getOpcode() == PUTSTATIC && ain2.getPrevious().getOpcode() == ANEWARRAY) { FieldInsnNode fin = (FieldInsnNode) ain2; if (fin.desc.endsWith("[Ljava/lang/String;")) return true; } ain2 = ain2.getPrevious(); } return false; }
Example #29
Source File: InstrumentUtil.java From jumbune with GNU Lesser General Public License v3.0 | 5 votes |
/** * method for adding logger information * @param sequence * @param className * @return */ public static InsnList addChainLoggerInfo(int sequence, String className) { String method = "addChainLoggerInfo"; InsnList il = new InsnList(); il.add(new LabelNode()); il.add(new LdcInsnNode(sequence)); il.add(new LdcInsnNode(className)); il.add(new MethodInsnNode(Opcodes.INVOKESTATIC, CLASSNAME_LOGUTIL, method, Type.getMethodDescriptor(Type.VOID_TYPE, Type.INT_TYPE, TYPE_STRING))); return il; }
Example #30
Source File: JSRInlinerAdapter.java From JReFrameworker with MIT License | 5 votes |
@Override public void visitJumpInsn(final int opcode, final Label label) { super.visitJumpInsn(opcode, label); LabelNode labelNode = ((JumpInsnNode) instructions.getLast()).label; if (opcode == JSR && !subroutinesInsns.containsKey(labelNode)) { subroutinesInsns.put(labelNode, new BitSet()); } }