< prev index next >

src/share/vm/interpreter/interpreterRuntime.cpp

Print this page

        

@@ -586,10 +586,40 @@
   InstanceKlass* klass = InstanceKlass::cast(info.field_holder());
   bool uninitialized_static = ((bytecode == Bytecodes::_getstatic || bytecode == Bytecodes::_putstatic) &&
                                !klass->is_initialized());
   Bytecodes::Code get_code = (Bytecodes::Code)0;
 
+  
+  if (info.is_accessor()) {
+      // If it is an accessor (not a real field) change bytecode
+      // semantic to be a call to the accessor-method)
+      InstanceKlass* current_klass = method(thread)->method_holder();
+      // find method based on get/put
+      Method* m =  klass->method_with_idnum(is_put
+        ? info.get_put_accessor() 
+        : info.get_get_accessor()
+      );
+      
+      // Create a linkinfo to resolve the method
+      LinkInfo linfo(klass,m->name(),m->signature(),current_klass,true);
+  
+      // Resolve static/non-static method and initialize cp_cache_entry
+      // accordingly
+      if (is_static) {
+        methodHandle mh = LinkResolver::resolve_static_call_or_null(linfo);
+        cp_cache_entry->set_direct_call(
+          Bytecodes::_invokestatic,
+          mh);
+      }else {
+        methodHandle mh = LinkResolver::resolve_virtual_call_or_null(klass,linfo);
+        cp_cache_entry->set_vtable_call(
+          Bytecodes::_invokevirtual,
+          mh,
+          m->vtable_index());
+      }
+
+  }else {
   if (!uninitialized_static) {
     get_code = ((is_static) ? Bytecodes::_getstatic : Bytecodes::_getfield);
     if (is_put || !info.access_flags().is_final()) {
       put_code = ((is_static) ? Bytecodes::_putstatic : Bytecodes::_putfield);
     }

@@ -604,10 +634,11 @@
     state,
     info.access_flags().is_final(),
     info.access_flags().is_volatile(),
     pool->pool_holder()
   );
+  }
 }
 
 
 //------------------------------------------------------------------------------------------------------------------------
 // Synchronization
< prev index next >