com.sun.org.apache.bcel.internal.generic.Type Java Examples
The following examples show how to use
com.sun.org.apache.bcel.internal.generic.Type.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MethodGenerator.java From Bytecoder with Apache License 2.0 | 6 votes |
/** * 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); } }
Example #2
Source File: MethodGenerator.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * 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); } }
Example #3
Source File: MethodGenerator.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * 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); } }
Example #4
Source File: MethodGenerator.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * 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); } }
Example #5
Source File: MethodGenerator.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
/** * 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); } }
Example #6
Source File: MethodGenerator.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
/** * 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); } }
Example #7
Source File: CompareGenerator.java From hottub with GNU General Public License v2.0 | 6 votes |
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()); }
Example #8
Source File: MethodGenerator.java From JDKSourceCode1.8 with MIT License | 6 votes |
/** * 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); } }
Example #9
Source File: MethodGenerator.java From Bytecoder with Apache License 2.0 | 6 votes |
/** * 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); } }
Example #10
Source File: CompareGenerator.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
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()); }
Example #11
Source File: MethodGenerator.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * 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); } }
Example #12
Source File: JavaClass.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * @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; }
Example #13
Source File: MatchGenerator.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
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); }
Example #14
Source File: SlotAllocator.java From Bytecoder with Apache License 2.0 | 5 votes |
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; }
Example #15
Source File: TestGenerator.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
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); }
Example #16
Source File: BCELFactory.java From Bytecoder with Apache License 2.0 | 5 votes |
@Override public void visitArrayInstruction( final ArrayInstruction i ) { final short opcode = i.getOpcode(); final Type type = i.getType(_cp); final String kind = (opcode < Const.IASTORE) ? "Load" : "Store"; _out.println("il.append(_factory.createArray" + kind + "(" + BCELifier.printType(type) + "));"); }
Example #17
Source File: MethodGenerator.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * 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; }
Example #18
Source File: NamedMethodGenerator.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
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); }
Example #19
Source File: MatchGenerator.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
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); }
Example #20
Source File: BytecodeTest.java From netbeans with Apache License 2.0 | 5 votes |
@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; } } }
Example #21
Source File: SlotAllocator.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
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; }
Example #22
Source File: TestGenerator.java From hottub with GNU General Public License v2.0 | 5 votes |
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); }
Example #23
Source File: SlotAllocator.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
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; }
Example #24
Source File: AttributeSetMethodGenerator.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
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()); }
Example #25
Source File: TestGenerator.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
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); }
Example #26
Source File: MatchGenerator.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
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); }
Example #27
Source File: MatchGenerator.java From hottub with GNU General Public License v2.0 | 5 votes |
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); }
Example #28
Source File: AttributeSetMethodGenerator.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
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()); }
Example #29
Source File: NamedMethodGenerator.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
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); }
Example #30
Source File: BCELFactory.java From Bytecoder with Apache License 2.0 | 5 votes |
@Override public void visitFieldInstruction( final FieldInstruction i ) { final short opcode = i.getOpcode(); final String class_name = i.getReferenceType(_cp).getSignature(); final String field_name = i.getFieldName(_cp); final Type type = i.getFieldType(_cp); _out.println("il.append(_factory.createFieldAccess(\"" + class_name + "\", \"" + field_name + "\", " + BCELifier.printType(type) + ", " + CONSTANT_PREFIX + Const.getOpcodeName(opcode).toUpperCase(Locale.ENGLISH) + "));"); }