src/share/vm/interpreter/linkResolver.hpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File 8073191-work Sdiff src/share/vm/interpreter

src/share/vm/interpreter/linkResolver.hpp

Print this page




 114   int          itable_index() const {
 115     assert(call_kind() == itable_call, "");
 116     // The returned value is always >= 0, a valid itable index.
 117     return _call_index;
 118   }
 119 
 120   // debugging
 121 #ifdef ASSERT
 122   bool         has_vtable_index() const          { return _call_index >= 0 && _call_kind != CallInfo::itable_call; }
 123   bool         is_statically_bound() const       { return _call_index == Method::nonvirtual_vtable_index; }
 124 #endif //ASSERT
 125   void         verify() PRODUCT_RETURN;
 126   void         print()  PRODUCT_RETURN;
 127 };
 128 
 129 
 130 // Condensed information from constant pool to use to resolve the method or field.
 131 //   resolved_klass = specified class (i.e., static receiver class)
 132 //   current_klass  = sending method holder (i.e., class containing the method
 133 //                    containing the call being resolved)

 134 class LinkInfo : public StackObj {
 135   Symbol*     _name;            // extracted from JVM_CONSTANT_NameAndType
 136   Symbol*     _signature;
 137   KlassHandle _resolved_klass;  // class that the constant pool entry points to
 138   KlassHandle _current_klass;   // class that owns the constant pool

 139   bool        _check_access;
 140   constantTag _tag;

 141  public:
 142   enum AccessCheck {
 143      needs_access_check,
 144      skip_access_check
 145   };
 146 

 147   LinkInfo(const constantPoolHandle& pool, int index, TRAPS);
 148 
 149   // Condensed information from other call sites within the vm.
 150   LinkInfo(KlassHandle resolved_klass, Symbol* name, Symbol* signature, KlassHandle current_klass,
 151            AccessCheck check_access = needs_access_check,
 152            constantTag tag = JVM_CONSTANT_Invalid) :
 153     _resolved_klass(resolved_klass),
 154     _name(name), _signature(signature), _current_klass(current_klass),







 155     _check_access(check_access == needs_access_check), _tag(tag) {}
 156 
 157   // Case where we just find the method and don't check access against the current class
 158   LinkInfo(KlassHandle resolved_klass, Symbol*name, Symbol* signature) :
 159     _resolved_klass(resolved_klass),
 160     _name(name), _signature(signature), _current_klass(NULL),
 161     _check_access(false), _tag(JVM_CONSTANT_Invalid) {}
 162 
 163   // accessors
 164   Symbol* name() const               { return _name; }
 165   Symbol* signature() const          { return _signature; }
 166   KlassHandle resolved_klass() const { return _resolved_klass; }
 167   KlassHandle current_klass() const  { return _current_klass; }

 168   constantTag tag() const            { return _tag; }
 169   bool check_access() const          { return _check_access; }
 170   char* method_string() const;
 171 
 172   void         print()  PRODUCT_RETURN;
 173 };
 174 
 175 // Link information for getfield/putfield & getstatic/putstatic bytecodes
 176 // is represented using a fieldDescriptor.
 177 
 178 // The LinkResolver is used to resolve constant-pool references at run-time.
 179 // It does all necessary link-time checks & throws exceptions if necessary.
 180 
 181 class LinkResolver: AllStatic {
 182   friend class klassVtable;
 183   friend class klassItable;
 184 
 185  private:
 186 
 187   static methodHandle lookup_method_in_klasses(const LinkInfo& link_info,


 249   static void resolve_invokevirtual  (CallInfo& result, Handle recv,
 250                                       const constantPoolHandle& pool, int index, TRAPS);
 251   static void resolve_invokeinterface(CallInfo& result, Handle recv,
 252                                       const constantPoolHandle& pool, int index, TRAPS);
 253   static void resolve_invokedynamic  (CallInfo& result,
 254                                       const constantPoolHandle& pool, int index, TRAPS);
 255   static void resolve_invokehandle   (CallInfo& result,
 256                                       const constantPoolHandle& pool, int index, TRAPS);
 257  public:
 258   // constant pool resolving
 259   static void check_klass_accessability(KlassHandle ref_klass, KlassHandle sel_klass, TRAPS);
 260 
 261   // static resolving calls (will not run any Java code);
 262   // used only from Bytecode_invoke::static_target
 263   static methodHandle resolve_method_statically(Bytecodes::Code code,
 264                                                 const constantPoolHandle& pool,
 265                                                 int index, TRAPS);
 266 
 267   static void resolve_field_access(fieldDescriptor& result,
 268                                    const constantPoolHandle& pool,
 269                                    int index, Bytecodes::Code byte, TRAPS);


 270   static void resolve_field(fieldDescriptor& result, const LinkInfo& link_info,
 271                             Bytecodes::Code access_kind,
 272                             bool initialize_class, TRAPS);
 273 
 274   static void resolve_static_call   (CallInfo& result,
 275                                      const LinkInfo& link_info,
 276                                      bool initialize_klass, TRAPS);
 277   static void resolve_special_call  (CallInfo& result,
 278                                      const LinkInfo& link_info,
 279                                      TRAPS);
 280   static void resolve_virtual_call  (CallInfo& result, Handle recv, KlassHandle recv_klass,
 281                                      const LinkInfo& link_info,
 282                                      bool check_null_and_abstract, TRAPS);
 283   static void resolve_interface_call(CallInfo& result, Handle recv, KlassHandle recv_klass,
 284                                      const LinkInfo& link_info,
 285                                      bool check_null_and_abstract, TRAPS);
 286   static void resolve_handle_call   (CallInfo& result,
 287                                      const LinkInfo& link_info, TRAPS);
 288   static void resolve_dynamic_call  (CallInfo& result, Handle bootstrap_specifier,
 289                                      Symbol* method_name, Symbol* method_signature,




 114   int          itable_index() const {
 115     assert(call_kind() == itable_call, "");
 116     // The returned value is always >= 0, a valid itable index.
 117     return _call_index;
 118   }
 119 
 120   // debugging
 121 #ifdef ASSERT
 122   bool         has_vtable_index() const          { return _call_index >= 0 && _call_kind != CallInfo::itable_call; }
 123   bool         is_statically_bound() const       { return _call_index == Method::nonvirtual_vtable_index; }
 124 #endif //ASSERT
 125   void         verify() PRODUCT_RETURN;
 126   void         print()  PRODUCT_RETURN;
 127 };
 128 
 129 
 130 // Condensed information from constant pool to use to resolve the method or field.
 131 //   resolved_klass = specified class (i.e., static receiver class)
 132 //   current_klass  = sending method holder (i.e., class containing the method
 133 //                    containing the call being resolved)
 134 //   current_method = sending method (relevant for field resolution)
 135 class LinkInfo : public StackObj {
 136   Symbol*     _name;            // extracted from JVM_CONSTANT_NameAndType
 137   Symbol*     _signature;
 138   KlassHandle _resolved_klass;  // class that the constant pool entry points to
 139   KlassHandle _current_klass;   // class that owns the constant pool
 140   methodHandle _current_method;  // sending method
 141   bool        _check_access;
 142   constantTag _tag;
 143 
 144  public:
 145   enum AccessCheck {
 146     needs_access_check,
 147     skip_access_check
 148   };
 149 
 150   LinkInfo(const constantPoolHandle& pool, int index, methodHandle current_method, TRAPS);
 151   LinkInfo(const constantPoolHandle& pool, int index, TRAPS);
 152 
 153   // Condensed information from other call sites within the vm.
 154   LinkInfo(KlassHandle resolved_klass, Symbol* name, Symbol* signature, KlassHandle current_klass,
 155            AccessCheck check_access = needs_access_check,
 156            constantTag tag = JVM_CONSTANT_Invalid) :
 157     _resolved_klass(resolved_klass),
 158     _name(name), _signature(signature), _current_klass(current_klass), _current_method(NULL),
 159     _check_access(check_access == needs_access_check), _tag(tag) {}
 160 
 161   LinkInfo(KlassHandle resolved_klass, Symbol* name, Symbol* signature, methodHandle current_method,
 162            AccessCheck check_access = needs_access_check,
 163            constantTag tag = JVM_CONSTANT_Invalid) :
 164     _resolved_klass(resolved_klass),
 165     _name(name), _signature(signature), _current_klass(current_method->method_holder()), _current_method(current_method),
 166     _check_access(check_access == needs_access_check), _tag(tag) {}
 167 
 168   // Case where we just find the method and don't check access against the current class
 169   LinkInfo(KlassHandle resolved_klass, Symbol*name, Symbol* signature) :
 170     _resolved_klass(resolved_klass),
 171     _name(name), _signature(signature), _current_klass(NULL), _current_method(NULL),
 172     _check_access(false), _tag(JVM_CONSTANT_Invalid) {}
 173 
 174   // accessors
 175   Symbol* name() const               { return _name; }
 176   Symbol* signature() const          { return _signature; }
 177   KlassHandle resolved_klass() const { return _resolved_klass; }
 178   KlassHandle current_klass() const  { return _current_klass; }
 179   methodHandle current_method() const { return _current_method; }
 180   constantTag tag() const            { return _tag; }
 181   bool check_access() const          { return _check_access; }
 182   char* method_string() const;
 183 
 184   void         print()  PRODUCT_RETURN;
 185 };
 186 
 187 // Link information for getfield/putfield & getstatic/putstatic bytecodes
 188 // is represented using a fieldDescriptor.
 189 
 190 // The LinkResolver is used to resolve constant-pool references at run-time.
 191 // It does all necessary link-time checks & throws exceptions if necessary.
 192 
 193 class LinkResolver: AllStatic {
 194   friend class klassVtable;
 195   friend class klassItable;
 196 
 197  private:
 198 
 199   static methodHandle lookup_method_in_klasses(const LinkInfo& link_info,


 261   static void resolve_invokevirtual  (CallInfo& result, Handle recv,
 262                                       const constantPoolHandle& pool, int index, TRAPS);
 263   static void resolve_invokeinterface(CallInfo& result, Handle recv,
 264                                       const constantPoolHandle& pool, int index, TRAPS);
 265   static void resolve_invokedynamic  (CallInfo& result,
 266                                       const constantPoolHandle& pool, int index, TRAPS);
 267   static void resolve_invokehandle   (CallInfo& result,
 268                                       const constantPoolHandle& pool, int index, TRAPS);
 269  public:
 270   // constant pool resolving
 271   static void check_klass_accessability(KlassHandle ref_klass, KlassHandle sel_klass, TRAPS);
 272 
 273   // static resolving calls (will not run any Java code);
 274   // used only from Bytecode_invoke::static_target
 275   static methodHandle resolve_method_statically(Bytecodes::Code code,
 276                                                 const constantPoolHandle& pool,
 277                                                 int index, TRAPS);
 278 
 279   static void resolve_field_access(fieldDescriptor& result,
 280                                    const constantPoolHandle& pool,
 281                                    int index,
 282                                    const methodHandle& method,
 283                                    Bytecodes::Code byte, TRAPS);
 284   static void resolve_field(fieldDescriptor& result, const LinkInfo& link_info,
 285                             Bytecodes::Code access_kind,
 286                             bool initialize_class, TRAPS);
 287 
 288   static void resolve_static_call   (CallInfo& result,
 289                                      const LinkInfo& link_info,
 290                                      bool initialize_klass, TRAPS);
 291   static void resolve_special_call  (CallInfo& result,
 292                                      const LinkInfo& link_info,
 293                                      TRAPS);
 294   static void resolve_virtual_call  (CallInfo& result, Handle recv, KlassHandle recv_klass,
 295                                      const LinkInfo& link_info,
 296                                      bool check_null_and_abstract, TRAPS);
 297   static void resolve_interface_call(CallInfo& result, Handle recv, KlassHandle recv_klass,
 298                                      const LinkInfo& link_info,
 299                                      bool check_null_and_abstract, TRAPS);
 300   static void resolve_handle_call   (CallInfo& result,
 301                                      const LinkInfo& link_info, TRAPS);
 302   static void resolve_dynamic_call  (CallInfo& result, Handle bootstrap_specifier,
 303                                      Symbol* method_name, Symbol* method_signature,


src/share/vm/interpreter/linkResolver.hpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File