hotspot/src/share/vm/interpreter/linkResolver.hpp
changeset 39421 a9652c919db8
parent 38719 133bf85c3f36
child 44738 11431bbc9549
child 46329 53ccc37bda19
--- a/hotspot/src/share/vm/interpreter/linkResolver.hpp	Wed Jun 15 13:47:17 2016 +0200
+++ b/hotspot/src/share/vm/interpreter/linkResolver.hpp	Wed Jun 15 14:27:58 2016 +0200
@@ -131,19 +131,23 @@
 //   resolved_klass = specified class (i.e., static receiver class)
 //   current_klass  = sending method holder (i.e., class containing the method
 //                    containing the call being resolved)
+//   current_method = sending method (relevant for field resolution)
 class LinkInfo : public StackObj {
   Symbol*     _name;            // extracted from JVM_CONSTANT_NameAndType
   Symbol*     _signature;
   KlassHandle _resolved_klass;  // class that the constant pool entry points to
   KlassHandle _current_klass;   // class that owns the constant pool
+  methodHandle _current_method;  // sending method
   bool        _check_access;
   constantTag _tag;
+
  public:
   enum AccessCheck {
-     needs_access_check,
-     skip_access_check
+    needs_access_check,
+    skip_access_check
   };
 
+  LinkInfo(const constantPoolHandle& pool, int index, methodHandle current_method, TRAPS);
   LinkInfo(const constantPoolHandle& pool, int index, TRAPS);
 
   // Condensed information from other call sites within the vm.
@@ -151,13 +155,20 @@
            AccessCheck check_access = needs_access_check,
            constantTag tag = JVM_CONSTANT_Invalid) :
     _resolved_klass(resolved_klass),
-    _name(name), _signature(signature), _current_klass(current_klass),
+    _name(name), _signature(signature), _current_klass(current_klass), _current_method(NULL),
+    _check_access(check_access == needs_access_check), _tag(tag) {}
+
+  LinkInfo(KlassHandle resolved_klass, Symbol* name, Symbol* signature, methodHandle current_method,
+           AccessCheck check_access = needs_access_check,
+           constantTag tag = JVM_CONSTANT_Invalid) :
+    _resolved_klass(resolved_klass),
+    _name(name), _signature(signature), _current_klass(current_method->method_holder()), _current_method(current_method),
     _check_access(check_access == needs_access_check), _tag(tag) {}
 
   // Case where we just find the method and don't check access against the current class
   LinkInfo(KlassHandle resolved_klass, Symbol*name, Symbol* signature) :
     _resolved_klass(resolved_klass),
-    _name(name), _signature(signature), _current_klass(NULL),
+    _name(name), _signature(signature), _current_klass(NULL), _current_method(NULL),
     _check_access(false), _tag(JVM_CONSTANT_Invalid) {}
 
   // accessors
@@ -165,6 +176,7 @@
   Symbol* signature() const          { return _signature; }
   KlassHandle resolved_klass() const { return _resolved_klass; }
   KlassHandle current_klass() const  { return _current_klass; }
+  methodHandle current_method() const { return _current_method; }
   constantTag tag() const            { return _tag; }
   bool check_access() const          { return _check_access; }
   char* method_string() const;
@@ -266,7 +278,9 @@
 
   static void resolve_field_access(fieldDescriptor& result,
                                    const constantPoolHandle& pool,
-                                   int index, Bytecodes::Code byte, TRAPS);
+                                   int index,
+                                   const methodHandle& method,
+                                   Bytecodes::Code byte, TRAPS);
   static void resolve_field(fieldDescriptor& result, const LinkInfo& link_info,
                             Bytecodes::Code access_kind,
                             bool initialize_class, TRAPS);