8158639: C2 compilation fails with SIGSEGV

Fixed the jvms for callsite traps based on declared signature.

Reviewed-by: kvn, vlivanov, dlong
This commit is contained in:
Jamsheed Mohammed C M 2016-08-25 02:10:03 -07:00
parent d536ff4377
commit 1f57e15997
3 changed files with 10 additions and 3 deletions
hotspot
src/share/vm/opto
test/compiler/jsr292

@ -1164,7 +1164,10 @@ JVMState* UncommonTrapCallGenerator::generate(JVMState* jvms) {
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 &&

@ -664,7 +664,10 @@ class GraphKit : public Phase {
// 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);

@ -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;