Java 类com.sun.org.apache.bcel.internal.generic.Type 实例源码

项目:OpenJSharp    文件:MethodGenerator.java   
/**
 * Helper method to generate an instance of a subclass of
 * {@link LoadInstruction} based on the specified {@link Type} that will
 * load the specified local variable
 * @param index the JVM stack frame index of the variable that is to be
 * loaded
 * @param type the {@link Type} of the variable
 * @return the generated {@link LoadInstruction}
 */
private static Instruction loadLocal(int index, Type type) {
    if (type == Type.BOOLEAN) {
       return new ILOAD(index);
    } else if (type == Type.INT) {
       return new ILOAD(index);
    } else if (type == Type.SHORT) {
       return new ILOAD(index);
    } else if (type == Type.LONG) {
       return new LLOAD(index);
    } else if (type == Type.BYTE) {
       return new ILOAD(index);
    } else if (type == Type.CHAR) {
       return new ILOAD(index);
    } else if (type == Type.FLOAT) {
       return new FLOAD(index);
    } else if (type == Type.DOUBLE) {
       return new DLOAD(index);
    } else {
       return new ALOAD(index);
    }
}
项目:OpenJSharp    文件:MethodGenerator.java   
/**
 * Helper method to generate an instance of a subclass of
 * {@link StoreInstruction} based on the specified {@link Type} that will
 * store a value in the specified local variable
 * @param index the JVM stack frame index of the variable that is to be
 * stored
 * @param type the {@link Type} of the variable
 * @return the generated {@link StoredInstruction}
 */
private static Instruction storeLocal(int index, Type type) {
    if (type == Type.BOOLEAN) {
       return new ISTORE(index);
    } else if (type == Type.INT) {
       return new ISTORE(index);
    } else if (type == Type.SHORT) {
       return new ISTORE(index);
    } else if (type == Type.LONG) {
       return new LSTORE(index);
    } else if (type == Type.BYTE) {
       return new ISTORE(index);
    } else if (type == Type.CHAR) {
       return new ISTORE(index);
    } else if (type == Type.FLOAT) {
       return new FSTORE(index);
    } else if (type == Type.DOUBLE) {
       return new DSTORE(index);
    } else {
       return new ASTORE(index);
    }
}
项目:OpenJSharp    文件:CompareGenerator.java   
public CompareGenerator(int access_flags, Type return_type,
                        Type[] arg_types, String[] arg_names,
                        String method_name, String class_name,
                        InstructionList il, ConstantPoolGen cp) {
    super(access_flags, return_type, arg_types, arg_names, method_name,
          class_name, il, cp);

    _iloadCurrent = new ILOAD(CURRENT_INDEX);
    _istoreCurrent = new ISTORE(CURRENT_INDEX);
    _aloadDom = new ALOAD(DOM_INDEX);
    _iloadLast = new ILOAD(LAST_INDEX);

    LocalVariableGen iterator =
        addLocalVariable("iterator",
                         Util.getJCRefType(Constants.NODE_ITERATOR_SIG),
                         null, null);
    ITERATOR_INDEX = iterator.getIndex();
    _aloadIterator = new ALOAD(ITERATOR_INDEX);
    _astoreIterator = new ASTORE(ITERATOR_INDEX);
    il.append(new ACONST_NULL());
    il.append(storeIterator());
}
项目:openjdk-jdk10    文件:MethodGenerator.java   
/**
 * Helper method to generate an instance of a subclass of
 * {@link LoadInstruction} based on the specified {@link Type} that will
 * load the specified local variable
 * @param index the JVM stack frame index of the variable that is to be
 * loaded
 * @param type the {@link Type} of the variable
 * @return the generated {@link LoadInstruction}
 */
private static Instruction loadLocal(int index, Type type) {
    if (type == Type.BOOLEAN) {
       return new ILOAD(index);
    } else if (type == Type.INT) {
       return new ILOAD(index);
    } else if (type == Type.SHORT) {
       return new ILOAD(index);
    } else if (type == Type.LONG) {
       return new LLOAD(index);
    } else if (type == Type.BYTE) {
       return new ILOAD(index);
    } else if (type == Type.CHAR) {
       return new ILOAD(index);
    } else if (type == Type.FLOAT) {
       return new FLOAD(index);
    } else if (type == Type.DOUBLE) {
       return new DLOAD(index);
    } else {
       return new ALOAD(index);
    }
}
项目:openjdk-jdk10    文件:MethodGenerator.java   
/**
 * Helper method to generate an instance of a subclass of
 * {@link StoreInstruction} based on the specified {@link Type} that will
 * store a value in the specified local variable
 * @param index the JVM stack frame index of the variable that is to be
 * stored
 * @param type the {@link Type} of the variable
 * @return the generated {@link StoredInstruction}
 */
private static Instruction storeLocal(int index, Type type) {
    if (type == Type.BOOLEAN) {
       return new ISTORE(index);
    } else if (type == Type.INT) {
       return new ISTORE(index);
    } else if (type == Type.SHORT) {
       return new ISTORE(index);
    } else if (type == Type.LONG) {
       return new LSTORE(index);
    } else if (type == Type.BYTE) {
       return new ISTORE(index);
    } else if (type == Type.CHAR) {
       return new ISTORE(index);
    } else if (type == Type.FLOAT) {
       return new FSTORE(index);
    } else if (type == Type.DOUBLE) {
       return new DSTORE(index);
    } else {
       return new ASTORE(index);
    }
}
项目:openjdk-jdk10    文件:CompareGenerator.java   
public CompareGenerator(int access_flags, Type return_type,
                        Type[] arg_types, String[] arg_names,
                        String method_name, String class_name,
                        InstructionList il, ConstantPoolGen cp) {
    super(access_flags, return_type, arg_types, arg_names, method_name,
          class_name, il, cp);

    _iloadCurrent = new ILOAD(CURRENT_INDEX);
    _istoreCurrent = new ISTORE(CURRENT_INDEX);
    _aloadDom = new ALOAD(DOM_INDEX);
    _iloadLast = new ILOAD(LAST_INDEX);

    LocalVariableGen iterator =
        addLocalVariable("iterator",
                         Util.getJCRefType(Constants.NODE_ITERATOR_SIG),
                         null, null);
    ITERATOR_INDEX = iterator.getIndex();
    _aloadIterator = new ALOAD(ITERATOR_INDEX);
    _astoreIterator = new ASTORE(ITERATOR_INDEX);
    il.append(new ACONST_NULL());
    il.append(storeIterator());
}
项目:openjdk-jdk10    文件:BCELifier.java   
static String printType( final String signature ) {
    final Type type = Type.getType(signature);
    final byte t = type.getType();
    if (t <= Const.T_VOID) {
        return "Type." + Const.getTypeName(t).toUpperCase(Locale.ENGLISH);
    } else if (type.toString().equals("java.lang.String")) {
        return "Type.STRING";
    } else if (type.toString().equals("java.lang.Object")) {
        return "Type.OBJECT";
    } else if (type.toString().equals("java.lang.StringBuffer")) {
        return "Type.STRINGBUFFER";
    } else if (type instanceof ArrayType) {
        final ArrayType at = (ArrayType) type;
        return "new ArrayType(" + printType(at.getBasicType()) + ", " + at.getDimensions()
                + ")";
    } else {
        return "new ObjectType(\"" + Utility.signatureToString(signature, false) + "\")";
    }
}
项目:openjdk9    文件:MethodGenerator.java   
/**
 * Helper method to generate an instance of a subclass of
 * {@link LoadInstruction} based on the specified {@link Type} that will
 * load the specified local variable
 * @param index the JVM stack frame index of the variable that is to be
 * loaded
 * @param type the {@link Type} of the variable
 * @return the generated {@link LoadInstruction}
 */
private static Instruction loadLocal(int index, Type type) {
    if (type == Type.BOOLEAN) {
       return new ILOAD(index);
    } else if (type == Type.INT) {
       return new ILOAD(index);
    } else if (type == Type.SHORT) {
       return new ILOAD(index);
    } else if (type == Type.LONG) {
       return new LLOAD(index);
    } else if (type == Type.BYTE) {
       return new ILOAD(index);
    } else if (type == Type.CHAR) {
       return new ILOAD(index);
    } else if (type == Type.FLOAT) {
       return new FLOAD(index);
    } else if (type == Type.DOUBLE) {
       return new DLOAD(index);
    } else {
       return new ALOAD(index);
    }
}
项目:openjdk9    文件:MethodGenerator.java   
/**
 * Helper method to generate an instance of a subclass of
 * {@link StoreInstruction} based on the specified {@link Type} that will
 * store a value in the specified local variable
 * @param index the JVM stack frame index of the variable that is to be
 * stored
 * @param type the {@link Type} of the variable
 * @return the generated {@link StoredInstruction}
 */
private static Instruction storeLocal(int index, Type type) {
    if (type == Type.BOOLEAN) {
       return new ISTORE(index);
    } else if (type == Type.INT) {
       return new ISTORE(index);
    } else if (type == Type.SHORT) {
       return new ISTORE(index);
    } else if (type == Type.LONG) {
       return new LSTORE(index);
    } else if (type == Type.BYTE) {
       return new ISTORE(index);
    } else if (type == Type.CHAR) {
       return new ISTORE(index);
    } else if (type == Type.FLOAT) {
       return new FSTORE(index);
    } else if (type == Type.DOUBLE) {
       return new DSTORE(index);
    } else {
       return new ASTORE(index);
    }
}
项目:openjdk9    文件:CompareGenerator.java   
public CompareGenerator(int access_flags, Type return_type,
                        Type[] arg_types, String[] arg_names,
                        String method_name, String class_name,
                        InstructionList il, ConstantPoolGen cp) {
    super(access_flags, return_type, arg_types, arg_names, method_name,
          class_name, il, cp);

    _iloadCurrent = new ILOAD(CURRENT_INDEX);
    _istoreCurrent = new ISTORE(CURRENT_INDEX);
    _aloadDom = new ALOAD(DOM_INDEX);
    _iloadLast = new ILOAD(LAST_INDEX);

    LocalVariableGen iterator =
        addLocalVariable("iterator",
                         Util.getJCRefType(Constants.NODE_ITERATOR_SIG),
                         null, null);
    ITERATOR_INDEX = iterator.getIndex();
    _aloadIterator = new ALOAD(ITERATOR_INDEX);
    _astoreIterator = new ASTORE(ITERATOR_INDEX);
    il.append(new ACONST_NULL());
    il.append(storeIterator());
}
项目:lookaside_java-1.8.0-openjdk    文件:MethodGenerator.java   
/**
 * Helper method to generate an instance of a subclass of
 * {@link LoadInstruction} based on the specified {@link Type} that will
 * load the specified local variable
 * @param index the JVM stack frame index of the variable that is to be
 * loaded
 * @param type the {@link Type} of the variable
 * @return the generated {@link LoadInstruction}
 */
private static Instruction loadLocal(int index, Type type) {
    if (type == Type.BOOLEAN) {
       return new ILOAD(index);
    } else if (type == Type.INT) {
       return new ILOAD(index);
    } else if (type == Type.SHORT) {
       return new ILOAD(index);
    } else if (type == Type.LONG) {
       return new LLOAD(index);
    } else if (type == Type.BYTE) {
       return new ILOAD(index);
    } else if (type == Type.CHAR) {
       return new ILOAD(index);
    } else if (type == Type.FLOAT) {
       return new FLOAD(index);
    } else if (type == Type.DOUBLE) {
       return new DLOAD(index);
    } else {
       return new ALOAD(index);
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:MethodGenerator.java   
/**
 * Helper method to generate an instance of a subclass of
 * {@link StoreInstruction} based on the specified {@link Type} that will
 * store a value in the specified local variable
 * @param index the JVM stack frame index of the variable that is to be
 * stored
 * @param type the {@link Type} of the variable
 * @return the generated {@link StoredInstruction}
 */
private static Instruction storeLocal(int index, Type type) {
    if (type == Type.BOOLEAN) {
       return new ISTORE(index);
    } else if (type == Type.INT) {
       return new ISTORE(index);
    } else if (type == Type.SHORT) {
       return new ISTORE(index);
    } else if (type == Type.LONG) {
       return new LSTORE(index);
    } else if (type == Type.BYTE) {
       return new ISTORE(index);
    } else if (type == Type.CHAR) {
       return new ISTORE(index);
    } else if (type == Type.FLOAT) {
       return new FSTORE(index);
    } else if (type == Type.DOUBLE) {
       return new DSTORE(index);
    } else {
       return new ASTORE(index);
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:CompareGenerator.java   
public CompareGenerator(int access_flags, Type return_type,
                        Type[] arg_types, String[] arg_names,
                        String method_name, String class_name,
                        InstructionList il, ConstantPoolGen cp) {
    super(access_flags, return_type, arg_types, arg_names, method_name,
          class_name, il, cp);

    _iloadCurrent = new ILOAD(CURRENT_INDEX);
    _istoreCurrent = new ISTORE(CURRENT_INDEX);
    _aloadDom = new ALOAD(DOM_INDEX);
    _iloadLast = new ILOAD(LAST_INDEX);

    LocalVariableGen iterator =
        addLocalVariable("iterator",
                         Util.getJCRefType(Constants.NODE_ITERATOR_SIG),
                         null, null);
    ITERATOR_INDEX = iterator.getIndex();
    _aloadIterator = new ALOAD(ITERATOR_INDEX);
    _astoreIterator = new ASTORE(ITERATOR_INDEX);
    il.append(new ACONST_NULL());
    il.append(storeIterator());
}
项目:infobip-open-jdk-8    文件:MethodGenerator.java   
/**
 * Helper method to generate an instance of a subclass of
 * {@link LoadInstruction} based on the specified {@link Type} that will
 * load the specified local variable
 * @param index the JVM stack frame index of the variable that is to be
 * loaded
 * @param type the {@link Type} of the variable
 * @return the generated {@link LoadInstruction}
 */
private static Instruction loadLocal(int index, Type type) {
    if (type == Type.BOOLEAN) {
       return new ILOAD(index);
    } else if (type == Type.INT) {
       return new ILOAD(index);
    } else if (type == Type.SHORT) {
       return new ILOAD(index);
    } else if (type == Type.LONG) {
       return new LLOAD(index);
    } else if (type == Type.BYTE) {
       return new ILOAD(index);
    } else if (type == Type.CHAR) {
       return new ILOAD(index);
    } else if (type == Type.FLOAT) {
       return new FLOAD(index);
    } else if (type == Type.DOUBLE) {
       return new DLOAD(index);
    } else {
       return new ALOAD(index);
    }
}
项目:infobip-open-jdk-8    文件:MethodGenerator.java   
/**
 * Helper method to generate an instance of a subclass of
 * {@link StoreInstruction} based on the specified {@link Type} that will
 * store a value in the specified local variable
 * @param index the JVM stack frame index of the variable that is to be
 * stored
 * @param type the {@link Type} of the variable
 * @return the generated {@link StoredInstruction}
 */
private static Instruction storeLocal(int index, Type type) {
    if (type == Type.BOOLEAN) {
       return new ISTORE(index);
    } else if (type == Type.INT) {
       return new ISTORE(index);
    } else if (type == Type.SHORT) {
       return new ISTORE(index);
    } else if (type == Type.LONG) {
       return new LSTORE(index);
    } else if (type == Type.BYTE) {
       return new ISTORE(index);
    } else if (type == Type.CHAR) {
       return new ISTORE(index);
    } else if (type == Type.FLOAT) {
       return new FSTORE(index);
    } else if (type == Type.DOUBLE) {
       return new DSTORE(index);
    } else {
       return new ASTORE(index);
    }
}
项目:infobip-open-jdk-8    文件:CompareGenerator.java   
public CompareGenerator(int access_flags, Type return_type,
                        Type[] arg_types, String[] arg_names,
                        String method_name, String class_name,
                        InstructionList il, ConstantPoolGen cp) {
    super(access_flags, return_type, arg_types, arg_names, method_name,
          class_name, il, cp);

    _iloadCurrent = new ILOAD(CURRENT_INDEX);
    _istoreCurrent = new ISTORE(CURRENT_INDEX);
    _aloadDom = new ALOAD(DOM_INDEX);
    _iloadLast = new ILOAD(LAST_INDEX);

    LocalVariableGen iterator =
        addLocalVariable("iterator",
                         Util.getJCRefType(Constants.NODE_ITERATOR_SIG),
                         null, null);
    ITERATOR_INDEX = iterator.getIndex();
    _aloadIterator = new ALOAD(ITERATOR_INDEX);
    _astoreIterator = new ASTORE(ITERATOR_INDEX);
    il.append(new ACONST_NULL());
    il.append(storeIterator());
}
项目:OLD-OpenJDK8    文件:MethodGenerator.java   
/**
 * Helper method to generate an instance of a subclass of
 * {@link LoadInstruction} based on the specified {@link Type} that will
 * load the specified local variable
 * @param index the JVM stack frame index of the variable that is to be
 * loaded
 * @param type the {@link Type} of the variable
 * @return the generated {@link LoadInstruction}
 */
private static Instruction loadLocal(int index, Type type) {
    if (type == Type.BOOLEAN) {
       return new ILOAD(index);
    } else if (type == Type.INT) {
       return new ILOAD(index);
    } else if (type == Type.SHORT) {
       return new ILOAD(index);
    } else if (type == Type.LONG) {
       return new LLOAD(index);
    } else if (type == Type.BYTE) {
       return new ILOAD(index);
    } else if (type == Type.CHAR) {
       return new ILOAD(index);
    } else if (type == Type.FLOAT) {
       return new FLOAD(index);
    } else if (type == Type.DOUBLE) {
       return new DLOAD(index);
    } else {
       return new ALOAD(index);
    }
}
项目:OLD-OpenJDK8    文件:MethodGenerator.java   
/**
 * Helper method to generate an instance of a subclass of
 * {@link StoreInstruction} based on the specified {@link Type} that will
 * store a value in the specified local variable
 * @param index the JVM stack frame index of the variable that is to be
 * stored
 * @param type the {@link Type} of the variable
 * @return the generated {@link StoredInstruction}
 */
private static Instruction storeLocal(int index, Type type) {
    if (type == Type.BOOLEAN) {
       return new ISTORE(index);
    } else if (type == Type.INT) {
       return new ISTORE(index);
    } else if (type == Type.SHORT) {
       return new ISTORE(index);
    } else if (type == Type.LONG) {
       return new LSTORE(index);
    } else if (type == Type.BYTE) {
       return new ISTORE(index);
    } else if (type == Type.CHAR) {
       return new ISTORE(index);
    } else if (type == Type.FLOAT) {
       return new FSTORE(index);
    } else if (type == Type.DOUBLE) {
       return new DSTORE(index);
    } else {
       return new ASTORE(index);
    }
}
项目:OLD-OpenJDK8    文件:CompareGenerator.java   
public CompareGenerator(int access_flags, Type return_type,
                        Type[] arg_types, String[] arg_names,
                        String method_name, String class_name,
                        InstructionList il, ConstantPoolGen cp) {
    super(access_flags, return_type, arg_types, arg_names, method_name,
          class_name, il, cp);

    _iloadCurrent = new ILOAD(CURRENT_INDEX);
    _istoreCurrent = new ISTORE(CURRENT_INDEX);
    _aloadDom = new ALOAD(DOM_INDEX);
    _iloadLast = new ILOAD(LAST_INDEX);

    LocalVariableGen iterator =
        addLocalVariable("iterator",
                         Util.getJCRefType(Constants.NODE_ITERATOR_SIG),
                         null, null);
    ITERATOR_INDEX = iterator.getIndex();
    _aloadIterator = new ALOAD(ITERATOR_INDEX);
    _astoreIterator = new ASTORE(ITERATOR_INDEX);
    il.append(new ACONST_NULL());
    il.append(storeIterator());
}
项目:openjdk-icedtea7    文件:MethodGenerator.java   
/**
 * Helper method to generate an instance of a subclass of
 * {@link LoadInstruction} based on the specified {@link Type} that will
 * load the specified local variable
 * @param index the JVM stack frame index of the variable that is to be
 * loaded
 * @param type the {@link Type} of the variable
 * @return the generated {@link LoadInstruction}
 */
private static Instruction loadLocal(int index, Type type) {
    if (type == Type.BOOLEAN) {
       return new ILOAD(index);
    } else if (type == Type.INT) {
       return new ILOAD(index);
    } else if (type == Type.SHORT) {
       return new ILOAD(index);
    } else if (type == Type.LONG) {
       return new LLOAD(index);
    } else if (type == Type.BYTE) {
       return new ILOAD(index);
    } else if (type == Type.CHAR) {
       return new ILOAD(index);
    } else if (type == Type.FLOAT) {
       return new FLOAD(index);
    } else if (type == Type.DOUBLE) {
       return new DLOAD(index);
    } else {
       return new ALOAD(index);
    }
}
项目:openjdk-icedtea7    文件:MethodGenerator.java   
/**
 * Helper method to generate an instance of a subclass of
 * {@link StoreInstruction} based on the specified {@link Type} that will
 * store a value in the specified local variable
 * @param index the JVM stack frame index of the variable that is to be
 * stored
 * @param type the {@link Type} of the variable
 * @return the generated {@link StoredInstruction}
 */
private static Instruction storeLocal(int index, Type type) {
    if (type == Type.BOOLEAN) {
       return new ISTORE(index);
    } else if (type == Type.INT) {
       return new ISTORE(index);
    } else if (type == Type.SHORT) {
       return new ISTORE(index);
    } else if (type == Type.LONG) {
       return new LSTORE(index);
    } else if (type == Type.BYTE) {
       return new ISTORE(index);
    } else if (type == Type.CHAR) {
       return new ISTORE(index);
    } else if (type == Type.FLOAT) {
       return new FSTORE(index);
    } else if (type == Type.DOUBLE) {
       return new DSTORE(index);
    } else {
       return new ASTORE(index);
    }
}
项目:openjdk-icedtea7    文件:CompareGenerator.java   
public CompareGenerator(int access_flags, Type return_type,
                        Type[] arg_types, String[] arg_names,
                        String method_name, String class_name,
                        InstructionList il, ConstantPoolGen cp) {
    super(access_flags, return_type, arg_types, arg_names, method_name,
          class_name, il, cp);

    _iloadCurrent = new ILOAD(CURRENT_INDEX);
    _istoreCurrent = new ISTORE(CURRENT_INDEX);
    _aloadDom = new ALOAD(DOM_INDEX);
    _iloadLast = new ILOAD(LAST_INDEX);

    LocalVariableGen iterator =
        addLocalVariable("iterator",
                         Util.getJCRefType(Constants.NODE_ITERATOR_SIG),
                         null, null);
    ITERATOR_INDEX = iterator.getIndex();
    _aloadIterator = new ALOAD(ITERATOR_INDEX);
    _astoreIterator = new ASTORE(ITERATOR_INDEX);
    il.append(new ACONST_NULL());
    il.append(storeIterator());
}
项目:incubator-netbeans    文件:BytecodeTest.java   
public void visitField(Field obj) {
            if (obj.isStatic()) {
//                System.out.println("signature "+obj.getSignature());
                Type name = Type.getReturnType(obj.getSignature());
                if (pdType.equals(name) ||
                        bdType.equals(name) ||
                        mdType.equals(name) ||
                        edType.equals(name)) {
                    hasDescFields = true;
                }
            }
        }
项目:incubator-netbeans    文件:BytecodeTest.java   
@Override public void visitField(Field obj) {
            if (obj.isStatic()) {
//                System.out.println("signature "+obj.getSignature());
                Type name = Type.getReturnType(obj.getSignature());
                if (imageType.equals(name) ||
                        image1Type.equals(name) ||
                        image2Type.equals(name)) {
                    hasImageFields = true;
                }
                if (bType.equals(name) ||
                        b2Type.equals(name)) {
                    hasPropFields = true;
                }
            }
        }
项目:OpenJSharp    文件:AttributeSetMethodGenerator.java   
public AttributeSetMethodGenerator(String methodName, ClassGenerator classGen) {
     super(com.sun.org.apache.bcel.internal.Constants.ACC_PRIVATE,
           com.sun.org.apache.bcel.internal.generic.Type.VOID,
           argTypes, argNames, methodName,
           classGen.getClassName(),
           new InstructionList(),
           classGen.getConstantPool());
}
项目:OpenJSharp    文件:NamedMethodGenerator.java   
public NamedMethodGenerator(int access_flags, Type return_type,
                            Type[] arg_types, String[] arg_names,
                            String method_name, String class_name,
                            InstructionList il, ConstantPoolGen cp) {
    super(access_flags, return_type, arg_types, arg_names, method_name,
          class_name, il, cp);
}
项目:OpenJSharp    文件:MethodGenerator.java   
/**
 * Allocates a local variable. If the slot allocator has already been
 * initialized, then call addLocalVariable2() so that the new variable
 * is known to the allocator. Failing to do this may cause the allocator
 * to return a slot that is already in use.
 */
public LocalVariableGen addLocalVariable(String name, Type type,
                                         InstructionHandle start,
                                         InstructionHandle end)
{
    LocalVariableGen lvg;

    if (_allocatorInit) {
        lvg = addLocalVariable2(name, type, start);
    } else {
        lvg = super.addLocalVariable(name, type, start, end);
        getLocalVariableRegistry().registerLocalVariable(lvg);
    }
    return lvg;
}
项目:OpenJSharp    文件:MethodGenerator.java   
public LocalVariableGen addLocalVariable2(String name, Type type,
                                          InstructionHandle start)
{
    LocalVariableGen lvg = super.addLocalVariable(name, type,
                                          _slotAllocator.allocateSlot(type),
                                          start, null);
    getLocalVariableRegistry().registerLocalVariable(lvg);
    return lvg;
}
项目:OpenJSharp    文件:SlotAllocator.java   
public int allocateSlot(Type type) {
    final int size = type.getSize();
    final int limit = _free;
    int slot = _firstAvailableSlot, where = 0;

    if (_free + size > _size) {
        final int[] array = new int[_size *= 2];
        for (int j = 0; j < limit; j++)
            array[j] = _slotsTaken[j];
        _slotsTaken = array;
    }

    while (where < limit) {
        if (slot + size <= _slotsTaken[where]) {
            // insert
            for (int j = limit - 1; j >= where; j--)
                _slotsTaken[j + size] = _slotsTaken[j];
            break;
        }
        else {
            slot = _slotsTaken[where++] + 1;
        }
    }

    for (int j = 0; j < size; j++)
        _slotsTaken[where + j] = slot + j;

    _free += size;
    return slot;
}
项目:OpenJSharp    文件:RtMethodGenerator.java   
public RtMethodGenerator(int access_flags, Type return_type,
                         Type[] arg_types, String[] arg_names,
                         String method_name, String class_name,
                         InstructionList il, ConstantPoolGen cp) {
    super(access_flags, return_type, arg_types, arg_names, method_name,
          class_name, il, cp);

    _astoreHandler = new ASTORE(HANDLER_INDEX);
    _aloadHandler  = new ALOAD(HANDLER_INDEX);
}
项目:OpenJSharp    文件:MatchGenerator.java   
public MatchGenerator(int access_flags, Type return_type,
                      Type[] arg_types, String[] arg_names,
                      String method_name, String class_name,
                      InstructionList il, ConstantPoolGen cp) {
    super(access_flags, return_type, arg_types, arg_names, method_name,
          class_name, il, cp);

    _iloadCurrent = new ILOAD(CURRENT_INDEX);
    _istoreCurrent = new ISTORE(CURRENT_INDEX);
}
项目:OpenJSharp    文件:TestGenerator.java   
public TestGenerator(int access_flags, Type return_type,
                     Type[] arg_types, String[] arg_names,
                     String method_name, String class_name,
                     InstructionList il, ConstantPoolGen cp) {
    super(access_flags, return_type, arg_types, arg_names, method_name,
          class_name, il, cp);

    _iloadCurrent  = new ILOAD(CURRENT_NODE_INDEX);
    _istoreCurrent = new ISTORE(CURRENT_NODE_INDEX);
    _iloadContext  = new ILOAD(CONTEXT_NODE_INDEX);
    _istoreContext  = new ILOAD(CONTEXT_NODE_INDEX);
    _astoreIterator = new ASTORE(ITERATOR_INDEX);
    _aloadIterator  = new ALOAD(ITERATOR_INDEX);
}
项目:OpenJSharp    文件:JavaClass.java   
/**
 * @return A com.sun.org.apache.bcel.internal.classfile.Method corresponding to
 * java.lang.reflect.Method if any
 */
public Method getMethod(java.lang.reflect.Method m) {
  for(int i = 0; i < methods.length; i++) {
    Method method = methods[i];

    if(m.getName().equals(method.getName()) &&
       (m.getModifiers() == method.getModifiers()) &&
       Type.getSignature(m).equals(method.getSignature())) {
      return method;
    }
  }

  return null;
}
项目:openjdk-jdk10    文件:AttributeSetMethodGenerator.java   
public AttributeSetMethodGenerator(String methodName, ClassGenerator classGen) {
     super(com.sun.org.apache.bcel.internal.Const.ACC_PRIVATE,
           com.sun.org.apache.bcel.internal.generic.Type.VOID,
           argTypes, argNames, methodName,
           classGen.getClassName(),
           new InstructionList(),
           classGen.getConstantPool());
}
项目:openjdk-jdk10    文件:NamedMethodGenerator.java   
public NamedMethodGenerator(int access_flags, Type return_type,
                            Type[] arg_types, String[] arg_names,
                            String method_name, String class_name,
                            InstructionList il, ConstantPoolGen cp) {
    super(access_flags, return_type, arg_types, arg_names, method_name,
          class_name, il, cp);
}
项目:openjdk-jdk10    文件:MethodGenerator.java   
/**
 * Allocates a local variable. If the slot allocator has already been
 * initialized, then call addLocalVariable2() so that the new variable
 * is known to the allocator. Failing to do this may cause the allocator
 * to return a slot that is already in use.
 */
public LocalVariableGen addLocalVariable(String name, Type type,
                                         InstructionHandle start,
                                         InstructionHandle end)
{
    LocalVariableGen lvg;

    if (_allocatorInit) {
        lvg = addLocalVariable2(name, type, start);
    } else {
        lvg = super.addLocalVariable(name, type, start, end);
        getLocalVariableRegistry().registerLocalVariable(lvg);
    }
    return lvg;
}
项目:openjdk-jdk10    文件:MethodGenerator.java   
public LocalVariableGen addLocalVariable2(String name, Type type,
                                          InstructionHandle start)
{
    LocalVariableGen lvg = super.addLocalVariable(name, type,
                                          _slotAllocator.allocateSlot(type),
                                          start, null);
    getLocalVariableRegistry().registerLocalVariable(lvg);
    return lvg;
}
项目:openjdk-jdk10    文件:SlotAllocator.java   
public int allocateSlot(Type type) {
    final int size = type.getSize();
    final int limit = _free;
    int slot = _firstAvailableSlot, where = 0;

    if (_free + size > _size) {
        final int[] array = new int[_size *= 2];
        for (int j = 0; j < limit; j++)
            array[j] = _slotsTaken[j];
        _slotsTaken = array;
    }

    while (where < limit) {
        if (slot + size <= _slotsTaken[where]) {
            // insert
            for (int j = limit - 1; j >= where; j--)
                _slotsTaken[j + size] = _slotsTaken[j];
            break;
        }
        else {
            slot = _slotsTaken[where++] + 1;
        }
    }

    for (int j = 0; j < size; j++)
        _slotsTaken[where + j] = slot + j;

    _free += size;
    return slot;
}
项目:openjdk-jdk10    文件:RtMethodGenerator.java   
public RtMethodGenerator(int access_flags, Type return_type,
                         Type[] arg_types, String[] arg_names,
                         String method_name, String class_name,
                         InstructionList il, ConstantPoolGen cp) {
    super(access_flags, return_type, arg_types, arg_names, method_name,
          class_name, il, cp);

    _astoreHandler = new ASTORE(HANDLER_INDEX);
    _aloadHandler  = new ALOAD(HANDLER_INDEX);
}
项目:openjdk-jdk10    文件:MatchGenerator.java   
public MatchGenerator(int access_flags, Type return_type,
                      Type[] arg_types, String[] arg_names,
                      String method_name, String class_name,
                      InstructionList il, ConstantPoolGen cp) {
    super(access_flags, return_type, arg_types, arg_names, method_name,
          class_name, il, cp);

    _iloadCurrent = new ILOAD(CURRENT_INDEX);
    _istoreCurrent = new ISTORE(CURRENT_INDEX);
}