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

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

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

Bytecode.addDload介绍

[英]Appends DLOAD or (WIDE) DLOAD_<n>
[中]附加数据加载或(宽)数据加载

代码示例

代码示例来源: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

addFload(n);
else if(type == CtClass.doubleType) {
  addDload(n);
  return 2;

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

addFload(n);
else if(type == CtClass.doubleType) {
  addDload(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: opentripplanner/OpenTripPlanner

private void addDoubleSetter(ClassFile classFile, String fieldName)
      throws DuplicateMemberException {
    ConstPool constPool = classFile.getConstPool();

    // void setFoo(double)
    MethodInfo setter = new MethodInfo(constPool, "set" + ucfirst(fieldName), "(D)V");
    Bytecode code = new Bytecode(constPool, 3, 3);

    // load this
    code.addAload(0);

    // load param
    code.addDload(1);
    code.addPutfield(ctClass, fieldName, "D");

    code.addOpcode(Opcode.RETURN);

    setter.setCodeAttribute(code.toCodeAttribute());
    setter.setAccessFlags(AccessFlag.PUBLIC);
    classFile.addMethod(setter);

  }
}

代码示例来源: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.addDstore(getVar(2));
  jsrJmp(b);
  b.addDload(var);
  break;
case FRETURN :

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

b.addDstore(getVar(2));
  jsrJmp(b);
  b.addDload(var);
  break;
case FRETURN :

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

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

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

bytecode.addDload(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: 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;
    }
}

相关文章