< prev index next >

src/hotspot/share/utilities/constantTag.hpp

Print this page
rev 52749 : Bootstrap method consolidation
* clean up and simplify JDK support code for BSM invocation
* simplify JVM bootstrap handshake: use BootstrapCallInfo only
* remove unused JVM paths and data fields
* move bootstrap argument processing from MethodHandleNatives to ConstantPool
* remove ConstantGroup; merge argument access into BootstrapCallInfo
* adjust BSM argument access: remove copyArguments, add argumentRef API
* add metadata-free BSM modes, including symbolic arguments from CP


  81     return _tag == JVM_CONSTANT_MethodTypeInError;
  82   }
  83 
  84   bool is_dynamic_constant_in_error() const {
  85     return _tag == JVM_CONSTANT_DynamicInError;
  86   }
  87 
  88   bool is_klass_index() const       { return _tag == JVM_CONSTANT_ClassIndex; }
  89   bool is_string_index() const      { return _tag == JVM_CONSTANT_StringIndex; }
  90 
  91   bool is_klass_reference() const   { return is_klass_index() || is_unresolved_klass(); }
  92   bool is_klass_or_reference() const{ return is_klass() || is_klass_reference(); }
  93   bool is_field_or_method() const   { return is_field() || is_method() || is_interface_method(); }
  94   bool is_symbol() const            { return is_utf8(); }
  95 
  96   bool is_method_type() const       { return _tag == JVM_CONSTANT_MethodType; }
  97   bool is_method_handle() const     { return _tag == JVM_CONSTANT_MethodHandle; }
  98   bool is_dynamic_constant() const  { return _tag == JVM_CONSTANT_Dynamic; }
  99   bool is_invoke_dynamic() const    { return _tag == JVM_CONSTANT_InvokeDynamic; }
 100 






 101   bool is_loadable_constant() const {
 102     return ((_tag >= JVM_CONSTANT_Integer && _tag <= JVM_CONSTANT_String) ||
 103             is_method_type() || is_method_handle() || is_dynamic_constant() ||
 104             is_unresolved_klass());
 105   }
 106 
 107   constantTag() {
 108     _tag = JVM_CONSTANT_Invalid;
 109   }
 110   constantTag(jbyte tag) {
 111     assert((tag >= 0 && tag <= JVM_CONSTANT_NameAndType) ||
 112            (tag >= JVM_CONSTANT_MethodHandle && tag <= JVM_CONSTANT_InvokeDynamic) ||
 113            (tag >= JVM_CONSTANT_InternalMin && tag <= JVM_CONSTANT_InternalMax), "Invalid constant tag");
 114     _tag = tag;
 115   }
 116 
 117   static constantTag ofBasicType(BasicType bt) {
 118     if (is_subword_type(bt))  bt = T_INT;
 119     switch (bt) {
 120       case T_OBJECT: return constantTag(JVM_CONSTANT_String);
 121       case T_INT:    return constantTag(JVM_CONSTANT_Integer);
 122       case T_LONG:   return constantTag(JVM_CONSTANT_Long);
 123       case T_FLOAT:  return constantTag(JVM_CONSTANT_Float);
 124       case T_DOUBLE: return constantTag(JVM_CONSTANT_Double);
 125       default:       break;
 126     }
 127     assert(false, "bad basic type for tag");
 128     return constantTag();
 129   }
 130 
 131   jbyte value() const                { return _tag; }

 132   jbyte error_value() const;
 133   jbyte non_error_value() const;
 134 
 135   BasicType basic_type() const;        // if used with ldc, what kind of value gets pushed?
 136 
 137   const char* internal_name() const;  // for error reporting
 138 
 139   void print_on(outputStream* st) const PRODUCT_RETURN;
 140 };
 141 
 142 #endif // SHARE_VM_UTILITIES_CONSTANTTAG_HPP


  81     return _tag == JVM_CONSTANT_MethodTypeInError;
  82   }
  83 
  84   bool is_dynamic_constant_in_error() const {
  85     return _tag == JVM_CONSTANT_DynamicInError;
  86   }
  87 
  88   bool is_klass_index() const       { return _tag == JVM_CONSTANT_ClassIndex; }
  89   bool is_string_index() const      { return _tag == JVM_CONSTANT_StringIndex; }
  90 
  91   bool is_klass_reference() const   { return is_klass_index() || is_unresolved_klass(); }
  92   bool is_klass_or_reference() const{ return is_klass() || is_klass_reference(); }
  93   bool is_field_or_method() const   { return is_field() || is_method() || is_interface_method(); }
  94   bool is_symbol() const            { return is_utf8(); }
  95 
  96   bool is_method_type() const       { return _tag == JVM_CONSTANT_MethodType; }
  97   bool is_method_handle() const     { return _tag == JVM_CONSTANT_MethodHandle; }
  98   bool is_dynamic_constant() const  { return _tag == JVM_CONSTANT_Dynamic; }
  99   bool is_invoke_dynamic() const    { return _tag == JVM_CONSTANT_InvokeDynamic; }
 100 
 101   bool has_bootstrap() const {
 102     return (_tag == JVM_CONSTANT_Dynamic ||
 103             _tag == JVM_CONSTANT_DynamicInError ||
 104             _tag == JVM_CONSTANT_InvokeDynamic);
 105   }
 106 
 107   bool is_loadable_constant() const {
 108     return ((_tag >= JVM_CONSTANT_Integer && _tag <= JVM_CONSTANT_String) ||
 109             is_method_type() || is_method_handle() || is_dynamic_constant() ||
 110             is_unresolved_klass());
 111   }
 112 
 113   constantTag() {
 114     _tag = JVM_CONSTANT_Invalid;
 115   }
 116   constantTag(jbyte tag) {
 117     assert((tag >= 0 && tag <= JVM_CONSTANT_NameAndType) ||
 118            (tag >= JVM_CONSTANT_MethodHandle && tag <= JVM_CONSTANT_InvokeDynamic) ||
 119            (tag >= JVM_CONSTANT_InternalMin && tag <= JVM_CONSTANT_InternalMax), "Invalid constant tag");
 120     _tag = tag;
 121   }
 122 
 123   static constantTag ofBasicType(BasicType bt) {
 124     if (is_subword_type(bt))  bt = T_INT;
 125     switch (bt) {
 126       case T_OBJECT: return constantTag(JVM_CONSTANT_String);
 127       case T_INT:    return constantTag(JVM_CONSTANT_Integer);
 128       case T_LONG:   return constantTag(JVM_CONSTANT_Long);
 129       case T_FLOAT:  return constantTag(JVM_CONSTANT_Float);
 130       case T_DOUBLE: return constantTag(JVM_CONSTANT_Double);
 131       default:       break;
 132     }
 133     assert(false, "bad basic type for tag");
 134     return constantTag();
 135   }
 136 
 137   jbyte value() const                { return _tag; }
 138   jbyte classfile_value() const;
 139   jbyte error_value() const;
 140   jbyte non_error_value() const;
 141 
 142   BasicType basic_type() const;        // if used with ldc, what kind of value gets pushed?
 143 
 144   const char* internal_name() const;  // for error reporting
 145 
 146   void print_on(outputStream* st) const PRODUCT_RETURN;
 147 };
 148 
 149 #endif // SHARE_VM_UTILITIES_CONSTANTTAG_HPP
< prev index next >