Java 类org.apache.bcel.generic.NEWARRAY 实例源码

项目:root4j    文件:TArrayF.java   
protected void generateStreamer(ConstantPoolGen cp, InstructionList il, InstructionFactory factory, String className, boolean hasHeader)
{
   il.append(InstructionConstants.ALOAD_0);
   il.append(InstructionConstants.ALOAD_1);
   il.append(InstructionConstants.DUP2);
   il.append(factory.createInvoke("org.dianahep.root4j.core.RootInput", "readInt", Type.INT, Type.NO_ARGS, INVOKEINTERFACE));
   il.append(InstructionConstants.DUP_X1);
   il.append(factory.createPutField(className, "fN", Type.INT));
   il.append(new NEWARRAY(Type.FLOAT));
   il.append(InstructionConstants.DUP_X1);
   il.append(factory.createInvoke("org.dianahep.root4j.core.RootInput", "readFixedArray", Type.VOID, arrayArgType, INVOKEINTERFACE));
   il.append(factory.createPutField(className, "fArray", RootType.FLOATARRAY));
}
项目:root4j    文件:TArrayC.java   
protected void generateStreamer(ConstantPoolGen cp, InstructionList il, InstructionFactory factory, String className, boolean hasHeader)
{
   il.append(InstructionConstants.ALOAD_0);
   il.append(InstructionConstants.ALOAD_1);
   il.append(InstructionConstants.DUP2);
   il.append(factory.createInvoke("org.dianahep.root4j.core.RootInput", "readInt", Type.INT, Type.NO_ARGS, INVOKEINTERFACE));
   il.append(InstructionConstants.DUP_X1);
   il.append(factory.createPutField(className, "fN", Type.INT));
   il.append(new NEWARRAY(Type.CHAR));
   il.append(InstructionConstants.DUP_X1);
   il.append(factory.createInvoke("org.dianahep.root4j.core.RootInput", "readFixedArray", Type.VOID, arrayArgType, INVOKEINTERFACE));
   il.append(factory.createPutField(className, "fArray", RootType.CHARARRAY));
}
项目:root4j    文件:TArrayD.java   
protected void generateStreamer(ConstantPoolGen cp, InstructionList il, InstructionFactory factory, String className, boolean hasHeader)
{
   il.append(InstructionConstants.ALOAD_0);
   il.append(InstructionConstants.ALOAD_1);
   il.append(InstructionConstants.DUP2);
   il.append(factory.createInvoke("org.dianahep.root4j.core.RootInput", "readInt", Type.INT, Type.NO_ARGS, INVOKEINTERFACE));
   il.append(InstructionConstants.DUP_X1);
   il.append(factory.createPutField(className, "fN", Type.INT));
   il.append(new NEWARRAY(Type.DOUBLE));
   il.append(InstructionConstants.DUP_X1);
   il.append(factory.createInvoke("org.dianahep.root4j.core.RootInput", "readFixedArray", Type.VOID, arrayArgType, INVOKEINTERFACE));
   il.append(factory.createPutField(className, "fArray", RootType.DOUBLEARRAY));
}
项目:root4j    文件:TArrayI.java   
protected void generateStreamer(ConstantPoolGen cp, InstructionList il, InstructionFactory factory, String className, boolean hasHeader)
{
   il.append(InstructionConstants.ALOAD_0);
   il.append(InstructionConstants.ALOAD_1);
   il.append(InstructionConstants.DUP2);
   il.append(factory.createInvoke("org.dianahep.root4j.core.RootInput", "readInt", Type.INT, Type.NO_ARGS, INVOKEINTERFACE));
   il.append(InstructionConstants.DUP_X1);
   il.append(factory.createPutField(className, "fN", Type.INT));
   il.append(new NEWARRAY(Type.INT));
   il.append(InstructionConstants.DUP_X1);
   il.append(factory.createInvoke("org.dianahep.root4j.core.RootInput", "readFixedArray", Type.VOID, arrayArgType, INVOKEINTERFACE));
   il.append(factory.createPutField(className, "fArray", RootType.INTARRAY));
}
项目:root4j    文件:StreamerInfoString.java   
public void generateReadCode(InstructionList il, InstructionFactory factory, ConstantPoolGen cp, String className)
{
   if (pointer)
   {
      ((GenericRootClass) varClass).generateReadPointerCode(il, factory, cp);
   }
   else if (dim == 0)
   {
      varClass.generateReadCode(il, factory, cp);
   }
   else if (varCounter == null)
   {
      ((IntrinsicRootClass) varClass).generateReadArrayCode(il, factory, cp, 1, new int[]{index});
   }
   else 
   {
      BasicMember varMember = getMember(varCounter);
      if (varMember == null) throw new RuntimeException("Cannot find variable counter "+varCounter);
      Type varMemberType = varMember.getJavaType();
      il.append(InstructionConstants.ALOAD_0);
      il.append(factory.createInvoke(className, nameMangler.mangleMember(varCounter), varMemberType, Type.NO_ARGS, INVOKESPECIAL));
      if (varMemberType != Type.INT  &&  varMemberType != Type.BYTE  &&  varMemberType != Type.CHAR  &&  varMemberType != Type.SHORT)
          il.append(factory.createCast(varMemberType, Type.INT));

      BasicType type = (BasicType) varClass.getJavaType();
      il.append(new NEWARRAY(type));
      il.append(InstructionConstants.DUP_X1);

      Type[] arrayArgType = new Type[] { new ArrayType(type, 1) };
      il.append(factory.createInvoke("org.dianahep.root4j.core.RootInput", "readFixedArray", Type.VOID, arrayArgType, INVOKEINTERFACE));
   }
   if (varClass.getConvertMethod() != null)
   {
      il.append(factory.createInvoke("org.dianahep.root4j.interfaces." + varClass.getClassName(), varClass.getConvertMethod(), varClass.getJavaTypeForMethod(), Type.NO_ARGS, INVOKEINTERFACE));
   }
}
项目:VestaClient    文件:Pass3aVerifier.java   
/** Checks if the constraints of operands of the said instruction(s) are satisfied. */
public void visitNEWARRAY(NEWARRAY o){
    byte t = o.getTypecode();
    if (!   (   (t == Constants.T_BOOLEAN)  ||
                    (t == Constants.T_CHAR)         ||
                    (t == Constants.T_FLOAT)        ||
                    (t == Constants.T_DOUBLE)       ||
                    (t == Constants.T_BYTE)         ||
                    (t == Constants.T_SHORT)        ||
                    (t == Constants.T_INT)          ||
                    (t == Constants.T_LONG) )   ){
        constraintViolated(o, "Illegal type code '+t+' for 'atype' operand.");
    }
}
项目:VestaClient    文件:BCELFactory.java   
public void visitAllocationInstruction( AllocationInstruction i ) {
    Type type;
    if (i instanceof CPInstruction) {
        type = ((CPInstruction) i).getType(_cp);
    } else {
        type = ((NEWARRAY) i).getType();
    }
    short opcode = ((Instruction) i).getOpcode();
    int dim = 1;
    switch (opcode) {
        case Constants.NEW:
            _out.println("il.append(_factory.createNew(\"" + ((ObjectType) type).getClassName()
                    + "\"));");
            break;
        case Constants.MULTIANEWARRAY:
            dim = ((MULTIANEWARRAY) i).getDimensions();
        case Constants.ANEWARRAY:
        case Constants.NEWARRAY:
            if (type instanceof ArrayType) {
                type = ((ArrayType) type).getBasicType();
            }
            _out.println("il.append(_factory.createNewArray(" + BCELifier.printType(type)
                    + ", (short) " + dim + "));");
            break;
        default:
            throw new RuntimeException("Oops: " + opcode);
    }
}
项目:cashmere    文件:LoadAwareBasicBlock.java   
/**
 * Checks that any store in this basic block to the specified variable is the
 * result of a new() or a null.
 * @param ih handle up to where to investigate.
 * @param localVarIndex the local variable index
 * @return true if all stores are OK or there are no stores.
 */
boolean noAliasesStoreWithIndexBefore(InstructionHandle ih, LocalVariableGen lg) {
    InstructionHandle prev = null;
    for (InstructionContext ic : instructions) {
        InstructionHandle current = ic.getInstruction();
        if (current.equals(ih)) {
            break;
        }

        if (methodGen.instructionStoresTo(current, lg.getIndex())) {
            LocalVariableGen l1 = methodGen.findLocalVar(current, lg.getIndex(), false);
            if (l1 != lg) {
                prev = current;
                continue;
            }
            if (prev != null) {
                Instruction i = prev.getInstruction();
                if (i instanceof INVOKESPECIAL) {
                    INVOKESPECIAL invoker = (INVOKESPECIAL) i;
                    if (invoker.getMethodName(methodGen.getConstantPool()).equals("<init>")
                        && isNonEscapingConstructor(invoker)) {
                        continue;
                    }
                }
                if (i instanceof CHECKCAST) {
                InstructionHandle pp = prev.getPrev();
                if (pp != null) {
                    i = pp.getInstruction();
                }
                }
                if (i instanceof NEWARRAY
                        || i instanceof ANEWARRAY || i instanceof MULTIANEWARRAY
                        || i instanceof ConstantPushInstruction || i instanceof ACONST_NULL) {
                     prev = current;
                     continue;
                }
            }
            return false;

        }
        prev = current;
    }
    return true;
}
项目:cn1    文件:ClassToXmlvmProcess.java   
private void emitNEWARRAY(Element xml_inst, NEWARRAY inst) {
    xml_inst.setAttribute("base-type", inst.getType().toString().replace("[]", ""));
}
项目:findbugs-all-the-bugs    文件:IsNullValueFrameModelingVisitor.java   
@Override
public void visitNEWARRAY(NEWARRAY obj) {
    modelNormalInstruction(obj, getNumWordsConsumed(obj), 0);
    produce(IsNullValue.nonNullValue());
}
项目:FindBug-for-Domino-Designer    文件:IsNullValueFrameModelingVisitor.java   
@Override
public void visitNEWARRAY(NEWARRAY obj) {
    modelNormalInstruction(obj, getNumWordsConsumed(obj), 0);
    produce(IsNullValue.nonNullValue());
}