jdk.internal.org.objectweb.asm.Label Java Examples
The following examples show how to use
jdk.internal.org.objectweb.asm.Label.
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: CTVMUtilities.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
public ClassVisitorForLabels(ClassWriter cw, Map<Label, Integer> lines, Executable target) { super(Opcodes.ASM5, cw); this.lineNumbers = lines; StringBuilder builder = new StringBuilder("("); for (Parameter parameter : target.getParameters()) { builder.append(Utils.toJVMTypeSignature(parameter.getType())); } builder.append(")"); if (target instanceof Constructor) { targetName = "<init>"; builder.append("V"); } else { targetName = target.getName(); builder.append(Utils.toJVMTypeSignature( ((Method) target).getReturnType())); } targetDesc = builder.toString(); }
Example #2
Source File: CheckMethodAdapter.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
@Override public void visitMaxs(final int maxStack, final int maxLocals) { checkStartCode(); checkEndCode(); endCode = true; for (Label l : usedLabels) { if (labels.get(l) == null) { throw new IllegalStateException("Undefined label used"); } } for (int i = 0; i < handlers.size();) { Integer start = labels.get(handlers.get(i++)); Integer end = labels.get(handlers.get(i++)); if (start == null || end == null) { throw new IllegalStateException( "Undefined try catch block labels"); } if (end.intValue() <= start.intValue()) { throw new IllegalStateException( "Emty try catch block handler range"); } } checkUnsignedShort(maxStack, "Invalid max stack"); checkUnsignedShort(maxLocals, "Invalid max locals"); super.visitMaxs(maxStack, maxLocals); }
Example #3
Source File: CheckMethodAdapter.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * Checks a stack frame value. * * @param value * the value to be checked. */ void checkFrameValue(final Object value) { if (value == Opcodes.TOP || value == Opcodes.INTEGER || value == Opcodes.FLOAT || value == Opcodes.LONG || value == Opcodes.DOUBLE || value == Opcodes.NULL || value == Opcodes.UNINITIALIZED_THIS) { return; } if (value instanceof String) { checkInternalName((String) value, "Invalid stack frame value"); return; } if (!(value instanceof Label)) { throw new IllegalArgumentException("Invalid stack frame value: " + value); } else { usedLabels.add((Label) value); } }
Example #4
Source File: CheckMethodAdapter.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * Returns the field of the Label class whose name is given. * * @param name * a field name. * @return the field of the Label class whose name is given, or null. */ private static Field getLabelField(final String name) { try { Field f = Label.class.getDeclaredField(name); f.setAccessible(true); return f; } catch (NoSuchFieldException e) { return null; } }
Example #5
Source File: Textifier.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Override public void visitTableSwitchInsn(final int min, final int max, final Label dflt, final Label... labels) { buf.setLength(0); buf.append(tab2).append("TABLESWITCH\n"); for (int i = 0; i < labels.length; ++i) { buf.append(tab3).append(min + i).append(": "); appendLabel(labels[i]); buf.append('\n'); } buf.append(tab3).append("default: "); appendLabel(dflt); buf.append('\n'); text.add(buf.toString()); }
Example #6
Source File: LookupSwitchInsnNode.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
@Override public void accept(final MethodVisitor mv) { int[] keys = new int[this.keys.size()]; for (int i = 0; i < keys.length; ++i) { keys[i] = this.keys.get(i).intValue(); } Label[] labels = new Label[this.labels.size()]; for (int i = 0; i < labels.length; ++i) { labels[i] = this.labels.get(i).getLabel(); } mv.visitLookupSwitchInsn(dflt.getLabel(), keys, labels); acceptAnnotations(mv); }
Example #7
Source File: ASMifier.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
@Override public void visitLabel(final Label label) { buf.setLength(0); declareLabel(label); buf.append(name).append(".visitLabel("); appendLabel(label); buf.append(");\n"); text.add(buf.toString()); }
Example #8
Source File: ASMifier.java From hottub with GNU General Public License v2.0 | 5 votes |
@Override public void visitLabel(final Label label) { buf.setLength(0); declareLabel(label); buf.append(name).append(".visitLabel("); appendLabel(label); buf.append(");\n"); text.add(buf.toString()); }
Example #9
Source File: LocalVariablesSorter.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
@Override public void visitLocalVariable(final String name, final String desc, final String signature, final Label start, final Label end, final int index) { int newIndex = remap(index, Type.getType(desc)); mv.visitLocalVariable(name, desc, signature, start, end, newIndex); }
Example #10
Source File: TableSwitchInsnNode.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
@Override public void accept(final MethodVisitor mv) { Label[] labels = new Label[this.labels.size()]; for (int i = 0; i < labels.length; ++i) { labels[i] = this.labels.get(i).getLabel(); } mv.visitTableSwitchInsn(min, max, dflt.getLabel(), labels); acceptAnnotations(mv); }
Example #11
Source File: LookupSwitchInsnNode.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
@Override public void accept(final MethodVisitor mv) { int[] keys = new int[this.keys.size()]; for (int i = 0; i < keys.length; ++i) { keys[i] = this.keys.get(i).intValue(); } Label[] labels = new Label[this.labels.size()]; for (int i = 0; i < labels.length; ++i) { labels[i] = this.labels.get(i).getLabel(); } mv.visitLookupSwitchInsn(dflt.getLabel(), keys, labels); acceptAnnotations(mv); }
Example #12
Source File: TraceMethodVisitor.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
@Override public void visitLocalVariable(final String name, final String desc, final String signature, final Label start, final Label end, final int index) { p.visitLocalVariable(name, desc, signature, start, end, index); super.visitLocalVariable(name, desc, signature, start, end, index); }
Example #13
Source File: CheckMethodAdapter.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
@Override public void visitLineNumber(final int line, final Label start) { checkStartCode(); checkEndCode(); checkUnsignedShort(line, "Invalid line number"); checkLabel(start, true, "start label"); super.visitLineNumber(line, start); }
Example #14
Source File: Textifier.java From nashorn with GNU General Public License v2.0 | 5 votes |
@Override public void visitLineNumber(final int line, final Label start) { buf.setLength(0); buf.append(tab2).append("LINENUMBER ").append(line).append(' '); appendLabel(start); buf.append('\n'); text.add(buf.toString()); }
Example #15
Source File: ASMifier.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
/** * Appends a declaration of the given label to {@link #buf buf}. This * declaration is of the form "Label lXXX = new Label();". Does nothing if * the given label has already been declared. * * @param l * a label. */ protected void declareLabel(final Label l) { if (labelNames == null) { labelNames = new HashMap<Label, String>(); } String name = labelNames.get(l); if (name == null) { name = "l" + labelNames.size(); labelNames.put(l, name); buf.append("Label ").append(name).append(" = new Label();\n"); } }
Example #16
Source File: AnalyzerAdapter.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
@Override public void visitJumpInsn(final int opcode, final Label label) { if (mv != null) { mv.visitJumpInsn(opcode, label); } execute(opcode, 0, null); if (opcode == Opcodes.GOTO) { this.locals = null; this.stack = null; } }
Example #17
Source File: TraceMethodVisitor.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
@Override public AnnotationVisitor visitLocalVariableAnnotation(int typeRef, TypePath typePath, Label[] start, Label[] end, int[] index, String desc, boolean visible) { Printer p = this.p.visitLocalVariableAnnotation(typeRef, typePath, start, end, index, desc, visible); AnnotationVisitor av = mv == null ? null : mv .visitLocalVariableAnnotation(typeRef, typePath, start, end, index, desc, visible); return new TraceAnnotationVisitor(av, p); }
Example #18
Source File: CodeSizeEvaluator.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
@Override public void visitJumpInsn(final int opcode, final Label label) { minSize += 3; if (opcode == GOTO || opcode == JSR) { maxSize += 5; } else { maxSize += 8; } if (mv != null) { mv.visitJumpInsn(opcode, label); } }
Example #19
Source File: TableSwitchInsnNode.java From Bytecoder with Apache License 2.0 | 5 votes |
@Override public void accept(final MethodVisitor methodVisitor) { Label[] labelsArray = new Label[this.labels.size()]; for (int i = 0, n = labelsArray.length; i < n; ++i) { labelsArray[i] = this.labels.get(i).getLabel(); } methodVisitor.visitTableSwitchInsn(min, max, dflt.getLabel(), labelsArray); acceptAnnotations(methodVisitor); }
Example #20
Source File: LocalVariableAnnotationNode.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Makes the given visitor visit this type annotation. * * @param mv * the visitor that must visit this annotation. * @param visible * <tt>true</tt> if the annotation is visible at runtime. */ public void accept(final MethodVisitor mv, boolean visible) { Label[] start = new Label[this.start.size()]; Label[] end = new Label[this.end.size()]; int[] index = new int[this.index.size()]; for (int i = 0; i < start.length; ++i) { start[i] = this.start.get(i).getLabel(); end[i] = this.end.get(i).getLabel(); index[i] = this.index.get(i); } accept(mv.visitLocalVariableAnnotation(typeRef, typePath, start, end, index, desc, true)); }
Example #21
Source File: AdviceAdapter.java From hottub with GNU General Public License v2.0 | 5 votes |
@Override public void visitTableSwitchInsn(final int min, final int max, final Label dflt, final Label... labels) { mv.visitTableSwitchInsn(min, max, dflt, labels); if (constructor) { popValue(); addBranches(dflt, labels); } }
Example #22
Source File: Textifier.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * Appends the name of the given label to {@link #buf buf}. Creates a new * label name if the given label does not yet have one. * * @param l * a label. */ protected void appendLabel(final Label l) { if (labelNames == null) { labelNames = new HashMap<Label, String>(); } String name = labelNames.get(l); if (name == null) { name = "L" + labelNames.size(); labelNames.put(l, name); } buf.append(name); }
Example #23
Source File: AdviceAdapter.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
@Override public void visitLookupSwitchInsn(final Label dflt, final int[] keys, final Label[] labels) { mv.visitLookupSwitchInsn(dflt, keys, labels); if (constructor) { popValue(); addBranches(dflt, labels); } }
Example #24
Source File: AdviceAdapter.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
@Override public void visitLabel(final Label label) { mv.visitLabel(label); if (constructor && branches != null) { List<Object> frame = branches.get(label); if (frame != null) { stackFrame = frame; branches.remove(label); } } }
Example #25
Source File: AdviceAdapter.java From Bytecoder with Apache License 2.0 | 5 votes |
@Override public void visitLookupSwitchInsn(final Label dflt, final int[] keys, final Label[] labels) { super.visitLookupSwitchInsn(dflt, keys, labels); if (isConstructor && !superClassConstructorCalled) { popValue(); addForwardJumps(dflt, labels); } }
Example #26
Source File: JIMethodInliningAdapter.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public JIMethodInliningAdapter(LocalVariablesSorter mv, Label end, int acc, String desc, Remapper remapper) { super(acc, desc, mv, remapper); this.lvs = mv; this.end = end; int offset = isStatic(acc) ? 0 : 1; Type[] args = Type.getArgumentTypes(desc); for (int i = args.length - 1; i >= 0; i--) { super.visitVarInsn(args[i].getOpcode(Opcodes.ISTORE), i + offset); } if (offset > 0) { super.visitVarInsn(Opcodes.ASTORE, 0); } }
Example #27
Source File: ASMifier.java From nashorn with GNU General Public License v2.0 | 5 votes |
@Override public void visitLabel(final Label label) { buf.setLength(0); declareLabel(label); buf.append(name).append(".visitLabel("); appendLabel(label); buf.append(");\n"); text.add(buf.toString()); }
Example #28
Source File: AdviceAdapter.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
@Override public void visitTryCatchBlock(Label start, Label end, Label handler, String type) { super.visitTryCatchBlock(start, end, handler, type); if (constructor && !branches.containsKey(handler)) { List<Object> stackFrame = new ArrayList<Object>(); stackFrame.add(OTHER); branches.put(handler, stackFrame); } }
Example #29
Source File: LookupSwitchInsnNode.java From nashorn with GNU General Public License v2.0 | 5 votes |
@Override public void accept(final MethodVisitor mv) { int[] keys = new int[this.keys.size()]; for (int i = 0; i < keys.length; ++i) { keys[i] = this.keys.get(i).intValue(); } Label[] labels = new Label[this.labels.size()]; for (int i = 0; i < labels.length; ++i) { labels[i] = this.labels.get(i).getLabel(); } mv.visitLookupSwitchInsn(dflt.getLabel(), keys, labels); }
Example #30
Source File: CheckMethodAdapter.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
/** * Checks that the given label is not null. This method can also check that * the label has been visited. * * @param label * the label to be checked. * @param checkVisited * <tt>true</tt> to check that the label has been visited. * @param msg * a message to be used in case of error. */ void checkLabel(final Label label, final boolean checkVisited, final String msg) { if (label == null) { throw new IllegalArgumentException("Invalid " + msg + " (must not be null)"); } if (checkVisited && labels.get(label) == null) { throw new IllegalArgumentException("Invalid " + msg + " (must be visited first)"); } }