Class MLdcInsn
- java.lang.Object
-
- xyz.cofe.trambda.bc.mth.MAbstractBC
-
- xyz.cofe.trambda.bc.mth.MLdcInsn
-
- All Implemented Interfaces:
Serializable,xyz.cofe.collection.ImTree<ByteCode>,xyz.cofe.collection.ImTreeWalk<ByteCode>,ByteCode,MethodByteCode,MethodWriter
public class MLdcInsn extends MAbstractBC implements MethodWriter
Push item from run-time constant poolОписание
The index is an unsigned byte that must be a valid index into the run-time constant pool of the current class (§2.6). The run-time constant pool entry at index either must be a run-time constant of type int or float, or a reference to a string literal, or a symbolic reference to a class, method type, or method handle (§5.1).
If the run-time constant pool entry is a run-time constant of type int or float, the numeric value of that run-time constant is pushed onto the operand stack as an int or float, respectively.
Otherwise, if the run-time constant pool entry is a reference to an instance of class String representing a string literal (§5.1), then a reference to that instance, value, is pushed onto the operand stack.
Otherwise, if the run-time constant pool entry is a symbolic reference to a class (§5.1), then the named class is resolved (§5.4.3.1) and a reference to the Class object representing that class, value, is pushed onto the operand stack.
Otherwise, the run-time constant pool entry must be a symbolic reference to a method type or a method handle (§5.1). The method type or method handle is resolved (§5.4.3.5) and a reference to the resulting instance of java.lang.invoke.MethodType or java.lang.invoke.MethodHandle, value, is pushed onto the operand stack.
Индекс - это беззнаковый байт(или слово), который должен быть допустимым индексом в пуле констант времени выполнения текущего класса (§2.6). Запись пула констант времени выполнения по индексу должна быть либо константой времени выполнения типа int или float, либо ссылкой на строковый литерал, либо символьной ссылкой на класс, тип метода или дескриптор метода (§5.1).Если запись пула констант времени выполнения является константой времени выполнения типа int или float, числовое значение этой константы времени выполнения помещается в стек операндов как int или float соответственно.
В противном случае, если запись пула констант времени выполнения является ссылкой на экземпляр класса String, представляющий строковый литерал (§5.1), то ссылка на этот экземпляр value помещается в стек операндов.
В противном случае, если запись пула констант времени выполнения является символической ссылкой на класс (§5.1), то именованный класс разрешается (§5.4.3.1) и ссылка на объект Class, представляющий этот класс, значение, помещается в стек операндов.
В противном случае запись пула констант времени выполнения должна быть символьной ссылкой на тип метода или дескриптор метода (§5.1). Тип метода или дескриптор метода разрешается (§5.4.3.5), и ссылка на результирующий экземпляр java.lang.invoke.MethodType или java.lang.invoke.MethodHandle, value, помещается в стек операндов.
LDC instruction. Note that new constant types may be added in future versions of the Java Virtual Machine. To easily detect new constant types, implementations of this method should check for unexpected constant types, like this:if (cst instanceof Integer) { // ...LdcType.Integer} else if (cst instanceof Float) { // ...LdcType.Float} else if (cst instanceof Long) { // ...LdcType.Long} else if (cst instanceof Double) { // ...LdcType.Double} else if (cst instanceof String) { // ...LdcType.String} else if (cst instanceof org.objectweb.asm.Type) { int sort = ((org.objectweb.asm.Type) cst).getSort(); if (sort == org.objectweb.asm.Type.OBJECT) { // ...LdcType.Object} else if (sort == org.objectweb.asm.Type.ARRAY) { // ...LdcType.Array} else if (sort == org.objectweb.asm.Type.METHOD) { // ...LdcType.Method} else { // throw an exception } } else if (cst instanceof Handle) { // ...LdcType.Handle} else if (cst instanceof ConstantDynamic) { // ...LdcType.ConstantDynamic} else { // throw an exception }- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MLdcInsnclone()LdcTypegetLdcType()ObjectgetValue()voidsetLdcType(LdcType ldcType)voidsetValue(Object value)StringtoString()voidwrite(org.objectweb.asm.MethodVisitor v, MethodWriterCtx ctx)
-
-
-
Method Detail
-
clone
public MLdcInsn clone()
- Specified by:
clonein interfaceMethodByteCode- Specified by:
clonein classMAbstractBC
-
getLdcType
public LdcType getLdcType()
-
setLdcType
public void setLdcType(LdcType ldcType)
-
getValue
public Object getValue()
-
setValue
public void setValue(Object value)
-
write
public void write(org.objectweb.asm.MethodVisitor v, MethodWriterCtx ctx)- Specified by:
writein interfaceMethodWriter
-
-