--- a/hotspot/src/share/vm/c1/c1_Canonicalizer.cpp Wed Nov 04 07:23:23 2015 -1000
+++ b/hotspot/src/share/vm/c1/c1_Canonicalizer.cpp Thu Nov 05 13:33:18 2015 +0300
@@ -727,7 +727,9 @@
set_canonical(new IfInstanceOf(inst->klass(), inst->obj(), true, inst->state_before()->bci(), is_inst_sux, no_inst_sux));
}
}
- } else if (rt == objectNull && (l->as_NewInstance() || l->as_NewArray())) {
+ } else if (rt == objectNull &&
+ (l->as_NewInstance() || l->as_NewArray() ||
+ (UseNewCode && l->as_Local() && l->as_Local()->is_receiver()))) {
if (x->cond() == Instruction::eql) {
BlockBegin* sux = x->fsux();
set_canonical(new Goto(sux, x->state_before(), is_safepoint(x, sux)));
--- a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp Wed Nov 04 07:23:23 2015 -1000
+++ b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp Thu Nov 05 13:33:18 2015 +0300
@@ -3089,7 +3089,7 @@
int idx = 0;
if (!method()->is_static()) {
// we should always see the receiver
- state->store_local(idx, new Local(method()->holder(), objectType, idx));
+ state->store_local(idx, new Local(method()->holder(), objectType, idx, true));
idx = 1;
}
@@ -3101,7 +3101,7 @@
// don't allow T_ARRAY to propagate into locals types
if (basic_type == T_ARRAY) basic_type = T_OBJECT;
ValueType* vt = as_ValueType(basic_type);
- state->store_local(idx, new Local(type, vt, idx));
+ state->store_local(idx, new Local(type, vt, idx, false));
idx += type->size();
}
--- a/hotspot/src/share/vm/c1/c1_Instruction.hpp Wed Nov 04 07:23:23 2015 -1000
+++ b/hotspot/src/share/vm/c1/c1_Instruction.hpp Thu Nov 05 13:33:18 2015 +0300
@@ -701,19 +701,22 @@
LEAF(Local, Instruction)
private:
int _java_index; // the local index within the method to which the local belongs
+ bool _is_receiver; // if local variable holds the receiver: "this" for non-static methods
ciType* _declared_type;
public:
// creation
- Local(ciType* declared, ValueType* type, int index)
+ Local(ciType* declared, ValueType* type, int index, bool receiver)
: Instruction(type)
, _java_index(index)
, _declared_type(declared)
+ , _is_receiver(receiver)
{
NOT_PRODUCT(set_printable_bci(-1));
}
// accessors
int java_index() const { return _java_index; }
+ bool is_receiver() const { return _is_receiver; }
virtual ciType* declared_type() const { return _declared_type; }