hotspot/src/share/vm/prims/methodHandleWalk.hpp
changeset 8076 96d498ec7ae1
parent 7426 dba53a0065f8
child 8676 9098d4e927e1
equal deleted inserted replaced
8075:582dd25571b2 8076:96d498ec7ae1
   256   class ConstantValue {
   256   class ConstantValue {
   257   private:
   257   private:
   258     int       _tag;   // Constant pool tag type.
   258     int       _tag;   // Constant pool tag type.
   259     JavaValue _value;
   259     JavaValue _value;
   260     Handle    _handle;
   260     Handle    _handle;
       
   261     Symbol*   _sym;
   261 
   262 
   262   public:
   263   public:
   263     // Constructor for oop types.
   264     // Constructor for oop types.
   264     ConstantValue(int tag, Handle con) : _tag(tag), _handle(con) {
   265     ConstantValue(int tag, Handle con) : _tag(tag), _handle(con) {
   265       assert(tag == JVM_CONSTANT_Utf8   ||
   266       assert(tag == JVM_CONSTANT_Class  ||
   266              tag == JVM_CONSTANT_Class  ||
       
   267              tag == JVM_CONSTANT_String ||
   267              tag == JVM_CONSTANT_String ||
   268              tag == JVM_CONSTANT_Object, "must be oop type");
   268              tag == JVM_CONSTANT_Object, "must be oop type");
       
   269     }
       
   270 
       
   271     ConstantValue(int tag, Symbol* con) : _tag(tag), _sym(con) {
       
   272       assert(tag == JVM_CONSTANT_Utf8, "must be symbol type");
   269     }
   273     }
   270 
   274 
   271     // Constructor for oop reference types.
   275     // Constructor for oop reference types.
   272     ConstantValue(int tag, int index) : _tag(tag) {
   276     ConstantValue(int tag, int index) : _tag(tag) {
   273       assert(JVM_CONSTANT_Fieldref <= tag && tag <= JVM_CONSTANT_NameAndType, "must be ref type");
   277       assert(JVM_CONSTANT_Fieldref <= tag && tag <= JVM_CONSTANT_NameAndType, "must be ref type");
   289       default: ShouldNotReachHere();
   293       default: ShouldNotReachHere();
   290       }
   294       }
   291     }
   295     }
   292 
   296 
   293     int       tag()          const { return _tag; }
   297     int       tag()          const { return _tag; }
   294     symbolOop symbol_oop()   const { return (symbolOop) _handle(); }
   298     Symbol*   symbol()       const { return _sym; }
   295     klassOop  klass_oop()    const { return (klassOop)  _handle(); }
   299     klassOop  klass_oop()    const { return (klassOop)  _handle(); }
   296     oop       object_oop()   const { return _handle(); }
   300     oop       object_oop()   const { return _handle(); }
   297     int       index()        const { return _value.get_jint(); }
   301     int       index()        const { return _value.get_jint(); }
   298     int       first_index()  const { return _value.get_jint() >> 16; }
   302     int       first_index()  const { return _value.get_jint() >> 16; }
   299     int       second_index() const { return _value.get_jint() & 0x0000FFFF; }
   303     int       second_index() const { return _value.get_jint() & 0x0000FFFF; }
   334     if (con.is_null())  return 0;
   338     if (con.is_null())  return 0;
   335     ConstantValue* cv = new ConstantValue(tag, con);
   339     ConstantValue* cv = new ConstantValue(tag, con);
   336     return _constants.append(cv);
   340     return _constants.append(cv);
   337   }
   341   }
   338 
   342 
       
   343   int cpool_symbol_put(int tag, Symbol* con) {
       
   344     if (con == NULL)  return 0;
       
   345     ConstantValue* cv = new ConstantValue(tag, con);
       
   346     return _constants.append(cv);
       
   347   }
       
   348 
   339   int cpool_oop_reference_put(int tag, int first_index, int second_index) {
   349   int cpool_oop_reference_put(int tag, int first_index, int second_index) {
   340     if (first_index == 0 && second_index == 0)  return 0;
   350     if (first_index == 0 && second_index == 0)  return 0;
   341     assert(first_index != 0 && second_index != 0, "no zero indexes");
   351     assert(first_index != 0 && second_index != 0, "no zero indexes");
   342     ConstantValue* cv = new ConstantValue(tag, first_index, second_index);
   352     ConstantValue* cv = new ConstantValue(tag, first_index, second_index);
   343     return _constants.append(cv);
   353     return _constants.append(cv);
   363   }
   373   }
   364 
   374 
   365   int cpool_object_put(Handle obj) {
   375   int cpool_object_put(Handle obj) {
   366     return cpool_oop_put(JVM_CONSTANT_Object, obj);
   376     return cpool_oop_put(JVM_CONSTANT_Object, obj);
   367   }
   377   }
   368   int cpool_symbol_put(symbolOop sym) {
   378   int cpool_symbol_put(Symbol* sym) {
   369     return cpool_oop_put(JVM_CONSTANT_Utf8, sym);
   379     return cpool_symbol_put(JVM_CONSTANT_Utf8, sym);
   370   }
   380   }
   371   int cpool_klass_put(klassOop klass) {
   381   int cpool_klass_put(klassOop klass) {
   372     return cpool_oop_put(JVM_CONSTANT_Class, klass);
   382     return cpool_oop_put(JVM_CONSTANT_Class, klass);
   373   }
   383   }
   374   int cpool_methodref_put(int class_index, int name_and_type_index) {
   384   int cpool_methodref_put(int class_index, int name_and_type_index) {