< prev index next >

src/java.base/share/classes/jdk/internal/org/objectweb/asm/Item.java

Print this page
rev 47452 : imported patch jdk-new-asmv6.patch


  63  * methods in the {@link ClassWriter} class.
  64  *
  65  * @author Eric Bruneton
  66  */
  67 final class Item {
  68 
  69     /**
  70      * Index of this item in the constant pool.
  71      */
  72     int index;
  73 
  74     /**
  75      * Type of this constant pool item. A single class is used to represent all
  76      * constant pool item types, in order to minimize the bytecode size of this
  77      * package. The value of this field is one of {@link ClassWriter#INT},
  78      * {@link ClassWriter#LONG}, {@link ClassWriter#FLOAT},
  79      * {@link ClassWriter#DOUBLE}, {@link ClassWriter#UTF8},
  80      * {@link ClassWriter#STR}, {@link ClassWriter#CLASS},
  81      * {@link ClassWriter#NAME_TYPE}, {@link ClassWriter#FIELD},
  82      * {@link ClassWriter#METH}, {@link ClassWriter#IMETH},

  83      * {@link ClassWriter#MTYPE}, {@link ClassWriter#INDY}.
  84      *
  85      * MethodHandle constant 9 variations are stored using a range of 9 values
  86      * from {@link ClassWriter#HANDLE_BASE} + 1 to
  87      * {@link ClassWriter#HANDLE_BASE} + 9.
  88      *
  89      * Special Item types are used for Items that are stored in the ClassWriter
  90      * {@link ClassWriter#typeTable}, instead of the constant pool, in order to
  91      * avoid clashes with normal constant pool items in the ClassWriter constant
  92      * pool's hash table. These special item types are
  93      * {@link ClassWriter#TYPE_NORMAL}, {@link ClassWriter#TYPE_UNINIT} and
  94      * {@link ClassWriter#TYPE_MERGED}.
  95      */
  96     int type;
  97 
  98     /**
  99      * Value of this item, for an integer item.
 100      */
 101     int intVal;
 102 


 222      * Sets this item to an item that do not hold a primitive value.
 223      *
 224      * @param type
 225      *            the type of this item.
 226      * @param strVal1
 227      *            first part of the value of this item.
 228      * @param strVal2
 229      *            second part of the value of this item.
 230      * @param strVal3
 231      *            third part of the value of this item.
 232      */
 233     @SuppressWarnings("fallthrough")
 234     void set(final int type, final String strVal1, final String strVal2,
 235             final String strVal3) {
 236         this.type = type;
 237         this.strVal1 = strVal1;
 238         this.strVal2 = strVal2;
 239         this.strVal3 = strVal3;
 240         switch (type) {
 241         case ClassWriter.CLASS:
 242         case ClassWriter.MODULE:
 243         case ClassWriter.PACKAGE:
 244             this.intVal = 0;     // intVal of a class must be zero, see visitInnerClass
 245         case ClassWriter.UTF8:
 246         case ClassWriter.STR:
 247         case ClassWriter.MTYPE:


 248         case ClassWriter.TYPE_NORMAL:
 249             hashCode = 0x7FFFFFFF & (type + strVal1.hashCode());
 250             return;
 251         case ClassWriter.NAME_TYPE: {
 252             hashCode = 0x7FFFFFFF & (type + strVal1.hashCode()
 253                     * strVal2.hashCode());
 254             return;
 255         }
 256         // ClassWriter.FIELD:
 257         // ClassWriter.METH:
 258         // ClassWriter.IMETH:
 259         // ClassWriter.HANDLE_BASE + 1..9
 260         default:
 261             hashCode = 0x7FFFFFFF & (type + strVal1.hashCode()
 262                     * strVal2.hashCode() * strVal3.hashCode());
 263         }
 264     }
 265 
 266     /**
 267      * Sets the item to an InvokeDynamic item.




  63  * methods in the {@link ClassWriter} class.
  64  *
  65  * @author Eric Bruneton
  66  */
  67 final class Item {
  68 
  69     /**
  70      * Index of this item in the constant pool.
  71      */
  72     int index;
  73 
  74     /**
  75      * Type of this constant pool item. A single class is used to represent all
  76      * constant pool item types, in order to minimize the bytecode size of this
  77      * package. The value of this field is one of {@link ClassWriter#INT},
  78      * {@link ClassWriter#LONG}, {@link ClassWriter#FLOAT},
  79      * {@link ClassWriter#DOUBLE}, {@link ClassWriter#UTF8},
  80      * {@link ClassWriter#STR}, {@link ClassWriter#CLASS},
  81      * {@link ClassWriter#NAME_TYPE}, {@link ClassWriter#FIELD},
  82      * {@link ClassWriter#METH}, {@link ClassWriter#IMETH},
  83      * {@link ClassWriter#MODULE}, {@link ClassWriter#PACKAGE},
  84      * {@link ClassWriter#MTYPE}, {@link ClassWriter#INDY}.
  85      *
  86      * MethodHandle constant 9 variations are stored using a range of 9 values
  87      * from {@link ClassWriter#HANDLE_BASE} + 1 to
  88      * {@link ClassWriter#HANDLE_BASE} + 9.
  89      *
  90      * Special Item types are used for Items that are stored in the ClassWriter
  91      * {@link ClassWriter#typeTable}, instead of the constant pool, in order to
  92      * avoid clashes with normal constant pool items in the ClassWriter constant
  93      * pool's hash table. These special item types are
  94      * {@link ClassWriter#TYPE_NORMAL}, {@link ClassWriter#TYPE_UNINIT} and
  95      * {@link ClassWriter#TYPE_MERGED}.
  96      */
  97     int type;
  98 
  99     /**
 100      * Value of this item, for an integer item.
 101      */
 102     int intVal;
 103 


 223      * Sets this item to an item that do not hold a primitive value.
 224      *
 225      * @param type
 226      *            the type of this item.
 227      * @param strVal1
 228      *            first part of the value of this item.
 229      * @param strVal2
 230      *            second part of the value of this item.
 231      * @param strVal3
 232      *            third part of the value of this item.
 233      */
 234     @SuppressWarnings("fallthrough")
 235     void set(final int type, final String strVal1, final String strVal2,
 236             final String strVal3) {
 237         this.type = type;
 238         this.strVal1 = strVal1;
 239         this.strVal2 = strVal2;
 240         this.strVal3 = strVal3;
 241         switch (type) {
 242         case ClassWriter.CLASS:


 243             this.intVal = 0;     // intVal of a class must be zero, see visitInnerClass
 244         case ClassWriter.UTF8:
 245         case ClassWriter.STR:
 246         case ClassWriter.MTYPE:
 247         case ClassWriter.MODULE:
 248         case ClassWriter.PACKAGE:
 249         case ClassWriter.TYPE_NORMAL:
 250             hashCode = 0x7FFFFFFF & (type + strVal1.hashCode());
 251             return;
 252         case ClassWriter.NAME_TYPE: {
 253             hashCode = 0x7FFFFFFF & (type + strVal1.hashCode()
 254                     * strVal2.hashCode());
 255             return;
 256         }
 257         // ClassWriter.FIELD:
 258         // ClassWriter.METH:
 259         // ClassWriter.IMETH:
 260         // ClassWriter.HANDLE_BASE + 1..9
 261         default:
 262             hashCode = 0x7FFFFFFF & (type + strVal1.hashCode()
 263                     * strVal2.hashCode() * strVal3.hashCode());
 264         }
 265     }
 266 
 267     /**
 268      * Sets the item to an InvokeDynamic item.


< prev index next >