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

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

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

Bytecode.addLload介绍

[英]Appends LLOAD or (WIDE) LLOAD_<n>
[中]附加LLOAD或(宽)LLOAD

代码示例

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

private static int addLoad(Bytecode code, int n, Class type) {
  if (type.isPrimitive()) {
    if (type == Long.TYPE) {
      code.addLload(n);
      return 2;
    }
    else if (type == Float.TYPE)
      code.addFload(n);
    else if (type == Double.TYPE) {
      code.addDload(n);
      return 2;
    }
    else
      code.addIload(n);
  }
  else
    code.addAload(n);
  return 1;
}

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

private static int addLoad(Bytecode code, int n, Class<?> type) {
  if (type.isPrimitive()) {
    if (type == Long.TYPE) {
      code.addLload(n);
      return 2;
    }
    else if (type == Float.TYPE)
      code.addFload(n);
    else if (type == Double.TYPE) {
      code.addDload(n);
      return 2;
    }
    else
      code.addIload(n);
  }
  else
    code.addAload(n);
  return 1;
}

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

addIload(n);
else if (type == CtClass.longType) {
  addLload(n);
  return 2;

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

addIload(n);
else if (type == CtClass.longType) {
  addLload(n);
  return 2;

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

public void atVariable(Variable v) throws CompileError {
  Declarator d = v.getDeclarator();
  exprType = d.getType();
  arrayDim = d.getArrayDim();
  className = d.getClassName();
  int var = getLocalVar(d);
  if (arrayDim > 0)
    bytecode.addAload(var);
  else
    switch (exprType) {
    case CLASS :
      bytecode.addAload(var);
      break;
    case LONG :
      bytecode.addLload(var);
      break;
    case FLOAT :
      bytecode.addFload(var);
      break;
    case DOUBLE :
      bytecode.addDload(var);
      break;
    default :   // BOOLEAN, BYTE, CHAR, SHORT, INT
      bytecode.addIload(var);
      break;
    }
}

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

@Override
public void atVariable(Variable v) throws CompileError {
  Declarator d = v.getDeclarator();
  exprType = d.getType();
  arrayDim = d.getArrayDim();
  className = d.getClassName();
  int var = getLocalVar(d);
  if (arrayDim > 0)
    bytecode.addAload(var);
  else
    switch (exprType) {
    case CLASS :
      bytecode.addAload(var);
      break;
    case LONG :
      bytecode.addLload(var);
      break;
    case FLOAT :
      bytecode.addFload(var);
      break;
    case DOUBLE :
      bytecode.addDload(var);
      break;
    default :   // BOOLEAN, BYTE, CHAR, SHORT, INT
      bytecode.addIload(var);
      break;
    }
}

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

b.addLstore(getVar(2));
  jsrJmp(b);
  b.addLload(var);
  break;
case DRETURN :

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

b.addLstore(getVar(2));
  jsrJmp(b);
  b.addLload(var);
  break;
case DRETURN :

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

bytecode.addLload(var);
if (doDup && isPost)
  bytecode.addOpcode(DUP2);

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

bytecode.addLload(var);
if (doDup && isPost)
  bytecode.addOpcode(DUP2);

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.core

private static void addTypeDependDataLoad(Bytecode code, String typeName,
                     int i) {
  if ((typeName.charAt(0) == 'L')
    && (typeName.charAt(typeName.length() - 1) == ';')
    || (typeName.charAt(0) == '[')) {
    // reference type
    code.addAload(i);
  } else if (typeName.equals("Z") || typeName.equals("B")
        || typeName.equals("C") || typeName.equals("I")
        || typeName.equals("S")) {
    // boolean, byte, char, int, short
    code.addIload(i);
  } else if (typeName.equals("D")) {
    // double
    code.addDload(i);
  } else if (typeName.equals("F")) {
    // float
    code.addFload(i);
  } else if (typeName.equals("J")) {
    // long
    code.addLload(i);
  } else {
    // bad type
    throw new RuntimeException("bad type: " + typeName);
  }
}

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate

private static void addTypeDependDataLoad(Bytecode code, String typeName,
                     int i) {
  if ((typeName.charAt(0) == 'L')
    && (typeName.charAt(typeName.length() - 1) == ';')
    || (typeName.charAt(0) == '[')) {
    // reference type
    code.addAload(i);
  } else if (typeName.equals("Z") || typeName.equals("B")
        || typeName.equals("C") || typeName.equals("I")
        || typeName.equals("S")) {
    // boolean, byte, char, int, short
    code.addIload(i);
  } else if (typeName.equals("D")) {
    // double
    code.addDload(i);
  } else if (typeName.equals("F")) {
    // float
    code.addFload(i);
  } else if (typeName.equals("J")) {
    // long
    code.addLload(i);
  } else {
    // bad type
    throw new RuntimeException("bad type: " + typeName);
  }
}

代码示例来源:origin: com.google.code.maven-play-plugin.org.playframework/play

static Bytecode makeBytecodeForLVStore(CtMethod method, String sig, String name, int slot) {
  Bytecode b = new Bytecode(method.getMethodInfo().getConstPool());
  b.addLdc(name);
  if ("I".equals(sig) || "B".equals(sig) || "C".equals(sig) || "S".equals(sig) || "Z".equals(sig))
    b.addIload(slot);
  else if ("F".equals(sig))
    b.addFload(slot);
  else if ("J".equals(sig))
    b.addLload(slot);
  else if ("D".equals(sig))
    b.addDload(slot);
  else
    b.addAload(slot);
  String localVarDescriptor = sig;
  if (!"B".equals(sig) && !"C".equals(sig) && !"D".equals(sig) && !"F".equals(sig) && !"I".equals(sig) && !"J".equals(sig)
      && !"S".equals(sig) && !"Z".equals(sig))
    localVarDescriptor = "Ljava/lang/Object;";
  Logger.trace("for variable '%s' in slot=%s, sig was '%s' and is now '%s'", name, slot, sig, localVarDescriptor);
  b.addInvokestatic("play.classloading.enhancers.LocalvariablesNamesEnhancer$LocalVariablesNamesTracer", "addVariable",
      "(Ljava/lang/String;" + localVarDescriptor + ")V");
  return b;
}

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

private static int addLoad(Bytecode code, int n, Class type) {
  if (type.isPrimitive()) {
    if (type == Long.TYPE) {
      code.addLload(n);
      return 2;
    }
    else if (type == Float.TYPE)
      code.addFload(n);
    else if (type == Double.TYPE) {
      code.addDload(n);
      return 2;
    }
    else
      code.addIload(n);
  }
  else
    code.addAload(n);
  return 1;
}

代码示例来源:origin: org.jboss.seam/jboss-seam

private static int addLoad(Bytecode code, int n, Class type) {
  if (type.isPrimitive()) {
    if (type == Long.TYPE) {
      code.addLload(n);
      return 2;
    }
    else if (type == Float.TYPE)
      code.addFload(n);
    else if (type == Double.TYPE) {
      code.addDload(n);
      return 2;
    }
    else
      code.addIload(n);
  }
  else
    code.addAload(n);
  return 1;
}

代码示例来源:origin: hstaudacher/osgi-jax-rs-connector

private static int addLoad(Bytecode code, int n, Class type) {
  if (type.isPrimitive()) {
    if (type == Long.TYPE) {
      code.addLload(n);
      return 2;
    }
    else if (type == Float.TYPE)
      code.addFload(n);
    else if (type == Double.TYPE) {
      code.addDload(n);
      return 2;
    }
    else
      code.addIload(n);
  }
  else
    code.addAload(n);
  return 1;
}

代码示例来源:origin: hstaudacher/osgi-jax-rs-connector

private static int addLoad(Bytecode code, int n, Class type) {
  if (type.isPrimitive()) {
    if (type == Long.TYPE) {
      code.addLload(n);
      return 2;
    }
    else if (type == Float.TYPE)
      code.addFload(n);
    else if (type == Double.TYPE) {
      code.addDload(n);
      return 2;
    }
    else
      code.addIload(n);
  }
  else
    code.addAload(n);
  return 1;
}

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

private static int addLoad(Bytecode code, int n, Class type) {
  if (type.isPrimitive()) {
    if (type == Long.TYPE) {
      code.addLload(n);
      return 2;
    }
    else if (type == Float.TYPE)
      code.addFload(n);
    else if (type == Double.TYPE) {
      code.addDload(n);
      return 2;
    }
    else
      code.addIload(n);
  }
  else
    code.addAload(n);
  return 1;
}

代码示例来源:origin: com.eclipsesource.jaxrs/jersey-all

private static int addLoad(Bytecode code, int n, Class type) {
  if (type.isPrimitive()) {
    if (type == Long.TYPE) {
      code.addLload(n);
      return 2;
    }
    else if (type == Float.TYPE)
      code.addFload(n);
    else if (type == Double.TYPE) {
      code.addDload(n);
      return 2;
    }
    else
      code.addIload(n);
  }
  else
    code.addAload(n);
  return 1;
}

代码示例来源:origin: hstaudacher/osgi-jax-rs-connector

public void atVariable(Variable v) throws CompileError {
  Declarator d = v.getDeclarator();
  exprType = d.getType();
  arrayDim = d.getArrayDim();
  className = d.getClassName();
  int var = getLocalVar(d);
  if (arrayDim > 0)
    bytecode.addAload(var);
  else
    switch (exprType) {
    case CLASS :
      bytecode.addAload(var);
      break;
    case LONG :
      bytecode.addLload(var);
      break;
    case FLOAT :
      bytecode.addFload(var);
      break;
    case DOUBLE :
      bytecode.addDload(var);
      break;
    default :   // BOOLEAN, BYTE, CHAR, SHORT, INT
      bytecode.addIload(var);
      break;
    }
}

相关文章