javassist.bytecode.Bytecode.write16bit()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(4.6k)|赞(0)|评价(0)|浏览(118)

本文整理了Java中javassist.bytecode.Bytecode.write16bit()方法的一些代码示例,展示了Bytecode.write16bit()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bytecode.write16bit()方法的具体详情如下:
包路径:javassist.bytecode.Bytecode
类名称:Bytecode
方法名:write16bit

Bytecode.write16bit介绍

[英]Writes an 16bit value at the offset from the beginning of the bytecode sequence.
[中]

代码示例

代码示例来源:origin: redisson/redisson

/**
 * Writes an 32bit value at the offset from the beginning of the
 * bytecode sequence.
 */
public void write32bit(int offset, int value) {
  write16bit(offset, value >> 16);
  write16bit(offset + 2, value);
}

代码示例来源:origin: org.javassist/javassist

/**
 * Writes an 32bit value at the offset from the beginning of the
 * bytecode sequence.
 */
public void write32bit(int offset, int value) {
  write16bit(offset, value >> 16);
  write16bit(offset + 2, value);
}

代码示例来源:origin: org.javassist/javassist

protected void patchGoto(List<Integer> list, int targetPc) {
  for (int pc:list)
    bytecode.write16bit(pc, targetPc - pc + 1);
}

代码示例来源:origin: redisson/redisson

protected void patchGoto(ArrayList list, int targetPc) {
  int n = list.size();
  for (int i = 0; i < n; ++i) {
    int pc = ((Integer)list.get(i)).intValue();
    bytecode.write16bit(pc, targetPc - pc + 1);
  }
}

代码示例来源:origin: redisson/redisson

/**
 * Adds a finally clause for earch return statement.
 */
private void addFinally(ArrayList returnList, Stmnt finallyBlock)
  throws CompileError
{
  Bytecode bc = bytecode;
  int n = returnList.size();
  for (int i = 0; i < n; ++i) {
    final int[] ret = (int[])returnList.get(i);
    int pc = ret[0];
    bc.write16bit(pc, bc.currentPc() - pc + 1);
    ReturnHook hook = new JsrHook2(this, ret);
    finallyBlock.accept(this);
    hook.remove(this);
    if (!hasReturned) {
      bc.addOpcode(Opcode.GOTO);
      bc.addIndex(pc + 3 - bc.currentPc());
    }
  }
}

代码示例来源:origin: redisson/redisson

public void atCondExpr(CondExpr expr) throws CompileError {
  if (booleanExpr(false, expr.condExpr()))
    expr.elseExpr().accept(this);
  else {
    int pc = bytecode.currentPc();
    bytecode.addIndex(0);   // correct later
    expr.thenExpr().accept(this);
    int dim1 = arrayDim;
    bytecode.addOpcode(Opcode.GOTO);
    int pc2 = bytecode.currentPc();
    bytecode.addIndex(0);
    bytecode.write16bit(pc, bytecode.currentPc() - pc + 1);
    expr.elseExpr().accept(this);
    if (dim1 != arrayDim)
      throw new CompileError("type mismatch in ?:");
    bytecode.write16bit(pc2, bytecode.currentPc() - pc2 + 1);
  }
}

代码示例来源:origin: redisson/redisson

bytecode.write16bit(pc, pc3 - pc + 1);

代码示例来源:origin: org.javassist/javassist

/**
 * Adds a finally clause for earch return statement.
 */
private void addFinally(List<int[]> returnList, Stmnt finallyBlock)
  throws CompileError
{
  Bytecode bc = bytecode;
  for (final int[] ret:returnList) {
    int pc = ret[0];
    bc.write16bit(pc, bc.currentPc() - pc + 1);
    ReturnHook hook = new JsrHook2(this, ret);
    finallyBlock.accept(this);
    hook.remove(this);
    if (!hasReturned) {
      bc.addOpcode(Opcode.GOTO);
      bc.addIndex(pc + 3 - bc.currentPc());
    }
  }
}

代码示例来源:origin: redisson/redisson

bytecode.write16bit(pc, bytecode.currentPc() - pc + 1);
if (elsep != null) {
  elsep.accept(this);
  if (!thenHasReturned)
    bytecode.write16bit(pc2, bytecode.currentPc() - pc2 + 1);

代码示例来源:origin: org.javassist/javassist

@Override
public void atCondExpr(CondExpr expr) throws CompileError {
  if (booleanExpr(false, expr.condExpr()))
    expr.elseExpr().accept(this);
  else {
    int pc = bytecode.currentPc();
    bytecode.addIndex(0);   // correct later
    expr.thenExpr().accept(this);
    int dim1 = arrayDim;
    bytecode.addOpcode(Opcode.GOTO);
    int pc2 = bytecode.currentPc();
    bytecode.addIndex(0);
    bytecode.write16bit(pc, bytecode.currentPc() - pc + 1);
    expr.elseExpr().accept(this);
    if (dim1 != arrayDim)
      throw new CompileError("type mismatch in ?:");
    bytecode.write16bit(pc2, bytecode.currentPc() - pc2 + 1);
  }
}

代码示例来源:origin: org.javassist/javassist

bytecode.write16bit(pc, pc3 - pc + 1);

代码示例来源:origin: org.javassist/javassist

bytecode.write16bit(pc, bytecode.currentPc() - pc + 1);
if (elsep != null) {
  elsep.accept(this);
  if (!thenHasReturned)
    bytecode.write16bit(pc2, bytecode.currentPc() - pc2 + 1);

代码示例来源:origin: redisson/redisson

bytecode.write16bit(pc2, pc4 - pc2 + 1);

代码示例来源:origin: redisson/redisson

+ "Ljava/lang/NoClassDefFoundError;");
bytecode.addOpcode(ATHROW);
bytecode.write16bit(pc, bytecode.currentPc() - pc + 1);

代码示例来源:origin: org.javassist/javassist

bytecode.write16bit(pc2, pc4 - pc2 + 1);

代码示例来源:origin: org.javassist/javassist

+ "Ljava/lang/NoClassDefFoundError;");
bytecode.addOpcode(ATHROW);
bytecode.write16bit(pc, bytecode.currentPc() - pc + 1);

代码示例来源:origin: redisson/redisson

bytecode.addOpcode(Opcode.GOTO);
bytecode.write16bit(pc, bytecode.currentPc() - pc + 3);
if (branchIf != isAndAnd) {
  bytecode.addIndex(6);   // skip GOTO instruction

代码示例来源:origin: org.javassist/javassist

bytecode.addOpcode(Opcode.GOTO);
bytecode.write16bit(pc, bytecode.currentPc() - pc + 3);
if (branchIf != isAndAnd) {
  bytecode.addIndex(6);   // skip GOTO instruction

代码示例来源:origin: redisson/redisson

bc.write16bit(pc3, bc.currentPc() - pc3 + 1);

代码示例来源:origin: org.javassist/javassist

bc.write16bit(pc3, bc.currentPc() - pc3 + 1);

相关文章