< prev index next >

src/share/vm/code/nmethod.cpp

Print this page

        

@@ -2359,10 +2359,36 @@
       has_receiver = !(callee->access_flags().is_static());
       has_appendix = false;
       signature = callee->signature();
     }
 
+    // If value types are passed as fields, use the extended signature
+    // which contains the types of all (oop) fields of the value type.
+    if (ValueTypePassFieldsAsArgs) {
+      // Check if callee signature contains a value type argument
+      // TODO if invokedirect is going to be removed we need another way to figure out that the receiver is a value type
+      bool has_value_argument = call.is_invokedirect();
+      const int len = signature->utf8_length();
+      for (int i = 0; i < len && !has_value_argument; ++i) {
+        if (signature->byte_at(i) == 'Q') {
+          has_value_argument = true;
+        }
+      }
+      if (has_value_argument) {
+        // Get the extended signature from the callee's adapter
+        // TODO what about methods that do not have an adapter (for example, abstract methods)?
+        Thread* THREAD = Thread::current();
+        methodHandle dest_method = call.static_target(THREAD);
+        assert(!HAS_PENDING_EXCEPTION, "should not have pending exception");
+        callee = dest_method();
+        assert(callee != NULL, "failed to resolve callee");
+        signature = callee->adapter()->get_sig_extended();
+        assert(signature != NULL, "signature is null");
+        has_receiver = false; // The signature contains the receiver type
+      }
+    }
+
     fr.oops_compiled_arguments_do(signature, has_receiver, has_appendix, reg_map, f);
   }
 #endif // !SHARK
 }
 
< prev index next >