Examples of LineNumberNode


Examples of org.objectweb.asm.tree.LineNumberNode

    IntInsnNode ni = (IntInsnNode) n;
    return oi.operand == ni.operand;
  }

  private static boolean sameLineNumberNode(AbstractInsnNode o, AbstractInsnNode n) {
    LineNumberNode oi = (LineNumberNode) o;
    if (!(n instanceof LineNumberNode)) {
      return false;
    }
    LineNumberNode ni = (LineNumberNode) n;
    return oi.line == ni.line;
    // TODO check oi.start?
  }
View Full Code Here

Examples of org.objectweb.asm.tree.LineNumberNode

        for (AbstractInsnNode n = instructions.getFirst(); n != null; n = n.getNext()) {
            insnMap.put(n, tempInsnList.size());
            if (isRealInsn(n)) tempInsnList.add(n);
            if (n.getType() == AbstractInsnNode.LINE) {
                LineNumberNode nn = (LineNumberNode) n;
                AbstractInsnNode start = nn.start;
                while (start != null && !isRealInsn(start)) start = start.getNext();
                linesMap.put(start, nn.line);
            }
        }
View Full Code Here

Examples of org.objectweb.asm.tree.LineNumberNode

          case 4:
            visitFrame(fnode.type, 0, null, 1, fnode.stack.toArray());
        }
        break;
      case 15:
        LineNumberNode lnode = (LineNumberNode) insn;
        visitLineNumber(lnode.line, lnode.start.getLabel());
        break;
    }
  }
View Full Code Here

Examples of org.objectweb.asm.tree.LineNumberNode

        LabelNode a = new LabelNode(new Label());
        AbstractInsnNode n = m.instructions.getFirst();
        while (n.getOpcode() != INVOKESPECIAL ||
            !((MethodInsnNode)n).name.equals("<init>")) n = n.getNext();
        m.instructions.insert(n, n = a);
        m.instructions.insert(n, n = new LineNumberNode(-15000, a));
        m.instructions.insert(n, n = new VarInsnNode(ALOAD, 0));
        m.instructions.insert(n, n = new TypeInsnNode(NEW, "cofh/lib/util/LinkedHashList"));
        m.instructions.insert(n, n = new InsnNode(DUP));
        m.instructions.insert(n, n = new MethodInsnNode(INVOKESPECIAL, "cofh/lib/util/LinkedHashList", "<init>", "()V", false));
        m.instructions.insert(n, n = new FieldInsnNode(PUTFIELD, "net/minecraft/world/World", "cofh_recentTiles", "Lcofh/lib/util/LinkedHashList;"));
      } else if ("addTileEntity".equals(m.name) && "(Lnet/minecraft/tileentity/TileEntity;)V".equals(remapper.mapMethodDesc(m.desc))) {
        addTileEntity = m;
      } else if (names[4].equals(remapper.mapMethodName(name, m.name, m.desc)) && "(Ljava/util/Collection;)V".equals(m.desc)) {
        addTileEntities = m;
      } else if (names[5].equals(remapper.mapMethodName(name, m.name, m.desc)) && "(IIILnet/minecraft/tileentity/TileEntity;)V".equals(remapper.mapMethodDesc(m.desc))) {
        setTileEntity = m;
      } else if (names[6].equals(remapper.mapMethodName(name, m.name, m.desc)) && "()V".equals(remapper.mapMethodDesc(m.desc))) {
        updateEntities = m;
      }
    }
    cn.fields.add(new FieldNode(ACC_PRIVATE, "cofh_recentTiles", "Lcofh/lib/util/LinkedHashList;", null, null));
    if (addTileEntity != null) {

      LabelNode a = new LabelNode(new Label());
      AbstractInsnNode n;
      addTileEntity.instructions.insert(n = a);
      addTileEntity.instructions.insert(n, n = new LineNumberNode(-15001, a));
      addTileEntity.instructions.insert(n, n = new VarInsnNode(ALOAD, 0));
      addTileEntity.instructions.insert(n, n = new FieldInsnNode(GETFIELD, "net/minecraft/world/World", "cofh_recentTiles", "Lcofh/lib/util/LinkedHashList;"));
      addTileEntity.instructions.insert(n, n = new VarInsnNode(ALOAD, 1));
      addTileEntity.instructions.insert(n, n = new MethodInsnNode(INVOKEVIRTUAL, "cofh/lib/util/LinkedHashList", "push", "(Ljava/lang/Object;)Z", false));
      addTileEntity.instructions.insert(n, n = new InsnNode(POP));
    }
    if (setTileEntity != null) {

      LabelNode a = new LabelNode(new Label());
      AbstractInsnNode n = setTileEntity.instructions.getLast();
      while (n.getOpcode() != RETURN) n = n.getPrevious();
      n = n.getPrevious();
      setTileEntity.instructions.insert(n = a);
      setTileEntity.instructions.insert(n, n = new LineNumberNode(-15002, a));
      setTileEntity.instructions.insert(n, n = new VarInsnNode(ALOAD, 0));
      setTileEntity.instructions.insert(n, n = new FieldInsnNode(GETFIELD, "net/minecraft/world/World", "cofh_recentTiles", "Lcofh/lib/util/LinkedHashList;"));
      setTileEntity.instructions.insert(n, n = new VarInsnNode(ALOAD, 4));
      setTileEntity.instructions.insert(n, n = new MethodInsnNode(INVOKEVIRTUAL, "cofh/lib/util/LinkedHashList", "push", "(Ljava/lang/Object;)Z", false));
      setTileEntity.instructions.insert(n, n = new InsnNode(POP));
    }
    if (addTileEntities != null) {
      LabelNode a = new LabelNode(new Label());
      AbstractInsnNode n = addTileEntities.instructions.getFirst();
      for (;;) {
        while (n.getOpcode() != CHECKCAST) n = n.getNext();
        if (remapper.mapType(((TypeInsnNode)n).desc).equals("net/minecraft/tileentity/TileEntity"))
          break;
      }
      addTileEntities.instructions.insert(n, n = a);
      addTileEntities.instructions.insert(n, n = new LineNumberNode(-15003, a));
      addTileEntities.instructions.insert(n, n = new InsnNode(DUP));
      addTileEntities.instructions.insert(n, n = new VarInsnNode(ALOAD, 0));
      addTileEntities.instructions.insert(n, n = new FieldInsnNode(GETFIELD, "net/minecraft/world/World", "cofh_recentTiles", "Lcofh/lib/util/LinkedHashList;"));
      addTileEntities.instructions.insert(n, n = new InsnNode(SWAP));
      addTileEntities.instructions.insert(n, n = new MethodInsnNode(INVOKEVIRTUAL, "cofh/lib/util/LinkedHashList", "push", "(Ljava/lang/Object;)Z", false));
      addTileEntities.instructions.insert(n, n = new InsnNode(POP));
    }
    if (updateEntities != null) {
      AbstractInsnNode n = updateEntities.instructions.getFirst();
      while (n.getOpcode() != INVOKEVIRTUAL ||
          !"onChunkUnload".equals(((MethodInsnNode)n).name) ||
          !"()V".equals(((MethodInsnNode)n).desc)) n = n.getNext();
      while (n.getOpcode() != PUTFIELD) n = n.getNext();
      n = n.getPrevious().getPrevious();
      LabelNode lStart = new LabelNode(new Label());
      LabelNode lCond = new LabelNode(new Label());
      LabelNode lGuard = new LabelNode(new Label());
      LabelNode a = new LabelNode(new Label());
      updateEntities.instructions.insert(n, n = a);
      updateEntities.instructions.insert(n, n = new LineNumberNode(-15004, a));
      updateEntities.instructions.insert(n, n = new JumpInsnNode(GOTO, lCond));
      updateEntities.instructions.insert(n, n = lStart);
      updateEntities.instructions.insert(n, n = new FrameNode(F_SAME, 0, null, 0, null));
      updateEntities.instructions.insert(n, n = new VarInsnNode(ALOAD, 0));
      updateEntities.instructions.insert(n, n = new FieldInsnNode(GETFIELD, "net/minecraft/world/World", "cofh_recentTiles", "Lcofh/lib/util/LinkedHashList;"));
View Full Code Here

Examples of org.objectweb.asm.tree.LineNumberNode

    Map<Integer, LabelNode> labelz = new HashMap<Integer, LabelNode>();
    ListIterator<AbstractInsnNode> li = ret.iterator();
    AbstractInsnNode ain = li.hasNext() ? null : li.next();
    for (int i = 0; li.hasNext(); ain = li.next(), i++) {
      if (ain instanceof LineNumberNode) {
        LineNumberNode lnn = (LineNumberNode) ain;
        LabelNode cl = labelz.get(lnn.start.getLabel().getOffset());
        if (cl == null) {
          labelz.put(lnn.start.getLabel().getOffset(), lnn.start);
        } else {
          lnn.start = cl;
View Full Code Here

Examples of org.objectweb.asm.tree.LineNumberNode

      case -1:
        switch (args[0].toUpperCase()) {
          case "LINE":
          case "LINENUMBER":
            return new LineNumberNode(toint(args[1]), getLabelNode(toint(args[2])));// FIXME
          case "MULTIANEWARRAY":
            return new MultiANewArrayInsnNode(args[1], toint(args[2]));
          case "TABLESWITCH":
          case "SWITCH":
            return new TableSwitchInsnNode(toint(args[1]), toint(args[2]),
View Full Code Here

Examples of org.objectweb.asm.tree.LineNumberNode

  @Override
    public LineNumberNode deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
    JsonObject jsonObject = (JsonObject) json;
        int line = jsonObject.get("line").getAsInt();
        LabelNode start = context.deserialize(jsonObject.get("start"), LabelNode.class);
        return new LineNumberNode(line, start);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.