8191998: C2: inlining through MH linkers drops speculative part of argument types
Reviewed-by: roland, thartmann, kvn
--- a/src/hotspot/share/opto/callGenerator.cpp Fri Jan 25 13:37:08 2019 -0800
+++ b/src/hotspot/share/opto/callGenerator.cpp Fri Jan 25 13:37:10 2019 -0800
@@ -896,7 +896,8 @@
const TypeOopPtr* arg_type = arg->bottom_type()->isa_oopptr();
const Type* sig_type = TypeOopPtr::make_from_klass(signature->accessing_klass());
if (arg_type != NULL && !arg_type->higher_equal(sig_type)) {
- Node* cast_obj = gvn.transform(new CheckCastPPNode(kit.control(), arg, sig_type));
+ const Type* recv_type = arg_type->join_speculative(sig_type); // keep speculative part
+ Node* cast_obj = gvn.transform(new CheckCastPPNode(kit.control(), arg, recv_type));
kit.set_argument(0, cast_obj);
}
}
@@ -908,7 +909,8 @@
const TypeOopPtr* arg_type = arg->bottom_type()->isa_oopptr();
const Type* sig_type = TypeOopPtr::make_from_klass(t->as_klass());
if (arg_type != NULL && !arg_type->higher_equal(sig_type)) {
- Node* cast_obj = gvn.transform(new CheckCastPPNode(kit.control(), arg, sig_type));
+ const Type* narrowed_arg_type = arg_type->join_speculative(sig_type); // keep speculative part
+ Node* cast_obj = gvn.transform(new CheckCastPPNode(kit.control(), arg, narrowed_arg_type));
kit.set_argument(receiver_skip + j, cast_obj);
}
}