Java Code Examples for jdk.internal.org.objectweb.asm.Type#BYTE
The following examples show how to use
jdk.internal.org.objectweb.asm.Type#BYTE .
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: GeneratorAdapter.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
private static Type getBoxedType(final Type type) { switch (type.getSort()) { case Type.BYTE: return BYTE_TYPE; case Type.BOOLEAN: return BOOLEAN_TYPE; case Type.SHORT: return SHORT_TYPE; case Type.CHAR: return CHARACTER_TYPE; case Type.INT: return INTEGER_TYPE; case Type.FLOAT: return FLOAT_TYPE; case Type.LONG: return LONG_TYPE; case Type.DOUBLE: return DOUBLE_TYPE; } return type; }
Example 2
Source File: GeneratorAdapter.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
private static Type getBoxedType(final Type type) { switch (type.getSort()) { case Type.BYTE: return BYTE_TYPE; case Type.BOOLEAN: return BOOLEAN_TYPE; case Type.SHORT: return SHORT_TYPE; case Type.CHAR: return CHARACTER_TYPE; case Type.INT: return INTEGER_TYPE; case Type.FLOAT: return FLOAT_TYPE; case Type.LONG: return LONG_TYPE; case Type.DOUBLE: return DOUBLE_TYPE; } return type; }
Example 3
Source File: GeneratorAdapter.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
private static Type getBoxedType(final Type type) { switch (type.getSort()) { case Type.BYTE: return BYTE_TYPE; case Type.BOOLEAN: return BOOLEAN_TYPE; case Type.SHORT: return SHORT_TYPE; case Type.CHAR: return CHARACTER_TYPE; case Type.INT: return INTEGER_TYPE; case Type.FLOAT: return FLOAT_TYPE; case Type.LONG: return LONG_TYPE; case Type.DOUBLE: return DOUBLE_TYPE; } return type; }
Example 4
Source File: SimpleVerifier.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
@Override public BasicValue newValue(final Type type) { if (type == null) { return BasicValue.UNINITIALIZED_VALUE; } boolean isArray = type.getSort() == Type.ARRAY; if (isArray) { switch (type.getElementType().getSort()) { case Type.BOOLEAN: case Type.CHAR: case Type.BYTE: case Type.SHORT: return new BasicValue(type); } } BasicValue v = super.newValue(type); if (BasicValue.REFERENCE_VALUE.equals(v)) { if (isArray) { v = newValue(type.getElementType()); String desc = v.getType().getDescriptor(); for (int i = 0; i < type.getDimensions(); ++i) { desc = '[' + desc; } v = new BasicValue(Type.getType(desc)); } else { v = new BasicValue(type); } } return v; }
Example 5
Source File: InstructionAdapter.java From nashorn with GNU General Public License v2.0 | 5 votes |
public void newarray(final Type type) { int typ; switch (type.getSort()) { case Type.BOOLEAN: typ = Opcodes.T_BOOLEAN; break; case Type.CHAR: typ = Opcodes.T_CHAR; break; case Type.BYTE: typ = Opcodes.T_BYTE; break; case Type.SHORT: typ = Opcodes.T_SHORT; break; case Type.INT: typ = Opcodes.T_INT; break; case Type.FLOAT: typ = Opcodes.T_FLOAT; break; case Type.LONG: typ = Opcodes.T_LONG; break; case Type.DOUBLE: typ = Opcodes.T_DOUBLE; break; default: mv.visitTypeInsn(Opcodes.ANEWARRAY, type.getInternalName()); return; } mv.visitIntInsn(Opcodes.NEWARRAY, typ); }
Example 6
Source File: GeneratorAdapter.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
/** * Generates the instruction to create a new array. * * @param type * the type of the array elements. */ public void newArray(final Type type) { int typ; switch (type.getSort()) { case Type.BOOLEAN: typ = Opcodes.T_BOOLEAN; break; case Type.CHAR: typ = Opcodes.T_CHAR; break; case Type.BYTE: typ = Opcodes.T_BYTE; break; case Type.SHORT: typ = Opcodes.T_SHORT; break; case Type.INT: typ = Opcodes.T_INT; break; case Type.FLOAT: typ = Opcodes.T_FLOAT; break; case Type.LONG: typ = Opcodes.T_LONG; break; case Type.DOUBLE: typ = Opcodes.T_DOUBLE; break; default: typeInsn(Opcodes.ANEWARRAY, type); return; } mv.visitIntInsn(Opcodes.NEWARRAY, typ); }
Example 7
Source File: InstructionAdapter.java From hottub with GNU General Public License v2.0 | 5 votes |
public void newarray(final Type type) { int typ; switch (type.getSort()) { case Type.BOOLEAN: typ = Opcodes.T_BOOLEAN; break; case Type.CHAR: typ = Opcodes.T_CHAR; break; case Type.BYTE: typ = Opcodes.T_BYTE; break; case Type.SHORT: typ = Opcodes.T_SHORT; break; case Type.INT: typ = Opcodes.T_INT; break; case Type.FLOAT: typ = Opcodes.T_FLOAT; break; case Type.LONG: typ = Opcodes.T_LONG; break; case Type.DOUBLE: typ = Opcodes.T_DOUBLE; break; default: mv.visitTypeInsn(Opcodes.ANEWARRAY, type.getInternalName()); return; } mv.visitIntInsn(Opcodes.NEWARRAY, typ); }
Example 8
Source File: GeneratorAdapter.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Generates the instruction to create a new array. * * @param type * the type of the array elements. */ public void newArray(final Type type) { int typ; switch (type.getSort()) { case Type.BOOLEAN: typ = Opcodes.T_BOOLEAN; break; case Type.CHAR: typ = Opcodes.T_CHAR; break; case Type.BYTE: typ = Opcodes.T_BYTE; break; case Type.SHORT: typ = Opcodes.T_SHORT; break; case Type.INT: typ = Opcodes.T_INT; break; case Type.FLOAT: typ = Opcodes.T_FLOAT; break; case Type.LONG: typ = Opcodes.T_LONG; break; case Type.DOUBLE: typ = Opcodes.T_DOUBLE; break; default: typeInsn(Opcodes.ANEWARRAY, type); return; } mv.visitIntInsn(Opcodes.NEWARRAY, typ); }
Example 9
Source File: BasicInterpreter.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
@Override public BasicValue newValue(final Type type) { if (type == null) { return BasicValue.UNINITIALIZED_VALUE; } switch (type.getSort()) { case Type.VOID: return null; case Type.BOOLEAN: case Type.CHAR: case Type.BYTE: case Type.SHORT: case Type.INT: return BasicValue.INT_VALUE; case Type.FLOAT: return BasicValue.FLOAT_VALUE; case Type.LONG: return BasicValue.LONG_VALUE; case Type.DOUBLE: return BasicValue.DOUBLE_VALUE; case Type.ARRAY: case Type.OBJECT: return BasicValue.REFERENCE_VALUE; default: throw new Error("Internal error"); } }
Example 10
Source File: BasicInterpreter.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
@Override public BasicValue newValue(final Type type) { if (type == null) { return BasicValue.UNINITIALIZED_VALUE; } switch (type.getSort()) { case Type.VOID: return null; case Type.BOOLEAN: case Type.CHAR: case Type.BYTE: case Type.SHORT: case Type.INT: return BasicValue.INT_VALUE; case Type.FLOAT: return BasicValue.FLOAT_VALUE; case Type.LONG: return BasicValue.LONG_VALUE; case Type.DOUBLE: return BasicValue.DOUBLE_VALUE; case Type.ARRAY: case Type.OBJECT: return BasicValue.REFERENCE_VALUE; default: throw new Error("Internal error"); } }
Example 11
Source File: LocalVariablesSorter.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
/** * Creates a new local variable of the given type. * * @param type * the type of the local variable to be created. * @return the identifier of the newly created local variable. */ public int newLocal(final Type type) { Object t; switch (type.getSort()) { case Type.BOOLEAN: case Type.CHAR: case Type.BYTE: case Type.SHORT: case Type.INT: t = Opcodes.INTEGER; break; case Type.FLOAT: t = Opcodes.FLOAT; break; case Type.LONG: t = Opcodes.LONG; break; case Type.DOUBLE: t = Opcodes.DOUBLE; break; case Type.ARRAY: t = type.getDescriptor(); break; // case Type.OBJECT: default: t = type.getInternalName(); break; } int local = newLocalMapping(type); setLocalType(local, type); setFrameLocal(local, t); changed = true; return local; }
Example 12
Source File: GeneratorAdapter.java From nashorn with GNU General Public License v2.0 | 5 votes |
/** * Generates the instruction to create a new array. * * @param type the type of the array elements. */ public void newArray(final Type type) { int typ; switch (type.getSort()) { case Type.BOOLEAN: typ = Opcodes.T_BOOLEAN; break; case Type.CHAR: typ = Opcodes.T_CHAR; break; case Type.BYTE: typ = Opcodes.T_BYTE; break; case Type.SHORT: typ = Opcodes.T_SHORT; break; case Type.INT: typ = Opcodes.T_INT; break; case Type.FLOAT: typ = Opcodes.T_FLOAT; break; case Type.LONG: typ = Opcodes.T_LONG; break; case Type.DOUBLE: typ = Opcodes.T_DOUBLE; break; default: typeInsn(Opcodes.ANEWARRAY, type); return; } mv.visitIntInsn(Opcodes.NEWARRAY, typ); }
Example 13
Source File: BasicInterpreter.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
@Override public BasicValue newValue(final Type type) { if (type == null) { return BasicValue.UNINITIALIZED_VALUE; } switch (type.getSort()) { case Type.VOID: return null; case Type.BOOLEAN: case Type.CHAR: case Type.BYTE: case Type.SHORT: case Type.INT: return BasicValue.INT_VALUE; case Type.FLOAT: return BasicValue.FLOAT_VALUE; case Type.LONG: return BasicValue.LONG_VALUE; case Type.DOUBLE: return BasicValue.DOUBLE_VALUE; case Type.ARRAY: case Type.OBJECT: return BasicValue.REFERENCE_VALUE; default: throw new Error("Internal error"); } }
Example 14
Source File: AnalyzerAdapter.java From nashorn with GNU General Public License v2.0 | 4 votes |
/** * Creates a new {@link AnalyzerAdapter}. * * @param api the ASM API version implemented by this visitor. Must be one * of {@link Opcodes#ASM4}. * @param owner the owner's class name. * @param access the method's access flags (see {@link Opcodes}). * @param name the method's name. * @param desc the method's descriptor (see {@link Type Type}). * @param mv the method visitor to which this adapter delegates calls. May * be <tt>null</tt>. */ protected AnalyzerAdapter( final int api, final String owner, final int access, final String name, final String desc, final MethodVisitor mv) { super(api, mv); this.owner = owner; locals = new ArrayList<Object>(); stack = new ArrayList<Object>(); uninitializedTypes = new HashMap<Object, Object>(); if ((access & Opcodes.ACC_STATIC) == 0) { if ("<init>".equals(name)) { locals.add(Opcodes.UNINITIALIZED_THIS); } else { locals.add(owner); } } Type[] types = Type.getArgumentTypes(desc); for (int i = 0; i < types.length; ++i) { Type type = types[i]; switch (type.getSort()) { case Type.BOOLEAN: case Type.CHAR: case Type.BYTE: case Type.SHORT: case Type.INT: locals.add(Opcodes.INTEGER); break; case Type.FLOAT: locals.add(Opcodes.FLOAT); break; case Type.LONG: locals.add(Opcodes.LONG); locals.add(Opcodes.TOP); break; case Type.DOUBLE: locals.add(Opcodes.DOUBLE); locals.add(Opcodes.TOP); break; case Type.ARRAY: locals.add(types[i].getDescriptor()); break; // case Type.OBJECT: default: locals.add(types[i].getInternalName()); } } }
Example 15
Source File: AnalyzerAdapter.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
/** * Creates a new {@link AnalyzerAdapter}. * * @param api * the ASM API version implemented by this visitor. Must be one * of {@link Opcodes#ASM4} or {@link Opcodes#ASM5}. * @param owner * the owner's class name. * @param access * the method's access flags (see {@link Opcodes}). * @param name * the method's name. * @param desc * the method's descriptor (see {@link Type Type}). * @param mv * the method visitor to which this adapter delegates calls. May * be <tt>null</tt>. */ protected AnalyzerAdapter(final int api, final String owner, final int access, final String name, final String desc, final MethodVisitor mv) { super(api, mv); this.owner = owner; locals = new ArrayList<Object>(); stack = new ArrayList<Object>(); uninitializedTypes = new HashMap<Object, Object>(); if ((access & Opcodes.ACC_STATIC) == 0) { if ("<init>".equals(name)) { locals.add(Opcodes.UNINITIALIZED_THIS); } else { locals.add(owner); } } Type[] types = Type.getArgumentTypes(desc); for (int i = 0; i < types.length; ++i) { Type type = types[i]; switch (type.getSort()) { case Type.BOOLEAN: case Type.CHAR: case Type.BYTE: case Type.SHORT: case Type.INT: locals.add(Opcodes.INTEGER); break; case Type.FLOAT: locals.add(Opcodes.FLOAT); break; case Type.LONG: locals.add(Opcodes.LONG); locals.add(Opcodes.TOP); break; case Type.DOUBLE: locals.add(Opcodes.DOUBLE); locals.add(Opcodes.TOP); break; case Type.ARRAY: locals.add(types[i].getDescriptor()); break; // case Type.OBJECT: default: locals.add(types[i].getInternalName()); } } maxLocals = locals.size(); }
Example 16
Source File: GeneratorAdapter.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
/** * Generates the instruction to push the given value on the stack. * * @param value * the value to be pushed on the stack. */ public void push(final Type value) { if (value == null) { mv.visitInsn(Opcodes.ACONST_NULL); } else { switch (value.getSort()) { case Type.BOOLEAN: mv.visitFieldInsn(Opcodes.GETSTATIC, "java/lang/Boolean", "TYPE", CLDESC); break; case Type.CHAR: mv.visitFieldInsn(Opcodes.GETSTATIC, "java/lang/Character", "TYPE", CLDESC); break; case Type.BYTE: mv.visitFieldInsn(Opcodes.GETSTATIC, "java/lang/Byte", "TYPE", CLDESC); break; case Type.SHORT: mv.visitFieldInsn(Opcodes.GETSTATIC, "java/lang/Short", "TYPE", CLDESC); break; case Type.INT: mv.visitFieldInsn(Opcodes.GETSTATIC, "java/lang/Integer", "TYPE", CLDESC); break; case Type.FLOAT: mv.visitFieldInsn(Opcodes.GETSTATIC, "java/lang/Float", "TYPE", CLDESC); break; case Type.LONG: mv.visitFieldInsn(Opcodes.GETSTATIC, "java/lang/Long", "TYPE", CLDESC); break; case Type.DOUBLE: mv.visitFieldInsn(Opcodes.GETSTATIC, "java/lang/Double", "TYPE", CLDESC); break; default: mv.visitLdcInsn(value); } } }
Example 17
Source File: GeneratorAdapter.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
/** * Generates the instruction to push the given value on the stack. * * @param value * the value to be pushed on the stack. */ public void push(final Type value) { if (value == null) { mv.visitInsn(Opcodes.ACONST_NULL); } else { switch (value.getSort()) { case Type.BOOLEAN: mv.visitFieldInsn(Opcodes.GETSTATIC, "java/lang/Boolean", "TYPE", CLDESC); break; case Type.CHAR: mv.visitFieldInsn(Opcodes.GETSTATIC, "java/lang/Character", "TYPE", CLDESC); break; case Type.BYTE: mv.visitFieldInsn(Opcodes.GETSTATIC, "java/lang/Byte", "TYPE", CLDESC); break; case Type.SHORT: mv.visitFieldInsn(Opcodes.GETSTATIC, "java/lang/Short", "TYPE", CLDESC); break; case Type.INT: mv.visitFieldInsn(Opcodes.GETSTATIC, "java/lang/Integer", "TYPE", CLDESC); break; case Type.FLOAT: mv.visitFieldInsn(Opcodes.GETSTATIC, "java/lang/Float", "TYPE", CLDESC); break; case Type.LONG: mv.visitFieldInsn(Opcodes.GETSTATIC, "java/lang/Long", "TYPE", CLDESC); break; case Type.DOUBLE: mv.visitFieldInsn(Opcodes.GETSTATIC, "java/lang/Double", "TYPE", CLDESC); break; default: mv.visitLdcInsn(value); } } }
Example 18
Source File: GeneratorAdapter.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
/** * Generates the instruction to push the given value on the stack. * * @param value * the value to be pushed on the stack. */ public void push(final Type value) { if (value == null) { mv.visitInsn(Opcodes.ACONST_NULL); } else { switch (value.getSort()) { case Type.BOOLEAN: mv.visitFieldInsn(Opcodes.GETSTATIC, "java/lang/Boolean", "TYPE", CLDESC); break; case Type.CHAR: mv.visitFieldInsn(Opcodes.GETSTATIC, "java/lang/Character", "TYPE", CLDESC); break; case Type.BYTE: mv.visitFieldInsn(Opcodes.GETSTATIC, "java/lang/Byte", "TYPE", CLDESC); break; case Type.SHORT: mv.visitFieldInsn(Opcodes.GETSTATIC, "java/lang/Short", "TYPE", CLDESC); break; case Type.INT: mv.visitFieldInsn(Opcodes.GETSTATIC, "java/lang/Integer", "TYPE", CLDESC); break; case Type.FLOAT: mv.visitFieldInsn(Opcodes.GETSTATIC, "java/lang/Float", "TYPE", CLDESC); break; case Type.LONG: mv.visitFieldInsn(Opcodes.GETSTATIC, "java/lang/Long", "TYPE", CLDESC); break; case Type.DOUBLE: mv.visitFieldInsn(Opcodes.GETSTATIC, "java/lang/Double", "TYPE", CLDESC); break; default: mv.visitLdcInsn(value); } } }
Example 19
Source File: GeneratorAdapter.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
/** * Generates the instruction to push the given value on the stack. * * @param value * the value to be pushed on the stack. */ public void push(final Type value) { if (value == null) { mv.visitInsn(Opcodes.ACONST_NULL); } else { switch (value.getSort()) { case Type.BOOLEAN: mv.visitFieldInsn(Opcodes.GETSTATIC, "java/lang/Boolean", "TYPE", CLDESC); break; case Type.CHAR: mv.visitFieldInsn(Opcodes.GETSTATIC, "java/lang/Character", "TYPE", CLDESC); break; case Type.BYTE: mv.visitFieldInsn(Opcodes.GETSTATIC, "java/lang/Byte", "TYPE", CLDESC); break; case Type.SHORT: mv.visitFieldInsn(Opcodes.GETSTATIC, "java/lang/Short", "TYPE", CLDESC); break; case Type.INT: mv.visitFieldInsn(Opcodes.GETSTATIC, "java/lang/Integer", "TYPE", CLDESC); break; case Type.FLOAT: mv.visitFieldInsn(Opcodes.GETSTATIC, "java/lang/Float", "TYPE", CLDESC); break; case Type.LONG: mv.visitFieldInsn(Opcodes.GETSTATIC, "java/lang/Long", "TYPE", CLDESC); break; case Type.DOUBLE: mv.visitFieldInsn(Opcodes.GETSTATIC, "java/lang/Double", "TYPE", CLDESC); break; default: mv.visitLdcInsn(value); } } }
Example 20
Source File: AnalyzerAdapter.java From Bytecoder with Apache License 2.0 | 4 votes |
/** * Constructs a new {@link AnalyzerAdapter}. * * @param api the ASM API version implemented by this visitor. Must be one of {@link * Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6} or {@link Opcodes#ASM7}. * @param owner the owner's class name. * @param access the method's access flags (see {@link Opcodes}). * @param name the method's name. * @param descriptor the method's descriptor (see {@link Type}). * @param methodVisitor the method visitor to which this adapter delegates calls. May be {@literal * null}. */ protected AnalyzerAdapter( final int api, final String owner, final int access, final String name, final String descriptor, final MethodVisitor methodVisitor) { super(api, methodVisitor); this.owner = owner; locals = new ArrayList<Object>(); stack = new ArrayList<Object>(); uninitializedTypes = new HashMap<Object, Object>(); if ((access & Opcodes.ACC_STATIC) == 0) { if ("<init>".equals(name)) { locals.add(Opcodes.UNINITIALIZED_THIS); } else { locals.add(owner); } } for (Type argumentType : Type.getArgumentTypes(descriptor)) { switch (argumentType.getSort()) { case Type.BOOLEAN: case Type.CHAR: case Type.BYTE: case Type.SHORT: case Type.INT: locals.add(Opcodes.INTEGER); break; case Type.FLOAT: locals.add(Opcodes.FLOAT); break; case Type.LONG: locals.add(Opcodes.LONG); locals.add(Opcodes.TOP); break; case Type.DOUBLE: locals.add(Opcodes.DOUBLE); locals.add(Opcodes.TOP); break; case Type.ARRAY: locals.add(argumentType.getDescriptor()); break; case Type.OBJECT: locals.add(argumentType.getInternalName()); break; default: throw new AssertionError(); } } maxLocals = locals.size(); }