8158639: C2 compilation fails with SIGSEGV
authorjcm
Thu, 25 Aug 2016 02:10:03 -0700
changeset 40882 23f882a600ce
parent 40881 a4955213b573
child 40883 765d366c28e1
8158639: C2 compilation fails with SIGSEGV Summary: fixed the jvms for callsite traps based on declared signature. Reviewed-by: kvn, vlivanov, dlong
hotspot/src/share/vm/opto/callGenerator.cpp
hotspot/src/share/vm/opto/graphKit.hpp
hotspot/test/compiler/jsr292/NullConstantReceiver.java
--- a/hotspot/src/share/vm/opto/callGenerator.cpp	Thu Aug 25 12:52:18 2016 +0300
+++ b/hotspot/src/share/vm/opto/callGenerator.cpp	Thu Aug 25 02:10:03 2016 -0700
@@ -1164,7 +1164,10 @@
   GraphKit kit(jvms);
   kit.C->print_inlining_update(this);
   // Take the trap with arguments pushed on the stack.  (Cf. null_check_receiver).
-  int nargs = method()->arg_size();
+  // Callsite signature can be different from actual method being called (i.e _linkTo* sites).
+  // Use callsite signature always.
+  ciMethod* declared_method = kit.method()->get_method_at_bci(kit.bci());
+  int nargs = declared_method->arg_size();
   kit.inc_sp(nargs);
   assert(nargs <= kit.sp() && kit.sp() <= jvms->stk_size(), "sane sp w/ args pushed");
   if (_reason == Deoptimization::Reason_class_check &&
--- a/hotspot/src/share/vm/opto/graphKit.hpp	Thu Aug 25 12:52:18 2016 +0300
+++ b/hotspot/src/share/vm/opto/graphKit.hpp	Thu Aug 25 02:10:03 2016 -0700
@@ -664,7 +664,10 @@
   // callee (with all arguments still on the stack).
   Node* null_check_receiver_before_call(ciMethod* callee) {
     assert(!callee->is_static(), "must be a virtual method");
-    const int nargs = callee->arg_size();
+    // Callsite signature can be different from actual method being called (i.e _linkTo* sites).
+    // Use callsite signature always.
+    ciMethod* declared_method = method()->get_method_at_bci(bci());
+    const int nargs = declared_method->arg_size();
     inc_sp(nargs);
     Node* n = null_check_receiver();
     dec_sp(nargs);
--- a/hotspot/test/compiler/jsr292/NullConstantReceiver.java	Thu Aug 25 12:52:18 2016 +0300
+++ b/hotspot/test/compiler/jsr292/NullConstantReceiver.java	Thu Aug 25 02:10:03 2016 -0700
@@ -23,9 +23,10 @@
 
 /**
  * @test
- * @bug 8059556
+ * @bug 8059556 8158639
  *
  * @run main/othervm -Xbatch compiler.jsr292.NullConstantReceiver
+ * @run main/othervm -Xbatch -XX:CompileCommand=exclude,*::run compiler.jsr292.NullConstantReceiver
  */
 
 package compiler.jsr292;