提交 f0c10dc7 编写于 作者: D dbuck

8158639: C2 compilation fails with SIGSEGV

Summary: fixed the jvms for callsite traps based on declared signature.
Reviewed-by: jcm, coleenp, vlivanov
上级 1dd579aa
......@@ -243,6 +243,11 @@ class ciMethod : public ciMetadata {
ciField* get_field_at_bci( int bci, bool &will_link);
ciMethod* get_method_at_bci(int bci, bool &will_link, ciSignature* *declared_signature);
ciMethod* get_method_at_bci(int bci) {
bool ignored_will_link;
ciSignature* ignored_declared_signature;
return get_method_at_bci(bci, ignored_will_link, &ignored_declared_signature);
}
// Given a certain calling environment, find the monomorphic target
// for the call. Return NULL if the call is not monomorphic in
// its calling environment.
......
......@@ -188,7 +188,10 @@ JVMState* VirtualCallGenerator::generate(JVMState* jvms) {
// the call instruction will have a seemingly deficient out-count.
// (The bailout says something misleading about an "infinite loop".)
if (kit.gvn().type(receiver)->higher_equal(TypePtr::NULL_PTR)) {
kit.inc_sp(method()->arg_size()); // restore arguments
assert(Bytecodes::is_invoke(kit.java_bc()), err_msg("%d: %s", kit.java_bc(), Bytecodes::name(kit.java_bc())));
ciMethod* declared_method = kit.method()->get_method_at_bci(kit.bci());
int arg_size = declared_method->signature()->arg_size_for_bc(kit.java_bc());
kit.inc_sp(arg_size); // restore arguments
kit.uncommon_trap(Deoptimization::Reason_null_check,
Deoptimization::Action_none,
NULL, "null receiver");
......@@ -1119,7 +1122,10 @@ CallGenerator::for_uncommon_trap(ciMethod* m,
JVMState* UncommonTrapCallGenerator::generate(JVMState* jvms) {
GraphKit kit(jvms);
// 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 &&
......
......@@ -656,7 +656,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,8 +23,10 @@
/**
* @test
* @bug 8059556
* @bug 8059556 8158639
*
* @run main/othervm -Xbatch NullConstantReceiver
* @run main/othervm -Xbatch -XX:CompileCommand=exclude,*::run NullConstantReceiver
*/
import java.lang.invoke.MethodHandle;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册