Package javassist.bytecode

Examples of javassist.bytecode.CodeIterator.writeByte()


      while (iterator.hasNext()) {
        int index = iterator.next();
        int op = iterator.byteAt(index);
        if (op == opcode && (removeIndex < 0 || removeIndex == ++currentIndex)) {
          for (int i = 0; i <= index; i++) {
            iterator.writeByte(Opcode.NOP, i);
          }
          removed++;
          PatchLog.fine("Removed until " + index);
          if (removeIndex == -2) {
            break;
View Full Code Here


    CodeAttribute codeAttribute = methodInfo.getCodeAttribute();
    if (codeAttribute != null) {
      CodeIterator iterator = codeAttribute.iterator();
      int i, length = iterator.getCodeLength() - 1;
      for (i = index; i < length; i++) {
        iterator.writeByte(Opcode.NOP, i);
      }
      iterator.writeByte(Opcode.RETURN, i);
      methodInfo.rebuildStackMapIf6(ctClass.getClassPool(), ctClass.getClassFile2());
    }
  }
View Full Code Here

      CodeIterator iterator = codeAttribute.iterator();
      int i, length = iterator.getCodeLength() - 1;
      for (i = index; i < length; i++) {
        iterator.writeByte(Opcode.NOP, i);
      }
      iterator.writeByte(Opcode.RETURN, i);
      methodInfo.rebuildStackMapIf6(ctClass.getClassPool(), ctClass.getClassFile2());
    }
  }

  @Patch(
View Full Code Here

        if (constPool.getInterfaceMethodrefClassName(mref).endsWith("Lock")) {
          String name = constPool.getInterfaceMethodrefName(mref);
          boolean remove = false;
          if ("lock".equals(name)) {
            remove = true;
            iterator.writeByte(Opcode.MONITORENTER, pos);
          } else if ("unlock".equals(name)) {
            remove = true;
            iterator.writeByte(Opcode.MONITOREXIT, pos);
          }
          if (remove) {
View Full Code Here

          if ("lock".equals(name)) {
            remove = true;
            iterator.writeByte(Opcode.MONITORENTER, pos);
          } else if ("unlock".equals(name)) {
            remove = true;
            iterator.writeByte(Opcode.MONITOREXIT, pos);
          }
          if (remove) {
            done++;
            iterator.writeByte(Opcode.NOP, pos + 1);
            iterator.writeByte(Opcode.NOP, pos + 2);
View Full Code Here

            remove = true;
            iterator.writeByte(Opcode.MONITOREXIT, pos);
          }
          if (remove) {
            done++;
            iterator.writeByte(Opcode.NOP, pos + 1);
            iterator.writeByte(Opcode.NOP, pos + 2);
            iterator.writeByte(Opcode.NOP, pos + 3);
            iterator.writeByte(Opcode.NOP, pos + 4);
          }
        }
View Full Code Here

            iterator.writeByte(Opcode.MONITOREXIT, pos);
          }
          if (remove) {
            done++;
            iterator.writeByte(Opcode.NOP, pos + 1);
            iterator.writeByte(Opcode.NOP, pos + 2);
            iterator.writeByte(Opcode.NOP, pos + 3);
            iterator.writeByte(Opcode.NOP, pos + 4);
          }
        }
      } else if (op == Opcode.INVOKEVIRTUAL) {
View Full Code Here

          }
          if (remove) {
            done++;
            iterator.writeByte(Opcode.NOP, pos + 1);
            iterator.writeByte(Opcode.NOP, pos + 2);
            iterator.writeByte(Opcode.NOP, pos + 3);
            iterator.writeByte(Opcode.NOP, pos + 4);
          }
        }
      } else if (op == Opcode.INVOKEVIRTUAL) {
        int mref = iterator.u16bitAt(pos + 1);
View Full Code Here

          if (remove) {
            done++;
            iterator.writeByte(Opcode.NOP, pos + 1);
            iterator.writeByte(Opcode.NOP, pos + 2);
            iterator.writeByte(Opcode.NOP, pos + 3);
            iterator.writeByte(Opcode.NOP, pos + 4);
          }
        }
      } else if (op == Opcode.INVOKEVIRTUAL) {
        int mref = iterator.u16bitAt(pos + 1);
        if (constPool.getMethodrefClassName(mref).endsWith("NativeMutex")) {
View Full Code Here

        if (constPool.getMethodrefClassName(mref).endsWith("NativeMutex")) {
          String name = constPool.getMethodrefName(mref);
          boolean remove = false;
          if ("lock".equals(name)) {
            remove = true;
            iterator.writeByte(Opcode.MONITORENTER, pos);
          } else if ("unlock".equals(name)) {
            remove = true;
            iterator.writeByte(Opcode.MONITOREXIT, pos);
          }
          if (remove) {
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.