List of usage examples for org.objectweb.asm Opcodes TOP
Integer TOP
To view the source code for org.objectweb.asm Opcodes TOP.
Click Source Link
From source file:blockphysics.asm.BPTransformer.java
License:Open Source License
private byte[] transformBlockPhysics(byte[] bytes) { /*try// w w w. j av a2 s. c o m { FileOutputStream fos = new FileOutputStream("d:/BlockPhysics.orig.class"); fos.write(bytes); fos.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); }*/ try { Class.forName("org.bukkit.Bukkit"); System.out.println("[BlockPhysics] Bukkit detected."); } catch (ClassNotFoundException e) { return bytes; } System.out.print("[BlockPhysics] Patching BlockPhysics.class ............"); boolean ok = false; ClassNode classNode = new ClassNode(); ClassReader classReader = new ClassReader(bytes); classReader.accept(classNode, 0); MethodNode m; Iterator<MethodNode> methods = classNode.methods.iterator(); while (methods.hasNext()) { m = methods.next(); if (m.name.equals("tickBlocksRandomMove") && m.desc.equals("(Ljr;)V")) { m.instructions.clear(); m.localVariables.clear(); InsnList toInject = new InsnList(); toInject.add(new FieldInsnNode(GETSTATIC, "blockphysics/BlockPhysics", "skipMove", "Z")); LabelNode l0 = new LabelNode(); toInject.add(new JumpInsnNode(IFEQ, l0)); toInject.add(new InsnNode(RETURN)); toInject.add(l0); toInject.add(new FrameNode(Opcodes.F_SAME, 0, null, 0, null)); toInject.add(new VarInsnNode(ALOAD, 0)); toInject.add(new FieldInsnNode(GETFIELD, "jr", "G", "Lgnu/trove/map/hash/TLongShortHashMap;")); toInject.add(new MethodInsnNode(INVOKEVIRTUAL, "gnu/trove/map/hash/TLongShortHashMap", "iterator", "()Lgnu/trove/iterator/TLongShortIterator;")); toInject.add(new VarInsnNode(ASTORE, 1)); LabelNode l1 = new LabelNode(); toInject.add(l1); toInject.add(new FrameNode(Opcodes.F_APPEND, 1, new Object[] { "gnu/trove/iterator/TLongShortIterator" }, 0, null)); toInject.add(new VarInsnNode(ALOAD, 1)); toInject.add(new MethodInsnNode(INVOKEINTERFACE, "gnu/trove/iterator/TLongShortIterator", "hasNext", "()Z")); LabelNode l2 = new LabelNode(); toInject.add(new JumpInsnNode(IFEQ, l2)); toInject.add(new VarInsnNode(ALOAD, 1)); toInject.add(new MethodInsnNode(INVOKEINTERFACE, "gnu/trove/iterator/TLongShortIterator", "advance", "()V")); toInject.add(new VarInsnNode(ALOAD, 1)); toInject.add( new MethodInsnNode(INVOKEINTERFACE, "gnu/trove/iterator/TLongShortIterator", "key", "()J")); toInject.add(new VarInsnNode(LSTORE, 2)); toInject.add(new VarInsnNode(ALOAD, 0)); toInject.add(new InsnNode(POP)); toInject.add(new VarInsnNode(LLOAD, 2)); toInject.add(new MethodInsnNode(INVOKESTATIC, "abv", "keyToX", "(J)I")); toInject.add(new VarInsnNode(ISTORE, 4)); toInject.add(new VarInsnNode(ALOAD, 0)); toInject.add(new InsnNode(POP)); toInject.add(new VarInsnNode(LLOAD, 2)); toInject.add(new MethodInsnNode(INVOKESTATIC, "abv", "keyToZ", "(J)I")); toInject.add(new VarInsnNode(ISTORE, 5)); toInject.add(new VarInsnNode(ILOAD, 4)); toInject.add(new IntInsnNode(BIPUSH, 16)); toInject.add(new InsnNode(IMUL)); toInject.add(new VarInsnNode(ISTORE, 6)); toInject.add(new VarInsnNode(ILOAD, 5)); toInject.add(new IntInsnNode(BIPUSH, 16)); toInject.add(new InsnNode(IMUL)); toInject.add(new VarInsnNode(ISTORE, 7)); toInject.add(new VarInsnNode(ALOAD, 0)); toInject.add(new VarInsnNode(ILOAD, 4)); toInject.add(new VarInsnNode(ILOAD, 5)); toInject.add(new MethodInsnNode(INVOKEVIRTUAL, "jr", "e", "(II)Ladq;")); toInject.add(new VarInsnNode(ASTORE, 8)); toInject.add(new VarInsnNode(ALOAD, 8)); toInject.add(new MethodInsnNode(INVOKEVIRTUAL, "adq", "i", "()[Ladr;")); toInject.add(new VarInsnNode(ASTORE, 12)); toInject.add(new VarInsnNode(ALOAD, 12)); toInject.add(new InsnNode(ARRAYLENGTH)); toInject.add(new VarInsnNode(ISTORE, 9)); toInject.add(new InsnNode(ICONST_0)); toInject.add(new VarInsnNode(ISTORE, 10)); LabelNode l3 = new LabelNode(); toInject.add(l3); toInject.add(new FrameNode(Opcodes.F_FULL, 12, new Object[] { "jr", "gnu/trove/iterator/TLongShortIterator", Opcodes.LONG, Opcodes.INTEGER, Opcodes.INTEGER, Opcodes.INTEGER, Opcodes.INTEGER, "adq", Opcodes.INTEGER, Opcodes.INTEGER, Opcodes.TOP, "[Ladr;" }, 0, new Object[] {})); toInject.add(new VarInsnNode(ILOAD, 10)); toInject.add(new VarInsnNode(ILOAD, 9)); LabelNode l4 = new LabelNode(); toInject.add(new JumpInsnNode(IF_ICMPGE, l4)); toInject.add(new VarInsnNode(ALOAD, 12)); toInject.add(new VarInsnNode(ILOAD, 10)); toInject.add(new InsnNode(AALOAD)); toInject.add(new VarInsnNode(ASTORE, 13)); toInject.add(new VarInsnNode(ALOAD, 13)); LabelNode l5 = new LabelNode(); toInject.add(new JumpInsnNode(IFNULL, l5)); toInject.add(new InsnNode(ICONST_0)); toInject.add(new VarInsnNode(ISTORE, 14)); LabelNode l6 = new LabelNode(); toInject.add(l6); toInject.add(new FrameNode(Opcodes.F_APPEND, 2, new Object[] { "adr", Opcodes.INTEGER }, 0, null)); toInject.add(new VarInsnNode(ILOAD, 14)); toInject.add(new InsnNode(ICONST_3)); toInject.add(new JumpInsnNode(IF_ICMPGE, l5)); toInject.add(new FieldInsnNode(GETSTATIC, "blockphysics/BlockPhysics", "updateLCG", "I")); toInject.add(new InsnNode(ICONST_3)); toInject.add(new InsnNode(IMUL)); toInject.add(new LdcInsnNode(new Integer(1013904223))); toInject.add(new InsnNode(IADD)); toInject.add(new FieldInsnNode(PUTSTATIC, "blockphysics/BlockPhysics", "updateLCG", "I")); toInject.add(new FieldInsnNode(GETSTATIC, "blockphysics/BlockPhysics", "updateLCG", "I")); toInject.add(new InsnNode(ICONST_2)); toInject.add(new InsnNode(ISHR)); toInject.add(new VarInsnNode(ISTORE, 11)); toInject.add(new VarInsnNode(ILOAD, 11)); toInject.add(new IntInsnNode(BIPUSH, 15)); toInject.add(new InsnNode(IAND)); toInject.add(new VarInsnNode(ISTORE, 15)); toInject.add(new VarInsnNode(ILOAD, 11)); toInject.add(new IntInsnNode(BIPUSH, 8)); toInject.add(new InsnNode(ISHR)); toInject.add(new IntInsnNode(BIPUSH, 15)); toInject.add(new InsnNode(IAND)); toInject.add(new VarInsnNode(ISTORE, 16)); toInject.add(new VarInsnNode(ILOAD, 11)); toInject.add(new IntInsnNode(BIPUSH, 16)); toInject.add(new InsnNode(ISHR)); toInject.add(new IntInsnNode(BIPUSH, 15)); toInject.add(new InsnNode(IAND)); toInject.add(new VarInsnNode(ISTORE, 17)); toInject.add(new VarInsnNode(ALOAD, 13)); toInject.add(new VarInsnNode(ILOAD, 15)); toInject.add(new VarInsnNode(ILOAD, 17)); toInject.add(new VarInsnNode(ILOAD, 16)); toInject.add(new MethodInsnNode(INVOKEVIRTUAL, "adr", "a", "(III)I")); toInject.add(new VarInsnNode(ISTORE, 18)); toInject.add(new VarInsnNode(ALOAD, 13)); toInject.add(new VarInsnNode(ILOAD, 15)); toInject.add(new VarInsnNode(ILOAD, 17)); toInject.add(new VarInsnNode(ILOAD, 16)); toInject.add(new MethodInsnNode(INVOKEVIRTUAL, "adr", "b", "(III)I")); toInject.add(new VarInsnNode(ISTORE, 19)); toInject.add(new FieldInsnNode(GETSTATIC, "blockphysics/BlockPhysics", "blockSet", "[[Lblockphysics/BlockDef;")); toInject.add(new VarInsnNode(ILOAD, 18)); toInject.add(new InsnNode(AALOAD)); toInject.add(new VarInsnNode(ILOAD, 19)); toInject.add(new InsnNode(AALOAD)); toInject.add(new FieldInsnNode(GETFIELD, "blockphysics/BlockDef", "randomtick", "Z")); LabelNode l7 = new LabelNode(); toInject.add(new JumpInsnNode(IFEQ, l7)); toInject.add(new VarInsnNode(ALOAD, 0)); toInject.add(new VarInsnNode(ILOAD, 15)); toInject.add(new VarInsnNode(ILOAD, 6)); toInject.add(new InsnNode(IADD)); toInject.add(new VarInsnNode(ILOAD, 17)); toInject.add(new VarInsnNode(ALOAD, 13)); toInject.add(new MethodInsnNode(INVOKEVIRTUAL, "adr", "d", "()I")); toInject.add(new InsnNode(IADD)); toInject.add(new VarInsnNode(ILOAD, 16)); toInject.add(new VarInsnNode(ILOAD, 7)); toInject.add(new InsnNode(IADD)); toInject.add(new VarInsnNode(ILOAD, 18)); toInject.add(new VarInsnNode(ILOAD, 19)); toInject.add(new InsnNode(ICONST_0)); toInject.add(new MethodInsnNode(INVOKESTATIC, "blockphysics/BlockPhysics", "tryToMove", "(Labv;IIIIIZ)Z")); toInject.add(new InsnNode(POP)); toInject.add(l7); toInject.add(new FrameNode(Opcodes.F_FULL, 14, new Object[] { "jr", "gnu/trove/iterator/TLongShortIterator", Opcodes.LONG, Opcodes.INTEGER, Opcodes.INTEGER, Opcodes.INTEGER, Opcodes.INTEGER, "adq", Opcodes.INTEGER, Opcodes.INTEGER, Opcodes.INTEGER, "[Ladr;", "adr", Opcodes.INTEGER }, 0, new Object[] {})); toInject.add(new IincInsnNode(14, 1)); toInject.add(new JumpInsnNode(GOTO, l6)); toInject.add(l5); toInject.add(new FrameNode(Opcodes.F_FULL, 12, new Object[] { "jr", "gnu/trove/iterator/TLongShortIterator", Opcodes.LONG, Opcodes.INTEGER, Opcodes.INTEGER, Opcodes.INTEGER, Opcodes.INTEGER, "adq", Opcodes.INTEGER, Opcodes.INTEGER, Opcodes.TOP, "[Ladr;" }, 0, new Object[] {})); toInject.add(new IincInsnNode(10, 1)); toInject.add(new JumpInsnNode(GOTO, l3)); toInject.add(l4); toInject.add(new FrameNode(Opcodes.F_FULL, 2, new Object[] { "jr", "gnu/trove/iterator/TLongShortIterator" }, 0, new Object[] {})); toInject.add(new JumpInsnNode(GOTO, l1)); toInject.add(l2); toInject.add(new FrameNode(Opcodes.F_CHOP, 1, null, 0, null)); toInject.add(new InsnNode(RETURN)); m.instructions.add(toInject); ok = true; break; } } ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS); classNode.accept(cw); if (ok) System.out.println("OK"); else System.out.println("Failed." + ok); /*try { FileOutputStream fos = new FileOutputStream("d:/BlockPhysics.class"); fos.write(cw.toByteArray()); fos.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); }*/ return cw.toByteArray(); }
From source file:br.usp.each.saeg.badua.core.internal.instr.CoverageMethodTransformer.java
License:Open Source License
@Override @SuppressWarnings("unchecked") public void transform(final MethodNode methodNode) { final DefUseAnalyzer analyzer = new DefUseAnalyzer(); try {/*from w w w . j a va2 s . co m*/ analyzer.analyze(className, methodNode); } catch (final AnalyzerException e) { throw new RuntimeException(e); } final DefUseFrame[] frames = analyzer.getDefUseFrames(); final Variable[] variables = analyzer.getVariables(); final int[][] successors = analyzer.getSuccessors(); final int[][] predecessors = analyzer.getPredecessors(); final int[][] basicBlocks = analyzer.getBasicBlocks(); final int[] leaders = analyzer.getLeaders(); final DefUseChain[] chains = DefUseChain.toBasicBlock( new DepthFirstDefUseChainSearch().search(frames, variables, successors, predecessors), leaders, basicBlocks); this.chains = chains; if (chains.length == 0) return; // basic block definitions final Set<Variable>[] defs = (Set<Variable>[]) new Set<?>[basicBlocks.length]; for (int b = 0; b < basicBlocks.length; b++) { defs[b] = new HashSet<Variable>(); for (final int insnIndex : basicBlocks[b]) { defs[b].addAll(frames[insnIndex].getDefinitions()); } } // bit-sets final BitSet[] potcov = new BitSet[basicBlocks.length]; final BitSet[] potcovpuse = new BitSet[basicBlocks.length]; final BitSet[] born = new BitSet[basicBlocks.length]; final BitSet[] disabled = new BitSet[basicBlocks.length]; final BitSet[] sleepy = new BitSet[basicBlocks.length]; for (int b = 0; b < basicBlocks.length; b++) { potcov[b] = new BitSet(chains.length); potcovpuse[b] = new BitSet(chains.length); born[b] = new BitSet(chains.length); disabled[b] = new BitSet(chains.length); sleepy[b] = new BitSet(chains.length); for (int i = 0; i < chains.length; i++) { final DefUseChain chain = chains[i]; if (chain.target != -1 ? chain.target == b : chain.use == b) { potcov[b].set(i); if (chain.target != -1) { potcovpuse[b].set(i); } } if (chain.def == b) { born[b].set(i); } if (chain.def != b && defs[b].contains(variables[chain.var])) { disabled[b].set(i); } if (chain.target != -1) { if (chain.use != b) { sleepy[b].set(i); } } } } // first/last valid instructions final AbstractInsnNode[] first = new AbstractInsnNode[basicBlocks.length]; final AbstractInsnNode[] last = new AbstractInsnNode[basicBlocks.length]; for (int b = 0; b < basicBlocks.length; b++) { for (final int insnIndex : basicBlocks[b]) { final AbstractInsnNode insn = methodNode.instructions.get(insnIndex); // skip switch (insn.getType()) { case AbstractInsnNode.LABEL: case AbstractInsnNode.FRAME: case AbstractInsnNode.LINE: continue; } if (first[b] == null) { first[b] = insn; } last[b] = insn; } } AbstractInsnNode insn = methodNode.instructions.getFirst(); final int windows = (chains.length + 63) / 64; final int[] indexes = new int[windows]; for (int w = 0; w < windows; w++) { indexes[w] = idGen.nextId(); LabelFrameNode.insertBefore(insn, methodNode.instructions, init(methodNode, w)); } for (int b = 0; b < basicBlocks.length; b++) { final long[] lPotcov = BitSetUtils.toLongArray(potcov[b], windows); final long[] lPotcovpuse = BitSetUtils.toLongArray(potcovpuse[b], windows); final long[] lBorn = BitSetUtils.toLongArray(born[b], windows); final long[] lDisabled = BitSetUtils.toLongArray(disabled[b], windows); final long[] lSleepy = BitSetUtils.toLongArray(sleepy[b], windows); for (int w = 0; w < windows; w++) { final int nPredecessors = predecessors[basicBlocks[b][0]].length; final Probe p = probe(methodNode, w, nPredecessors == 0); p.potcov = lPotcov[w]; p.potcovpuse = lPotcovpuse[w]; p.born = lBorn[w]; p.disabled = lDisabled[w]; p.sleepy = lSleepy[w]; p.singlePredecessor = nPredecessors == 1; LabelFrameNode.insertBefore(first[b], methodNode.instructions, p); } if (isReturn(last[b].getOpcode())) { for (int w = 0; w < windows; w++) { final Probe p = update(methodNode, w, indexes[w]); LabelFrameNode.insertBefore(last[b], methodNode.instructions, p); } } } // Finally, update the frames while (insn != null) { if (insn instanceof FrameNode) { final FrameNode frame = (FrameNode) insn; frame.local = new ArrayList<Object>(frame.local); int size = 0; for (final Object obj : frame.local) { size++; if (obj.equals(Opcodes.DOUBLE) || obj.equals(Opcodes.LONG)) { size++; } } while (size < methodNode.maxLocals) { frame.local.add(Opcodes.TOP); size++; } final Integer type = typeOfVars(); for (int i = 0; i < windows; i++) { frame.local.add(type); frame.local.add(type); frame.local.add(type); } } insn = insn.getNext(); } methodNode.maxLocals = methodNode.maxLocals + windows * numOfVars(); methodNode.maxStack = methodNode.maxStack + 6; }
From source file:ch.eiafr.cojac.FloatVariablesSorter.java
License:Apache License
@Override public void visitFrame(int type, int nLocal, final Object[] local, int nStack, final Object[] stack) { ArrayList<Object> newLocal = new ArrayList<>(); int nDummySlotsToAdd = 0; for (Object object : local) { if (object == Opcodes.DOUBLE) { newLocal.add(COJAC_DOUBLE_WRAPPER_INTERNAL_NAME); } else if (object == Opcodes.FLOAT) { newLocal.add(COJAC_FLOAT_WRAPPER_INTERNAL_NAME); } else if (object instanceof String && ((String) object).endsWith("[D")) { String tab = (String) object; tab = tab.replaceAll("D", COJAC_DOUBLE_WRAPPER_TYPE_DESCR); newLocal.add(tab);//from ww w . ja v a 2 s .co m } else if (object instanceof String && ((String) object).endsWith("[F")) { String tab = (String) object; tab = tab.replaceAll("F", COJAC_FLOAT_WRAPPER_TYPE_DESCR); newLocal.add(tab); } else { newLocal.add(object); } } while (nDummySlotsToAdd > 0) { newLocal.add(Opcodes.TOP); // or maybe Opcodes.NULL marker? nLocal++; } ArrayList<Object> newStack = new ArrayList<>(); for (Object object : stack) { if (object == Opcodes.DOUBLE) { newStack.add(COJAC_DOUBLE_WRAPPER_INTERNAL_NAME); } else if (object == Opcodes.FLOAT) { newStack.add(COJAC_FLOAT_WRAPPER_INTERNAL_NAME); } else if (object instanceof String && ((String) object).endsWith("[D")) { String tab = (String) object; tab = tab.replaceAll("D", COJAC_DOUBLE_WRAPPER_TYPE_DESCR); newStack.add(tab); } else if (object instanceof String && ((String) object).endsWith("[F")) { String tab = (String) object; tab = tab.replaceAll("F", COJAC_FLOAT_WRAPPER_TYPE_DESCR); newStack.add(tab); } else { newStack.add(object); } } mv.visitFrame(type, nLocal, newLocal.toArray(), nStack, newStack.toArray()); }
From source file:com.google.devtools.build.android.desugar.BytecodeTypeInference.java
License:Open Source License
/** Convert the type in stack map frame to inference type. */ private InferredType convertTypeInStackMapFrame(Object typeInStackMapFrame) { if (typeInStackMapFrame == Opcodes.TOP) { return InferredType.TOP; } else if (typeInStackMapFrame == Opcodes.INTEGER) { return InferredType.INT; } else if (typeInStackMapFrame == Opcodes.FLOAT) { return InferredType.FLOAT; } else if (typeInStackMapFrame == Opcodes.DOUBLE) { return InferredType.DOUBLE; } else if (typeInStackMapFrame == Opcodes.LONG) { return InferredType.LONG; } else if (typeInStackMapFrame == Opcodes.NULL) { return InferredType.NULL; } else if (typeInStackMapFrame == Opcodes.UNINITIALIZED_THIS) { return InferredType.UNINITIALIZED_THIS; } else if (typeInStackMapFrame instanceof String) { String referenceTypeName = (String) typeInStackMapFrame; if (referenceTypeName.charAt(0) == '[') { return InferredType.createNonUninitializedType(referenceTypeName); } else {// w w w . j a v a 2 s. com return InferredType.createNonUninitializedType('L' + referenceTypeName + ';'); } } else if (typeInStackMapFrame instanceof Label) { Label label = (Label) typeInStackMapFrame; return InferredType.createUninitializedType(label); } else { throw new RuntimeException("Cannot reach here. Unhandled element: value=" + typeInStackMapFrame + ", class=" + typeInStackMapFrame.getClass() + ". The current method being desugared is " + methodSignature); } }
From source file:de.dynamicfiles.projects.gradle.plugins.javafx.tasks.internal.MonkeyPatcher.java
License:Apache License
private static void doMonkeyPatchFileHandleLeak(ClassReader classReader, ClassWriter classWriter) { classReader.accept(new ClassVisitor(Opcodes.ASM5, classWriter) { @Override/*from w ww . j ava2s . c om*/ public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { if (!(name.equals(METHOD_TO_MONKEY_PATCH) && desc.equals(METHOD_SIGNATURE_TO_MONKEY_PATCH))) { return super.visitMethod(access, name, desc, signature, exceptions); } // helpful source: http://web.cs.ucla.edu/~msb/cs239-tutorial/ // "We will do this using the Adapter Pattern. Adapters wrap an object, overriding some of its methods, and delegating to the others." // ugly adapter-pattern ... took me more time than I really can tell here <.< return getMonkeyPatchedFileHandleLeakMethodVisitor(access, name, desc, signature, exceptions); } private MethodVisitor getMonkeyPatchedFileHandleLeakMethodVisitor(int access, String name, String desc, String signature, String[] exceptions) { return new MethodVisitor(Opcodes.ASM5, super.visitMethod(access, name, desc, signature, exceptions)) { /* TODO improve detection of lambda-positions, numbers might vary on different compile-versions */ @Override public void visitCode() { // This mostly got generated from ASM itself, except some adjustments for lambda-IDs and removed "visitMaxs()"-call String javalangThrowable = "java/lang/Throwable"; String javaioFile = "java/io/File"; String javalangString = "java/lang/String"; Label l0 = new Label(); Label l1 = new Label(); Label l2 = new Label(); mv.visitTryCatchBlock(l0, l1, l2, javalangThrowable); Label l3 = new Label(); Label l4 = new Label(); Label l5 = new Label(); mv.visitTryCatchBlock(l3, l4, l5, javalangThrowable); Label l6 = new Label(); mv.visitTryCatchBlock(l3, l4, l6, null); Label l7 = new Label(); Label l8 = new Label(); Label l9 = new Label(); mv.visitTryCatchBlock(l7, l8, l9, javalangThrowable); Label l10 = new Label(); mv.visitTryCatchBlock(l5, l10, l6, null); mv.visitInsn(Opcodes.ACONST_NULL); mv.visitVarInsn(Opcodes.ASTORE, 3); mv.visitVarInsn(Opcodes.ALOAD, 2); Label l11 = new Label(); mv.visitJumpInsn(Opcodes.IFNULL, l11); mv.visitVarInsn(Opcodes.ALOAD, 2); mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, javaioFile, "isDirectory", "()Z", false); Label l12 = new Label(); mv.visitJumpInsn(Opcodes.IFNE, l12); mv.visitLabel(l11); mv.visitFrame(Opcodes.F_APPEND, 1, new Object[] { javalangString }, 0, null); mv.visitTypeInsn(Opcodes.NEW, javaioFile); mv.visitInsn(Opcodes.DUP); mv.visitLdcInsn("java.home"); mv.visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/System", "getProperty", "(Ljava/lang/String;)Ljava/lang/String;", false); mv.visitMethodInsn(Opcodes.INVOKESPECIAL, javaioFile, "<init>", "(Ljava/lang/String;)V", false); mv.visitVarInsn(Opcodes.ASTORE, 2); mv.visitLabel(l12); mv.visitFrame(Opcodes.F_SAME, 0, null, 0, null); mv.visitFieldInsn(Opcodes.GETSTATIC, "com/oracle/tools/packager/windows/WinAppBundler", "VS_VERS", "[Ljava/lang/String;"); mv.visitVarInsn(Opcodes.ASTORE, 4); mv.visitVarInsn(Opcodes.ALOAD, 4); mv.visitInsn(Opcodes.ARRAYLENGTH); mv.visitVarInsn(Opcodes.ISTORE, 5); mv.visitInsn(Opcodes.ICONST_0); mv.visitVarInsn(Opcodes.ISTORE, 6); Label l13 = new Label(); mv.visitLabel(l13); mv.visitFrame(Opcodes.F_APPEND, 3, new Object[] { "[Ljava/lang/String;", Opcodes.INTEGER, Opcodes.INTEGER }, 0, null); mv.visitVarInsn(Opcodes.ILOAD, 6); mv.visitVarInsn(Opcodes.ILOAD, 5); Label l14 = new Label(); mv.visitJumpInsn(Opcodes.IF_ICMPGE, l14); mv.visitVarInsn(Opcodes.ALOAD, 4); mv.visitVarInsn(Opcodes.ILOAD, 6); mv.visitInsn(Opcodes.AALOAD); mv.visitVarInsn(Opcodes.ASTORE, 7); mv.visitVarInsn(Opcodes.ALOAD, 0); mv.visitVarInsn(Opcodes.ALOAD, 1); mv.visitVarInsn(Opcodes.ALOAD, 7); mv.visitMethodInsn(Opcodes.INVOKESPECIAL, "com/oracle/tools/packager/windows/WinAppBundler", "copyMSVCDLLs", "(Ljava/io/File;Ljava/lang/String;)Z", false); Label l15 = new Label(); mv.visitJumpInsn(Opcodes.IFEQ, l15); mv.visitVarInsn(Opcodes.ALOAD, 7); mv.visitVarInsn(Opcodes.ASTORE, 3); mv.visitJumpInsn(Opcodes.GOTO, l14); mv.visitLabel(l15); mv.visitFrame(Opcodes.F_SAME, 0, null, 0, null); mv.visitIincInsn(6, 1); mv.visitJumpInsn(Opcodes.GOTO, l13); mv.visitLabel(l14); mv.visitFrame(Opcodes.F_CHOP, 3, null, 0, null); mv.visitVarInsn(Opcodes.ALOAD, 3); Label l16 = new Label(); mv.visitJumpInsn(Opcodes.IFNONNULL, l16); mv.visitTypeInsn(Opcodes.NEW, "java/lang/RuntimeException"); mv.visitInsn(Opcodes.DUP); mv.visitLdcInsn("Not found MSVC dlls"); mv.visitMethodInsn(Opcodes.INVOKESPECIAL, "java/lang/RuntimeException", "<init>", "(Ljava/lang/String;)V", false); mv.visitInsn(Opcodes.ATHROW); mv.visitLabel(l16); mv.visitFrame(Opcodes.F_SAME, 0, null, 0, null); mv.visitTypeInsn(Opcodes.NEW, "java/util/concurrent/atomic/AtomicReference"); mv.visitInsn(Opcodes.DUP); mv.visitMethodInsn(Opcodes.INVOKESPECIAL, "java/util/concurrent/atomic/AtomicReference", "<init>", "()V", false); mv.visitVarInsn(Opcodes.ASTORE, 4); mv.visitVarInsn(Opcodes.ALOAD, 3); mv.visitVarInsn(Opcodes.ASTORE, 5); mv.visitVarInsn(Opcodes.ALOAD, 2); mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, javaioFile, "toPath", "()Ljava/nio/file/Path;", false); mv.visitLdcInsn("bin"); mv.visitMethodInsn(Opcodes.INVOKEINTERFACE, "java/nio/file/Path", "resolve", "(Ljava/lang/String;)Ljava/nio/file/Path;", true); mv.visitMethodInsn(Opcodes.INVOKESTATIC, "java/nio/file/Files", "list", "(Ljava/nio/file/Path;)Ljava/util/stream/Stream;", false); mv.visitVarInsn(Opcodes.ASTORE, 6); mv.visitInsn(Opcodes.ACONST_NULL); mv.visitVarInsn(Opcodes.ASTORE, 7); mv.visitLabel(l3); mv.visitVarInsn(Opcodes.ALOAD, 6); mv.visitInvokeDynamicInsn("test", "()Ljava/util/function/Predicate;", new Handle( Opcodes.H_INVOKESTATIC, "java/lang/invoke/LambdaMetafactory", "metafactory", "(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;"), new Object[] { Type.getType("(Ljava/lang/Object;)Z"), new Handle(Opcodes.H_INVOKESTATIC, "com/oracle/tools/packager/windows/WinAppBundler", "lambda$copyMSVCDLLs$261", "(Ljava/nio/file/Path;)Z"), Type.getType("(Ljava/nio/file/Path;)Z") }); // modified lambda-name mv.visitMethodInsn(Opcodes.INVOKEINTERFACE, "java/util/stream/Stream", "filter", "(Ljava/util/function/Predicate;)Ljava/util/stream/Stream;", true); mv.visitVarInsn(Opcodes.ALOAD, 5); mv.visitInvokeDynamicInsn("test", "(Ljava/lang/String;)Ljava/util/function/Predicate;", new Handle(Opcodes.H_INVOKESTATIC, "java/lang/invoke/LambdaMetafactory", "metafactory", "(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;"), new Object[] { Type.getType("(Ljava/lang/Object;)Z"), new Handle( Opcodes.H_INVOKESTATIC, "com/oracle/tools/packager/windows/WinAppBundler", "lambda$copyMSVCDLLs$262", "(Ljava/lang/String;Ljava/nio/file/Path;)Z"), Type.getType("(Ljava/nio/file/Path;)Z") }); // modified lambda-name mv.visitMethodInsn(Opcodes.INVOKEINTERFACE, "java/util/stream/Stream", "filter", "(Ljava/util/function/Predicate;)Ljava/util/stream/Stream;", true); mv.visitVarInsn(Opcodes.ALOAD, 1); mv.visitVarInsn(Opcodes.ALOAD, 4); mv.visitInvokeDynamicInsn("accept", "(Ljava/io/File;Ljava/util/concurrent/atomic/AtomicReference;)Ljava/util/function/Consumer;", new Handle(Opcodes.H_INVOKESTATIC, "java/lang/invoke/LambdaMetafactory", "metafactory", "(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;"), new Object[] { Type.getType("(Ljava/lang/Object;)V"), new Handle( Opcodes.H_INVOKESTATIC, "com/oracle/tools/packager/windows/WinAppBundler", "lambda$copyMSVCDLLs$263", "(Ljava/io/File;Ljava/util/concurrent/atomic/AtomicReference;Ljava/nio/file/Path;)V"), Type.getType("(Ljava/nio/file/Path;)V") }); // modified lambda-name mv.visitMethodInsn(Opcodes.INVOKEINTERFACE, "java/util/stream/Stream", "forEach", "(Ljava/util/function/Consumer;)V", true); mv.visitLabel(l4); mv.visitVarInsn(Opcodes.ALOAD, 6); Label l17 = new Label(); mv.visitJumpInsn(Opcodes.IFNULL, l17); mv.visitVarInsn(Opcodes.ALOAD, 7); Label l18 = new Label(); mv.visitJumpInsn(Opcodes.IFNULL, l18); mv.visitLabel(l0); mv.visitVarInsn(Opcodes.ALOAD, 6); mv.visitMethodInsn(Opcodes.INVOKEINTERFACE, "java/util/stream/Stream", "close", "()V", true); mv.visitLabel(l1); mv.visitJumpInsn(Opcodes.GOTO, l17); mv.visitLabel(l2); mv.visitFrame(Opcodes.F_FULL, 8, new Object[] { "com/oracle/tools/packager/windows/WinAppBundler", javaioFile, javaioFile, javalangString, "java/util/concurrent/atomic/AtomicReference", javalangString, "java/util/stream/Stream", javalangThrowable }, 1, new Object[] { javalangThrowable }); mv.visitVarInsn(Opcodes.ASTORE, 8); mv.visitVarInsn(Opcodes.ALOAD, 7); mv.visitVarInsn(Opcodes.ALOAD, 8); mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, javalangThrowable, "addSuppressed", "(Ljava/lang/Throwable;)V", false); mv.visitJumpInsn(Opcodes.GOTO, l17); mv.visitLabel(l18); mv.visitFrame(Opcodes.F_SAME, 0, null, 0, null); mv.visitVarInsn(Opcodes.ALOAD, 6); mv.visitMethodInsn(Opcodes.INVOKEINTERFACE, "java/util/stream/Stream", "close", "()V", true); mv.visitJumpInsn(Opcodes.GOTO, l17); mv.visitLabel(l5); mv.visitFrame(Opcodes.F_SAME1, 0, null, 1, new Object[] { javalangThrowable }); mv.visitVarInsn(Opcodes.ASTORE, 8); mv.visitVarInsn(Opcodes.ALOAD, 8); mv.visitVarInsn(Opcodes.ASTORE, 7); mv.visitVarInsn(Opcodes.ALOAD, 8); mv.visitInsn(Opcodes.ATHROW); mv.visitLabel(l6); mv.visitFrame(Opcodes.F_SAME1, 0, null, 1, new Object[] { javalangThrowable }); mv.visitVarInsn(Opcodes.ASTORE, 9); mv.visitLabel(l10); mv.visitVarInsn(Opcodes.ALOAD, 6); Label l19 = new Label(); mv.visitJumpInsn(Opcodes.IFNULL, l19); mv.visitVarInsn(Opcodes.ALOAD, 7); Label l20 = new Label(); mv.visitJumpInsn(Opcodes.IFNULL, l20); mv.visitLabel(l7); mv.visitVarInsn(Opcodes.ALOAD, 6); mv.visitMethodInsn(Opcodes.INVOKEINTERFACE, "java/util/stream/Stream", "close", "()V", true); mv.visitLabel(l8); mv.visitJumpInsn(Opcodes.GOTO, l19); mv.visitLabel(l9); mv.visitFrame(Opcodes.F_FULL, 10, new Object[] { "com/oracle/tools/packager/windows/WinAppBundler", javaioFile, javaioFile, javalangString, "java/util/concurrent/atomic/AtomicReference", javalangString, "java/util/stream/Stream", javalangThrowable, Opcodes.TOP, javalangThrowable }, 1, new Object[] { javalangThrowable }); mv.visitVarInsn(Opcodes.ASTORE, 10); mv.visitVarInsn(Opcodes.ALOAD, 7); mv.visitVarInsn(Opcodes.ALOAD, 10); mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, javalangThrowable, "addSuppressed", "(Ljava/lang/Throwable;)V", false); mv.visitJumpInsn(Opcodes.GOTO, l19); mv.visitLabel(l20); mv.visitFrame(Opcodes.F_SAME, 0, null, 0, null); mv.visitVarInsn(Opcodes.ALOAD, 6); mv.visitMethodInsn(Opcodes.INVOKEINTERFACE, "java/util/stream/Stream", "close", "()V", true); mv.visitLabel(l19); mv.visitFrame(Opcodes.F_SAME, 0, null, 0, null); mv.visitVarInsn(Opcodes.ALOAD, 9); mv.visitInsn(Opcodes.ATHROW); mv.visitLabel(l17); mv.visitFrame(Opcodes.F_FULL, 6, new Object[] { "com/oracle/tools/packager/windows/WinAppBundler", javaioFile, javaioFile, javalangString, "java/util/concurrent/atomic/AtomicReference", javalangString }, 0, new Object[] {}); mv.visitVarInsn(Opcodes.ALOAD, 4); mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "java/util/concurrent/atomic/AtomicReference", "get", "()Ljava/lang/Object;", false); mv.visitTypeInsn(Opcodes.CHECKCAST, "java/io/IOException"); mv.visitVarInsn(Opcodes.ASTORE, 6); mv.visitVarInsn(Opcodes.ALOAD, 6); Label l21 = new Label(); mv.visitJumpInsn(Opcodes.IFNULL, l21); mv.visitVarInsn(Opcodes.ALOAD, 6); mv.visitInsn(Opcodes.ATHROW); mv.visitLabel(l21); mv.visitFrame(Opcodes.F_APPEND, 1, new Object[] { "java/io/IOException" }, 0, null); mv.visitInsn(Opcodes.RETURN); } }; } }, ClassReader.EXPAND_FRAMES); // ClassReader.EXPAND_FRAMES required for Java 8 }
From source file:de.scoopgmbh.copper.instrument.StackInfo.java
License:Apache License
static Type deferLocalDesc(Object object) { if (object instanceof String) return Type.getObjectType((String) object); //TODO: analyze opcode at pos label if (object instanceof Label) return Type.getType(Object.class); int intObject = (Integer) object; if (intObject == Opcodes.TOP) return null; if (intObject == Opcodes.INTEGER) return Type.INT_TYPE; if (intObject == Opcodes.FLOAT) return Type.FLOAT_TYPE; if (intObject == Opcodes.LONG) return Type.LONG_TYPE; if (intObject == Opcodes.DOUBLE) return Type.getType(double.class); if (intObject == Opcodes.LONG) return Type.getType(long.class); if (intObject == Opcodes.NULL) return Type.getType(Object.class); //TODO: defer from containing class if (intObject == Opcodes.UNINITIALIZED_THIS) return Type.getType(Object.class); throw new BuildStackFrameException("Couldnt defer desc for " + object); }
From source file:edu.ubc.mirrors.holograms.FrameAnalyzer.java
License:Open Source License
public Object toFrameObject(FrameValue value) { if (value.isUninitializedThis()) { return Opcodes.UNINITIALIZED_THIS; } else if (value.isUninitialized()) { AbstractInsnNode newInsn = value.getNewInsn(); // TODO: Could also search up to the previous actual instruction... AbstractInsnNode labelNode = newInsn.getPrevious(); if (labelNode == null || !(labelNode instanceof LabelNode)) { labelNode = new LabelNode(); m.instructions.insertBefore(newInsn, labelNode); }/* www.ja va 2 s . co m*/ return ((LabelNode) labelNode).getLabel(); } else { Type type = value.getBasicValue().getType(); if (type == null) { return Opcodes.TOP; } else { switch (type.getSort()) { case Type.VOID: // TODO: Not sure what to do here. Used for BasicValue.RETURNADDRESS_VALUE, // but I can't figure out the correct verifier type for the return addresses // used by JSR/RET. return Opcodes.TOP; case Type.BOOLEAN: case Type.BYTE: case Type.CHAR: case Type.SHORT: case Type.INT: return Opcodes.INTEGER; case Type.LONG: return Opcodes.LONG; case Type.FLOAT: return Opcodes.FLOAT; case Type.DOUBLE: return Opcodes.DOUBLE; case Type.OBJECT: case Type.ARRAY: return type.getInternalName(); case Type.METHOD: // Shouldn't happen default: throw new RuntimeException("Bad sort: " + type.getSort()); } } } }
From source file:io.github.btpka3.asm.H.java
public static byte[] dump() throws Exception { ClassWriter cw = new ClassWriter(0); FieldVisitor fv;/*from w w w .j a va 2 s . c o m*/ MethodVisitor mv; AnnotationVisitor av0; cw.visit(V1_8, ACC_PUBLIC + ACC_SUPER, "JP/co/esm/caddies/jomt/license/h", null, "java/lang/Object", null); { fv = cw.visitField(ACC_PUBLIC + ACC_STATIC, "a", "Ljava/lang/String;", null, null); fv.visitEnd(); } { fv = cw.visitField(ACC_PRIVATE + ACC_STATIC, "b", "Z", null, null); fv.visitEnd(); } { fv = cw.visitField(ACC_PRIVATE + ACC_FINAL + ACC_STATIC, "c", "Lorg/slf4j/Logger;", null, null); fv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V", false); mv.visitInsn(RETURN); mv.visitMaxs(1, 1); mv.visitEnd(); } // public static boolean a() { mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, "a", "()Z", null, null); mv.visitCode(); mv.visitFieldInsn(GETSTATIC, "JP/co/esm/caddies/jomt/license/h", "a", "Ljava/lang/String;"); mv.visitMethodInsn(INVOKESTATIC, "JP/co/esm/caddies/jomt/license/h", "b", "(Ljava/lang/String;)Z", false); Label l0 = new Label(); mv.visitJumpInsn(IFEQ, l0); mv.visitFieldInsn(GETSTATIC, "JP/co/esm/caddies/jomt/license/h", "a", "Ljava/lang/String;"); mv.visitMethodInsn(INVOKESTATIC, "JP/co/esm/caddies/jomt/license/h", "d", "(Ljava/lang/String;)V", false); mv.visitFieldInsn(GETSTATIC, "JP/co/esm/caddies/jomt/jsystem/c", "q", "Z"); Label l1 = new Label(); mv.visitJumpInsn(IFEQ, l1); mv.visitFieldInsn(GETSTATIC, "JP/co/esm/caddies/jomt/license/h", "b", "Z"); Label l2 = new Label(); mv.visitJumpInsn(IFNE, l2); mv.visitLdcInsn("app"); mv.visitLdcInsn("without_any_license"); mv.visitMethodInsn(INVOKESTATIC, "JP/co/esm/caddies/jomt/jview/eO", "d", "(Ljava/lang/String;Ljava/lang/String;)V", false); mv.visitLabel(l2); mv.visitFrame(Opcodes.F_SAME, 0, null, 0, null); mv.visitInsn(ICONST_1); mv.visitFieldInsn(PUTSTATIC, "JP/co/esm/caddies/jomt/license/h", "b", "Z"); mv.visitLabel(l1); mv.visitFrame(Opcodes.F_SAME, 0, null, 0, null); mv.visitFieldInsn(GETSTATIC, "JP/co/esm/caddies/jomt/jsystem/c", "q", "Z"); Label l3 = new Label(); mv.visitJumpInsn(IFNE, l3); mv.visitInsn(ICONST_1); Label l4 = new Label(); mv.visitJumpInsn(GOTO, l4); mv.visitLabel(l3); mv.visitFrame(Opcodes.F_SAME, 0, null, 0, null); mv.visitInsn(ICONST_0); mv.visitLabel(l4); mv.visitFrame(Opcodes.F_SAME1, 0, null, 1, new Object[] { Opcodes.INTEGER }); mv.visitInsn(IRETURN); mv.visitLabel(l0); mv.visitFrame(Opcodes.F_SAME, 0, null, 0, null); mv.visitMethodInsn(INVOKESTATIC, "JP/co/esm/caddies/jomt/license/h", "b", "()Ljava/lang/String;", false); mv.visitVarInsn(ASTORE, 0); mv.visitFieldInsn(GETSTATIC, "JP/co/esm/caddies/jomt/license/h", "a", "Ljava/lang/String;"); mv.visitVarInsn(ALOAD, 0); mv.visitMethodInsn(INVOKESTATIC, "JP/co/esm/caddies/jomt/license/h", "a", "(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;", false); mv.visitInsn(POP); mv.visitInsn(ICONST_1); mv.visitFieldInsn(PUTSTATIC, "JP/co/esm/caddies/jomt/jsystem/c", "p", "Z"); mv.visitInsn(ICONST_1); mv.visitTypeInsn(ANEWARRAY, "java/lang/String"); mv.visitVarInsn(ASTORE, 1); mv.visitVarInsn(ALOAD, 1); mv.visitInsn(ICONST_0); mv.visitVarInsn(ALOAD, 0); mv.visitMethodInsn(INVOKESTATIC, "JP/co/esm/caddies/jomt/license/h", "a", "(Ljava/lang/String;)Ljava/lang/String;", false); mv.visitInsn(AASTORE); mv.visitLdcInsn("app"); mv.visitLdcInsn("license_evaluation_term.message"); mv.visitVarInsn(ALOAD, 1); mv.visitMethodInsn(INVOKESTATIC, "JP/co/esm/caddies/jomt/jview/eO", "e", "(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)V", false); mv.visitMethodInsn(INVOKESTATIC, "JP/co/esm/caddies/jomt/license/p", "c", "()LJP/co/esm/caddies/jomt/license/p;", false); mv.visitMethodInsn(INVOKESTATIC, "JP/co/esm/caddies/jomt/jsystem/j", "d", "()Ljava/lang/String;", false); mv.visitLdcInsn("P"); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "equals", "(Ljava/lang/Object;)Z", false); Label l5 = new Label(); mv.visitJumpInsn(IFEQ, l5); mv.visitLdcInsn("astah_professional"); Label l6 = new Label(); mv.visitJumpInsn(GOTO, l6); mv.visitLabel(l5); mv.visitFrame(Opcodes.F_SAME1, 0, null, 1, new Object[] { "JP/co/esm/caddies/jomt/license/p" }); mv.visitLdcInsn("astah_UML"); mv.visitLabel(l6); mv.visitFrame(Opcodes.F_FULL, 0, new Object[] {}, 2, new Object[] { "JP/co/esm/caddies/jomt/license/p", "java/lang/String" }); mv.visitLdcInsn("USER_TYPE"); mv.visitLdcInsn("Evaluation"); mv.visitMethodInsn(INVOKEVIRTUAL, "JP/co/esm/caddies/jomt/license/p", "a", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V", false); mv.visitInsn(ICONST_1); mv.visitInsn(IRETURN); mv.visitMaxs(4, 2); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PRIVATE + ACC_STATIC, "b", "()Ljava/lang/String;", null, null); mv.visitCode(); mv.visitLdcInsn("yyyy/MM/dd"); mv.visitMethodInsn(INVOKESTATIC, "JP/co/esm/caddies/jomt/jutil/JomtUtilities", "getDateString", "(Ljava/lang/String;)Ljava/lang/String;", false); mv.visitInsn(ARETURN); mv.visitMaxs(1, 0); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PRIVATE + ACC_STATIC, "f", "(Ljava/lang/String;)Ljava/util/GregorianCalendar;", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitInsn(ICONST_0); mv.visitInsn(ICONST_4); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "substring", "(II)Ljava/lang/String;", false); mv.visitMethodInsn(INVOKESTATIC, "java/lang/Integer", "parseInt", "(Ljava/lang/String;)I", false); mv.visitVarInsn(ISTORE, 1); mv.visitVarInsn(ALOAD, 0); mv.visitInsn(ICONST_5); mv.visitIntInsn(BIPUSH, 7); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "substring", "(II)Ljava/lang/String;", false); mv.visitMethodInsn(INVOKESTATIC, "java/lang/Integer", "parseInt", "(Ljava/lang/String;)I", false); mv.visitInsn(ICONST_1); mv.visitInsn(ISUB); mv.visitVarInsn(ISTORE, 2); mv.visitVarInsn(ALOAD, 0); mv.visitIntInsn(BIPUSH, 8); mv.visitIntInsn(BIPUSH, 10); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "substring", "(II)Ljava/lang/String;", false); mv.visitMethodInsn(INVOKESTATIC, "java/lang/Integer", "parseInt", "(Ljava/lang/String;)I", false); mv.visitVarInsn(ISTORE, 3); mv.visitTypeInsn(NEW, "java/util/GregorianCalendar"); mv.visitInsn(DUP); mv.visitVarInsn(ILOAD, 1); mv.visitVarInsn(ILOAD, 2); mv.visitVarInsn(ILOAD, 3); mv.visitMethodInsn(INVOKESPECIAL, "java/util/GregorianCalendar", "<init>", "(III)V", false); mv.visitInsn(ARETURN); mv.visitMaxs(5, 4); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PRIVATE + ACC_STATIC, "c", "()Ljava/util/GregorianCalendar;", null, null); mv.visitCode(); mv.visitMethodInsn(INVOKESTATIC, "JP/co/esm/caddies/jomt/license/h", "b", "()Ljava/lang/String;", false); mv.visitMethodInsn(INVOKESTATIC, "JP/co/esm/caddies/jomt/license/h", "f", "(Ljava/lang/String;)Ljava/util/GregorianCalendar;", false); mv.visitInsn(ARETURN); mv.visitMaxs(1, 0); mv.visitEnd(); } // private static GregorianCalendar g(String var0) { mv = cw.visitMethod(ACC_PRIVATE + ACC_STATIC, "g", "(Ljava/lang/String;)Ljava/util/GregorianCalendar;", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitInsn(ICONST_0); mv.visitInsn(ICONST_4); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "substring", "(II)Ljava/lang/String;", false); mv.visitMethodInsn(INVOKESTATIC, "java/lang/Integer", "parseInt", "(Ljava/lang/String;)I", false); mv.visitVarInsn(ISTORE, 1); mv.visitVarInsn(ALOAD, 0); mv.visitInsn(ICONST_5); mv.visitIntInsn(BIPUSH, 7); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "substring", "(II)Ljava/lang/String;", false); mv.visitMethodInsn(INVOKESTATIC, "java/lang/Integer", "parseInt", "(Ljava/lang/String;)I", false); mv.visitInsn(ICONST_1); mv.visitInsn(ISUB); mv.visitVarInsn(ISTORE, 2); mv.visitVarInsn(ALOAD, 0); mv.visitIntInsn(BIPUSH, 8); mv.visitIntInsn(BIPUSH, 10); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "substring", "(II)Ljava/lang/String;", false); mv.visitMethodInsn(INVOKESTATIC, "java/lang/Integer", "parseInt", "(Ljava/lang/String;)I", false); mv.visitVarInsn(ISTORE, 3); mv.visitMethodInsn(INVOKESTATIC, "JP/co/esm/caddies/jomt/license/h", "c", "()Ljava/util/GregorianCalendar;", false); mv.visitVarInsn(ASTORE, 4); mv.visitVarInsn(ALOAD, 4); mv.visitVarInsn(ILOAD, 1); mv.visitVarInsn(ILOAD, 2); mv.visitVarInsn(ILOAD, 3); mv.visitMethodInsn(INVOKEVIRTUAL, "java/util/GregorianCalendar", "set", "(III)V", false); mv.visitVarInsn(ALOAD, 4); mv.visitInsn(ICONST_5); //mv.visitIntInsn(BIPUSH, 20); mv.visitIntInsn(BIPUSH, 3650); mv.visitMethodInsn(INVOKEVIRTUAL, "java/util/GregorianCalendar", "add", "(II)V", false); mv.visitVarInsn(ALOAD, 4); mv.visitInsn(ARETURN); mv.visitMaxs(4, 5); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, "a", "(Ljava/lang/String;)Ljava/lang/String;", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitMethodInsn(INVOKESTATIC, "JP/co/esm/caddies/jomt/license/h", "g", "(Ljava/lang/String;)Ljava/util/GregorianCalendar;", false); mv.visitVarInsn(ASTORE, 1); mv.visitVarInsn(ALOAD, 1); mv.visitMethodInsn(INVOKEVIRTUAL, "java/util/GregorianCalendar", "getTime", "()Ljava/util/Date;", false); mv.visitVarInsn(ASTORE, 2); mv.visitInsn(ICONST_1); mv.visitMethodInsn(INVOKESTATIC, "java/text/DateFormat", "getDateInstance", "(I)Ljava/text/DateFormat;", false); mv.visitVarInsn(ASTORE, 3); mv.visitVarInsn(ALOAD, 3); mv.visitVarInsn(ALOAD, 2); mv.visitMethodInsn(INVOKEVIRTUAL, "java/text/DateFormat", "format", "(Ljava/util/Date;)Ljava/lang/String;", false); mv.visitInsn(ARETURN); mv.visitMaxs(2, 4); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, "b", "(Ljava/lang/String;)Z", null, null); mv.visitCode(); mv.visitTypeInsn(NEW, "java/io/File"); mv.visitInsn(DUP); mv.visitVarInsn(ALOAD, 0); mv.visitMethodInsn(INVOKESPECIAL, "java/io/File", "<init>", "(Ljava/lang/String;)V", false); mv.visitVarInsn(ASTORE, 1); mv.visitVarInsn(ALOAD, 1); mv.visitMethodInsn(INVOKEVIRTUAL, "java/io/File", "exists", "()Z", false); Label l0 = new Label(); mv.visitJumpInsn(IFEQ, l0); mv.visitInsn(ICONST_1); mv.visitInsn(IRETURN); mv.visitLabel(l0); mv.visitFrame(Opcodes.F_CHOP, 1, null, 0, null); mv.visitInsn(ICONST_0); mv.visitInsn(IRETURN); mv.visitMaxs(3, 2); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, "c", "(Ljava/lang/String;)Ljava/lang/String;", null, null); mv.visitCode(); Label l0 = new Label(); Label l1 = new Label(); Label l2 = new Label(); mv.visitTryCatchBlock(l0, l1, l2, "java/lang/Exception"); mv.visitLdcInsn(""); mv.visitVarInsn(ASTORE, 1); mv.visitInsn(ACONST_NULL); mv.visitVarInsn(ASTORE, 2); mv.visitLabel(l0); mv.visitTypeInsn(NEW, "java/util/zip/GZIPInputStream"); mv.visitInsn(DUP); mv.visitTypeInsn(NEW, "java/io/FileInputStream"); mv.visitInsn(DUP); mv.visitVarInsn(ALOAD, 0); mv.visitMethodInsn(INVOKESPECIAL, "java/io/FileInputStream", "<init>", "(Ljava/lang/String;)V", false); mv.visitMethodInsn(INVOKESPECIAL, "java/util/zip/GZIPInputStream", "<init>", "(Ljava/io/InputStream;)V", false); mv.visitVarInsn(ASTORE, 2); mv.visitTypeInsn(NEW, "java/io/InputStreamReader"); mv.visitInsn(DUP); mv.visitVarInsn(ALOAD, 2); mv.visitLdcInsn("UTF-8"); mv.visitMethodInsn(INVOKESPECIAL, "java/io/InputStreamReader", "<init>", "(Ljava/io/InputStream;Ljava/lang/String;)V", false); mv.visitVarInsn(ASTORE, 3); mv.visitTypeInsn(NEW, "java/io/BufferedReader"); mv.visitInsn(DUP); mv.visitVarInsn(ALOAD, 3); mv.visitMethodInsn(INVOKESPECIAL, "java/io/BufferedReader", "<init>", "(Ljava/io/Reader;)V", false); mv.visitVarInsn(ASTORE, 4); Label l3 = new Label(); mv.visitLabel(l3); mv.visitFrame(Opcodes.F_FULL, 5, new Object[] { Opcodes.TOP, "java/lang/String", Opcodes.TOP, Opcodes.TOP, "java/io/BufferedReader" }, 0, new Object[] {}); mv.visitVarInsn(ALOAD, 4); mv.visitMethodInsn(INVOKEVIRTUAL, "java/io/BufferedReader", "readLine", "()Ljava/lang/String;", false); mv.visitInsn(DUP); mv.visitVarInsn(ASTORE, 5); Label l4 = new Label(); mv.visitJumpInsn(IFNULL, l4); mv.visitVarInsn(ALOAD, 5); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "length", "()I", false); mv.visitJumpInsn(IFLE, l3); mv.visitVarInsn(ALOAD, 5); mv.visitVarInsn(ASTORE, 1); mv.visitJumpInsn(GOTO, l3); mv.visitLabel(l4); mv.visitFrame(Opcodes.F_SAME, 0, null, 0, null); mv.visitVarInsn(ALOAD, 4); mv.visitMethodInsn(INVOKEVIRTUAL, "java/io/BufferedReader", "close", "()V", false); mv.visitLabel(l1); Label l5 = new Label(); mv.visitJumpInsn(GOTO, l5); mv.visitLabel(l2); mv.visitFrame(Opcodes.F_FULL, 0, new Object[] {}, 1, new Object[] { "java/lang/Exception" }); mv.visitVarInsn(ASTORE, 3); mv.visitFieldInsn(GETSTATIC, "JP/co/esm/caddies/jomt/license/h", "c", "Lorg/slf4j/Logger;"); mv.visitLdcInsn("error has occurred."); mv.visitVarInsn(ALOAD, 3); mv.visitMethodInsn(INVOKEINTERFACE, "org/slf4j/Logger", "error", "(Ljava/lang/String;Ljava/lang/Throwable;)V", true); mv.visitInsn(ACONST_NULL); mv.visitInsn(ARETURN); mv.visitLabel(l5); mv.visitFrame(Opcodes.F_APPEND, 2, new Object[] { Opcodes.TOP, "java/lang/String" }, 0, null); mv.visitVarInsn(ALOAD, 1); mv.visitInsn(ARETURN); mv.visitMaxs(5, 6); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, "a", "(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;", null, null); mv.visitCode(); Label l0 = new Label(); Label l1 = new Label(); Label l2 = new Label(); mv.visitTryCatchBlock(l0, l1, l2, "java/io/IOException"); Label l3 = new Label(); Label l4 = new Label(); Label l5 = new Label(); mv.visitTryCatchBlock(l3, l4, l5, "java/lang/Throwable"); Label l6 = new Label(); Label l7 = new Label(); Label l8 = new Label(); mv.visitTryCatchBlock(l6, l7, l8, "java/io/IOException"); Label l9 = new Label(); mv.visitTryCatchBlock(l3, l4, l9, null); Label l10 = new Label(); mv.visitTryCatchBlock(l5, l10, l9, null); Label l11 = new Label(); Label l12 = new Label(); Label l13 = new Label(); mv.visitTryCatchBlock(l11, l12, l13, "java/io/IOException"); Label l14 = new Label(); mv.visitTryCatchBlock(l9, l14, l9, null); mv.visitInsn(ACONST_NULL); mv.visitVarInsn(ASTORE, 2); mv.visitLabel(l3); mv.visitTypeInsn(NEW, "java/io/BufferedWriter"); mv.visitInsn(DUP); mv.visitTypeInsn(NEW, "java/io/OutputStreamWriter"); mv.visitInsn(DUP); mv.visitTypeInsn(NEW, "java/util/zip/GZIPOutputStream"); mv.visitInsn(DUP); mv.visitTypeInsn(NEW, "java/io/FileOutputStream"); mv.visitInsn(DUP); mv.visitVarInsn(ALOAD, 0); mv.visitMethodInsn(INVOKESPECIAL, "java/io/FileOutputStream", "<init>", "(Ljava/lang/String;)V", false); mv.visitMethodInsn(INVOKESPECIAL, "java/util/zip/GZIPOutputStream", "<init>", "(Ljava/io/OutputStream;)V", false); mv.visitLdcInsn("UTF-8"); mv.visitMethodInsn(INVOKESPECIAL, "java/io/OutputStreamWriter", "<init>", "(Ljava/io/OutputStream;Ljava/lang/String;)V", false); mv.visitMethodInsn(INVOKESPECIAL, "java/io/BufferedWriter", "<init>", "(Ljava/io/Writer;)V", false); mv.visitVarInsn(ASTORE, 2); mv.visitVarInsn(ALOAD, 2); mv.visitVarInsn(ALOAD, 1); mv.visitMethodInsn(INVOKEVIRTUAL, "java/io/BufferedWriter", "write", "(Ljava/lang/String;)V", false); mv.visitLabel(l4); mv.visitVarInsn(ALOAD, 2); Label l15 = new Label(); mv.visitJumpInsn(IFNULL, l15); mv.visitLabel(l0); mv.visitVarInsn(ALOAD, 2); mv.visitMethodInsn(INVOKEVIRTUAL, "java/io/BufferedWriter", "close", "()V", false); mv.visitLabel(l1); mv.visitJumpInsn(GOTO, l15); mv.visitLabel(l2); mv.visitFrame(Opcodes.F_FULL, 0, new Object[] {}, 1, new Object[] { "java/io/IOException" }); mv.visitVarInsn(ASTORE, 3); mv.visitVarInsn(ALOAD, 3); mv.visitMethodInsn(INVOKEVIRTUAL, "java/io/IOException", "getMessage", "()Ljava/lang/String;", false); mv.visitInsn(ARETURN); mv.visitLabel(l5); mv.visitFrame(Opcodes.F_FULL, 3, new Object[] { Opcodes.TOP, Opcodes.TOP, "java/io/BufferedWriter" }, 1, new Object[] { "java/lang/Throwable" }); mv.visitVarInsn(ASTORE, 3); mv.visitVarInsn(ALOAD, 3); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Throwable", "getMessage", "()Ljava/lang/String;", false); mv.visitVarInsn(ASTORE, 4); mv.visitLabel(l10); mv.visitVarInsn(ALOAD, 2); Label l16 = new Label(); mv.visitJumpInsn(IFNULL, l16); mv.visitLabel(l6); mv.visitVarInsn(ALOAD, 2); mv.visitMethodInsn(INVOKEVIRTUAL, "java/io/BufferedWriter", "close", "()V", false); mv.visitLabel(l7); mv.visitJumpInsn(GOTO, l16); mv.visitLabel(l8); mv.visitFrame(Opcodes.F_FULL, 0, new Object[] {}, 1, new Object[] { "java/io/IOException" }); mv.visitVarInsn(ASTORE, 5); mv.visitVarInsn(ALOAD, 5); mv.visitMethodInsn(INVOKEVIRTUAL, "java/io/IOException", "getMessage", "()Ljava/lang/String;", false); mv.visitInsn(ARETURN); mv.visitLabel(l16); mv.visitFrame(Opcodes.F_FULL, 5, new Object[] { Opcodes.TOP, Opcodes.TOP, Opcodes.TOP, Opcodes.TOP, "java/lang/String" }, 0, new Object[] {}); mv.visitVarInsn(ALOAD, 4); mv.visitInsn(ARETURN); mv.visitLabel(l9); mv.visitFrame(Opcodes.F_FULL, 3, new Object[] { Opcodes.TOP, Opcodes.TOP, "java/io/BufferedWriter" }, 1, new Object[] { "java/lang/Throwable" }); mv.visitVarInsn(ASTORE, 6); mv.visitLabel(l14); mv.visitVarInsn(ALOAD, 2); Label l17 = new Label(); mv.visitJumpInsn(IFNULL, l17); mv.visitLabel(l11); mv.visitVarInsn(ALOAD, 2); mv.visitMethodInsn(INVOKEVIRTUAL, "java/io/BufferedWriter", "close", "()V", false); mv.visitLabel(l12); mv.visitJumpInsn(GOTO, l17); mv.visitLabel(l13); mv.visitFrame(Opcodes.F_FULL, 0, new Object[] {}, 1, new Object[] { "java/io/IOException" }); mv.visitVarInsn(ASTORE, 7); mv.visitVarInsn(ALOAD, 7); mv.visitMethodInsn(INVOKEVIRTUAL, "java/io/IOException", "getMessage", "()Ljava/lang/String;", false); mv.visitInsn(ARETURN); mv.visitLabel(l17); mv.visitFrame(Opcodes.F_FULL, 7, new Object[] { Opcodes.TOP, Opcodes.TOP, Opcodes.TOP, Opcodes.TOP, Opcodes.TOP, Opcodes.TOP, "java/lang/Throwable" }, 0, new Object[] {}); mv.visitVarInsn(ALOAD, 6); mv.visitInsn(ATHROW); mv.visitLabel(l15); mv.visitFrame(Opcodes.F_FULL, 0, new Object[] {}, 0, new Object[] {}); mv.visitLdcInsn(""); mv.visitInsn(ARETURN); mv.visitMaxs(9, 8); mv.visitEnd(); } // public static void d(String var0) { mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, "d", "(Ljava/lang/String;)V", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitMethodInsn(INVOKESTATIC, "JP/co/esm/caddies/jomt/license/h", "c", "(Ljava/lang/String;)Ljava/lang/String;", false); mv.visitVarInsn(ASTORE, 1); mv.visitVarInsn(ALOAD, 1); mv.visitMethodInsn(INVOKESTATIC, "JP/co/esm/caddies/jomt/license/h", "e", "(Ljava/lang/String;)Z", false); mv.visitVarInsn(ISTORE, 2); mv.visitVarInsn(ILOAD, 2); Label l0 = new Label(); mv.visitJumpInsn(IFEQ, l0); mv.visitInsn(ICONST_1); mv.visitFieldInsn(PUTSTATIC, "JP/co/esm/caddies/jomt/jsystem/c", "p", "Z"); mv.visitMethodInsn(INVOKESTATIC, "JP/co/esm/caddies/jomt/license/p", "c", "()LJP/co/esm/caddies/jomt/license/p;", false); mv.visitMethodInsn(INVOKESTATIC, "JP/co/esm/caddies/jomt/jsystem/j", "d", "()Ljava/lang/String;", false); mv.visitLdcInsn("P"); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "equals", "(Ljava/lang/Object;)Z", false); Label l1 = new Label(); mv.visitJumpInsn(IFEQ, l1); mv.visitLdcInsn("astah_professional"); Label l2 = new Label(); mv.visitJumpInsn(GOTO, l2); mv.visitLabel(l1); mv.visitFrame(Opcodes.F_FULL, 2, new Object[] { Opcodes.TOP, "java/lang/String" }, 1, new Object[] { "JP/co/esm/caddies/jomt/license/p" }); mv.visitLdcInsn("astah_UML"); mv.visitLabel(l2); mv.visitFrame(Opcodes.F_FULL, 2, new Object[] { Opcodes.TOP, "java/lang/String" }, 2, new Object[] { "JP/co/esm/caddies/jomt/license/p", "java/lang/String" }); mv.visitLdcInsn("USER_TYPE"); mv.visitLdcInsn("Evaluation"); mv.visitMethodInsn(INVOKEVIRTUAL, "JP/co/esm/caddies/jomt/license/p", "a", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V", false); mv.visitInsn(ICONST_1); mv.visitTypeInsn(ANEWARRAY, "java/lang/String"); mv.visitVarInsn(ASTORE, 3); mv.visitVarInsn(ALOAD, 3); mv.visitInsn(ICONST_0); mv.visitVarInsn(ALOAD, 1); mv.visitMethodInsn(INVOKESTATIC, "JP/co/esm/caddies/jomt/license/h", "a", "(Ljava/lang/String;)Ljava/lang/String;", false); mv.visitInsn(AASTORE); mv.visitLdcInsn("app"); mv.visitLdcInsn("license_evaluation_term.message"); mv.visitVarInsn(ALOAD, 3); mv.visitMethodInsn(INVOKESTATIC, "JP/co/esm/caddies/jomt/jview/eO", "e", "(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)V", false); Label l3 = new Label(); mv.visitJumpInsn(GOTO, l3); mv.visitLabel(l0); mv.visitFrame(Opcodes.F_CHOP, 2, null, 0, null); mv.visitInsn(ICONST_1); mv.visitFieldInsn(PUTSTATIC, "JP/co/esm/caddies/jomt/jsystem/c", "q", "Z"); mv.visitLabel(l3); mv.visitFrame(Opcodes.F_SAME, 0, null, 0, null); mv.visitInsn(RETURN); mv.visitMaxs(4, 4); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, "e", "(Ljava/lang/String;)Z", null, null); mv.visitCode(); mv.visitMethodInsn(INVOKESTATIC, "JP/co/esm/caddies/jomt/license/h", "c", "()Ljava/util/GregorianCalendar;", false); mv.visitVarInsn(ASTORE, 1); mv.visitVarInsn(ALOAD, 0); mv.visitMethodInsn(INVOKESTATIC, "JP/co/esm/caddies/jomt/license/h", "f", "(Ljava/lang/String;)Ljava/util/GregorianCalendar;", false); mv.visitVarInsn(ASTORE, 2); mv.visitVarInsn(ALOAD, 0); mv.visitMethodInsn(INVOKESTATIC, "JP/co/esm/caddies/jomt/license/h", "g", "(Ljava/lang/String;)Ljava/util/GregorianCalendar;", false); mv.visitVarInsn(ASTORE, 3); mv.visitVarInsn(ALOAD, 2); mv.visitVarInsn(ALOAD, 1); mv.visitMethodInsn(INVOKEVIRTUAL, "java/util/GregorianCalendar", "equals", "(Ljava/lang/Object;)Z", false); Label l0 = new Label(); mv.visitJumpInsn(IFEQ, l0); mv.visitInsn(ICONST_1); mv.visitInsn(IRETURN); mv.visitLabel(l0); mv.visitFrame(Opcodes.F_FULL, 4, new Object[] { Opcodes.TOP, "java/util/GregorianCalendar", "java/util/GregorianCalendar", "java/util/GregorianCalendar" }, 0, new Object[] {}); mv.visitVarInsn(ALOAD, 3); mv.visitVarInsn(ALOAD, 1); mv.visitMethodInsn(INVOKEVIRTUAL, "java/util/GregorianCalendar", "equals", "(Ljava/lang/Object;)Z", false); Label l1 = new Label(); mv.visitJumpInsn(IFEQ, l1); mv.visitInsn(ICONST_1); mv.visitInsn(IRETURN); mv.visitLabel(l1); mv.visitFrame(Opcodes.F_SAME, 0, null, 0, null); mv.visitVarInsn(ALOAD, 2); mv.visitVarInsn(ALOAD, 1); mv.visitMethodInsn(INVOKEVIRTUAL, "java/util/GregorianCalendar", "before", "(Ljava/lang/Object;)Z", false); Label l2 = new Label(); mv.visitJumpInsn(IFEQ, l2); mv.visitVarInsn(ALOAD, 1); mv.visitVarInsn(ALOAD, 3); mv.visitMethodInsn(INVOKEVIRTUAL, "java/util/GregorianCalendar", "before", "(Ljava/lang/Object;)Z", false); mv.visitJumpInsn(IFEQ, l2); mv.visitInsn(ICONST_1); mv.visitInsn(IRETURN); mv.visitLabel(l2); mv.visitFrame(Opcodes.F_FULL, 0, new Object[] {}, 0, new Object[] {}); mv.visitInsn(ICONST_0); mv.visitInsn(IRETURN); mv.visitMaxs(2, 4); mv.visitEnd(); } { mv = cw.visitMethod(ACC_STATIC, "<clinit>", "()V", null, null); mv.visitCode(); mv.visitTypeInsn(NEW, "java/lang/StringBuilder"); mv.visitInsn(DUP); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/StringBuilder", "<init>", "()V", false); mv.visitMethodInsn(INVOKESTATIC, "JP/co/esm/caddies/jomt/jsystem/j", "s", "()Ljava/lang/String;", false); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/StringBuilder", "append", "(Ljava/lang/String;)Ljava/lang/StringBuilder;", false); mv.visitFieldInsn(GETSTATIC, "java/io/File", "separator", "Ljava/lang/String;"); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/StringBuilder", "append", "(Ljava/lang/String;)Ljava/lang/StringBuilder;", false); mv.visitLdcInsn(".ael"); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/StringBuilder", "append", "(Ljava/lang/String;)Ljava/lang/StringBuilder;", false); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/StringBuilder", "toString", "()Ljava/lang/String;", false); mv.visitFieldInsn(PUTSTATIC, "JP/co/esm/caddies/jomt/license/h", "a", "Ljava/lang/String;"); mv.visitInsn(ICONST_0); mv.visitFieldInsn(PUTSTATIC, "JP/co/esm/caddies/jomt/license/h", "b", "Z"); mv.visitLdcInsn(Type.getType("LJP/co/esm/caddies/jomt/license/h;")); mv.visitMethodInsn(INVOKESTATIC, "org/slf4j/LoggerFactory", "getLogger", "(Ljava/lang/Class;)Lorg/slf4j/Logger;", false); mv.visitFieldInsn(PUTSTATIC, "JP/co/esm/caddies/jomt/license/h", "c", "Lorg/slf4j/Logger;"); mv.visitInsn(RETURN); mv.visitMaxs(2, 0); mv.visitEnd(); } cw.visitEnd(); return cw.toByteArray(); }
From source file:jaspex.speculation.newspec.FlowFrame.java
License:Open Source License
/** Converte lista de tipos no formato do visitFrame em BasicValues **/ private UtilList<BasicValue> convertFromFrame(List<Object> values, boolean locals) { UtilList<BasicValue> outList = new UtilArrayList<BasicValue>(); for (Object o : values) { if (o instanceof Integer) { Integer i = (Integer) o; if (i.equals(Opcodes.TOP)) { outList.add(BasicValue.UNINITIALIZED_VALUE); } else if (i.equals(Opcodes.INTEGER)) { outList.add(BasicValue.INT_VALUE); } else if (i.equals(Opcodes.FLOAT)) { outList.add(BasicValue.FLOAT_VALUE); } else if (i.equals(Opcodes.LONG)) { outList.add(BasicValue.LONG_VALUE); if (locals) outList.add(BasicValue.UNINITIALIZED_VALUE); } else if (i.equals(Opcodes.DOUBLE)) { outList.add(BasicValue.DOUBLE_VALUE); if (locals) outList.add(BasicValue.UNINITIALIZED_VALUE); } else if (i.equals(Opcodes.NULL)) { outList.add(BasicValue.REFERENCE_VALUE); } else if (i.equals(Opcodes.UNINITIALIZED_THIS)) { throw new AssertionError("FIXME"); } else { throw new AssertionError(); }/*w w w .j av a2s .c o m*/ } else if (o instanceof String) { String s = (String) o; outList.add(_interpreter.newValue(Type.getObjectType(s))); } else if (o instanceof Label) { throw new AssertionError("FIXME"); } else { throw new AssertionError("FIXME"); } } return outList; }
From source file:org.copperengine.core.instrument.StackInfo.java
License:Apache License
static Type deferLocalDesc(Object object) { if (object instanceof String) return Type.getObjectType((String) object); // TODO: analyze opcode at pos label if (object instanceof Label) return Type.getType(Object.class); int intObject = (Integer) object; if (intObject == Opcodes.TOP) return null; if (intObject == Opcodes.INTEGER) return Type.INT_TYPE; if (intObject == Opcodes.FLOAT) return Type.FLOAT_TYPE; if (intObject == Opcodes.LONG) return Type.LONG_TYPE; if (intObject == Opcodes.DOUBLE) return Type.getType(double.class); if (intObject == Opcodes.LONG) return Type.getType(long.class); if (intObject == Opcodes.NULL) return Type.getType(Object.class); // TODO: defer from containing class if (intObject == Opcodes.UNINITIALIZED_THIS) return Type.getType(Object.class); throw new BuildStackFrameException("Couldnt defer desc for " + object); }