7143038: SIGSEGV in assert_equal / LinearScan::assign_reg_num
Forced exit may destory global objects that are still in use. Reviewed-by: twisti, never, kvn
This commit is contained in:
parent
539616f85a
commit
cb7dbaebc9
@ -2464,12 +2464,15 @@ void LinearScan::compute_oop_map(IntervalWalker* iw, const LIR_OpVisitState &vis
|
|||||||
|
|
||||||
|
|
||||||
// frequently used constants
|
// frequently used constants
|
||||||
ConstantOopWriteValue LinearScan::_oop_null_scope_value = ConstantOopWriteValue(NULL);
|
// Allocate them with new so they are never destroyed (otherwise, a
|
||||||
ConstantIntValue LinearScan::_int_m1_scope_value = ConstantIntValue(-1);
|
// forced exit could destroy these objects while they are still in
|
||||||
ConstantIntValue LinearScan::_int_0_scope_value = ConstantIntValue(0);
|
// use).
|
||||||
ConstantIntValue LinearScan::_int_1_scope_value = ConstantIntValue(1);
|
ConstantOopWriteValue* LinearScan::_oop_null_scope_value = new (ResourceObj::C_HEAP) ConstantOopWriteValue(NULL);
|
||||||
ConstantIntValue LinearScan::_int_2_scope_value = ConstantIntValue(2);
|
ConstantIntValue* LinearScan::_int_m1_scope_value = new (ResourceObj::C_HEAP) ConstantIntValue(-1);
|
||||||
LocationValue _illegal_value = LocationValue(Location());
|
ConstantIntValue* LinearScan::_int_0_scope_value = new (ResourceObj::C_HEAP) ConstantIntValue(0);
|
||||||
|
ConstantIntValue* LinearScan::_int_1_scope_value = new (ResourceObj::C_HEAP) ConstantIntValue(1);
|
||||||
|
ConstantIntValue* LinearScan::_int_2_scope_value = new (ResourceObj::C_HEAP) ConstantIntValue(2);
|
||||||
|
LocationValue* _illegal_value = new (ResourceObj::C_HEAP) LocationValue(Location());
|
||||||
|
|
||||||
void LinearScan::init_compute_debug_info() {
|
void LinearScan::init_compute_debug_info() {
|
||||||
// cache for frequently used scope values
|
// cache for frequently used scope values
|
||||||
@ -2508,7 +2511,7 @@ int LinearScan::append_scope_value_for_constant(LIR_Opr opr, GrowableArray<Scope
|
|||||||
case T_OBJECT: {
|
case T_OBJECT: {
|
||||||
jobject value = c->as_jobject();
|
jobject value = c->as_jobject();
|
||||||
if (value == NULL) {
|
if (value == NULL) {
|
||||||
scope_values->append(&_oop_null_scope_value);
|
scope_values->append(_oop_null_scope_value);
|
||||||
} else {
|
} else {
|
||||||
scope_values->append(new ConstantOopWriteValue(c->as_jobject()));
|
scope_values->append(new ConstantOopWriteValue(c->as_jobject()));
|
||||||
}
|
}
|
||||||
@ -2519,10 +2522,10 @@ int LinearScan::append_scope_value_for_constant(LIR_Opr opr, GrowableArray<Scope
|
|||||||
case T_FLOAT: {
|
case T_FLOAT: {
|
||||||
int value = c->as_jint_bits();
|
int value = c->as_jint_bits();
|
||||||
switch (value) {
|
switch (value) {
|
||||||
case -1: scope_values->append(&_int_m1_scope_value); break;
|
case -1: scope_values->append(_int_m1_scope_value); break;
|
||||||
case 0: scope_values->append(&_int_0_scope_value); break;
|
case 0: scope_values->append(_int_0_scope_value); break;
|
||||||
case 1: scope_values->append(&_int_1_scope_value); break;
|
case 1: scope_values->append(_int_1_scope_value); break;
|
||||||
case 2: scope_values->append(&_int_2_scope_value); break;
|
case 2: scope_values->append(_int_2_scope_value); break;
|
||||||
default: scope_values->append(new ConstantIntValue(c->as_jint_bits())); break;
|
default: scope_values->append(new ConstantIntValue(c->as_jint_bits())); break;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
@ -2531,7 +2534,7 @@ int LinearScan::append_scope_value_for_constant(LIR_Opr opr, GrowableArray<Scope
|
|||||||
case T_LONG: // fall through
|
case T_LONG: // fall through
|
||||||
case T_DOUBLE: {
|
case T_DOUBLE: {
|
||||||
#ifdef _LP64
|
#ifdef _LP64
|
||||||
scope_values->append(&_int_0_scope_value);
|
scope_values->append(_int_0_scope_value);
|
||||||
scope_values->append(new ConstantLongValue(c->as_jlong_bits()));
|
scope_values->append(new ConstantLongValue(c->as_jlong_bits()));
|
||||||
#else
|
#else
|
||||||
if (hi_word_offset_in_bytes > lo_word_offset_in_bytes) {
|
if (hi_word_offset_in_bytes > lo_word_offset_in_bytes) {
|
||||||
@ -2657,7 +2660,7 @@ int LinearScan::append_scope_value_for_operand(LIR_Opr opr, GrowableArray<ScopeV
|
|||||||
}
|
}
|
||||||
// Does this reverse on x86 vs. sparc?
|
// Does this reverse on x86 vs. sparc?
|
||||||
first = new LocationValue(loc1);
|
first = new LocationValue(loc1);
|
||||||
second = &_int_0_scope_value;
|
second = _int_0_scope_value;
|
||||||
#else
|
#else
|
||||||
Location loc1, loc2;
|
Location loc1, loc2;
|
||||||
if (!frame_map()->locations_for_slot(opr->double_stack_ix(), Location::normal, &loc1, &loc2)) {
|
if (!frame_map()->locations_for_slot(opr->double_stack_ix(), Location::normal, &loc1, &loc2)) {
|
||||||
@ -2671,7 +2674,7 @@ int LinearScan::append_scope_value_for_operand(LIR_Opr opr, GrowableArray<ScopeV
|
|||||||
#ifdef _LP64
|
#ifdef _LP64
|
||||||
VMReg rname_first = opr->as_register_lo()->as_VMReg();
|
VMReg rname_first = opr->as_register_lo()->as_VMReg();
|
||||||
first = new LocationValue(Location::new_reg_loc(Location::lng, rname_first));
|
first = new LocationValue(Location::new_reg_loc(Location::lng, rname_first));
|
||||||
second = &_int_0_scope_value;
|
second = _int_0_scope_value;
|
||||||
#else
|
#else
|
||||||
VMReg rname_first = opr->as_register_lo()->as_VMReg();
|
VMReg rname_first = opr->as_register_lo()->as_VMReg();
|
||||||
VMReg rname_second = opr->as_register_hi()->as_VMReg();
|
VMReg rname_second = opr->as_register_hi()->as_VMReg();
|
||||||
@ -2694,7 +2697,7 @@ int LinearScan::append_scope_value_for_operand(LIR_Opr opr, GrowableArray<ScopeV
|
|||||||
VMReg rname_first = opr->as_xmm_double_reg()->as_VMReg();
|
VMReg rname_first = opr->as_xmm_double_reg()->as_VMReg();
|
||||||
# ifdef _LP64
|
# ifdef _LP64
|
||||||
first = new LocationValue(Location::new_reg_loc(Location::dbl, rname_first));
|
first = new LocationValue(Location::new_reg_loc(Location::dbl, rname_first));
|
||||||
second = &_int_0_scope_value;
|
second = _int_0_scope_value;
|
||||||
# else
|
# else
|
||||||
first = new LocationValue(Location::new_reg_loc(Location::normal, rname_first));
|
first = new LocationValue(Location::new_reg_loc(Location::normal, rname_first));
|
||||||
// %%% This is probably a waste but we'll keep things as they were for now
|
// %%% This is probably a waste but we'll keep things as they were for now
|
||||||
@ -2741,7 +2744,7 @@ int LinearScan::append_scope_value_for_operand(LIR_Opr opr, GrowableArray<ScopeV
|
|||||||
|
|
||||||
#ifdef _LP64
|
#ifdef _LP64
|
||||||
first = new LocationValue(Location::new_reg_loc(Location::dbl, rname_first));
|
first = new LocationValue(Location::new_reg_loc(Location::dbl, rname_first));
|
||||||
second = &_int_0_scope_value;
|
second = _int_0_scope_value;
|
||||||
#else
|
#else
|
||||||
first = new LocationValue(Location::new_reg_loc(Location::normal, rname_first));
|
first = new LocationValue(Location::new_reg_loc(Location::normal, rname_first));
|
||||||
// %%% This is probably a waste but we'll keep things as they were for now
|
// %%% This is probably a waste but we'll keep things as they were for now
|
||||||
@ -2822,7 +2825,7 @@ int LinearScan::append_scope_value(int op_id, Value value, GrowableArray<ScopeVa
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// append a dummy value because real value not needed
|
// append a dummy value because real value not needed
|
||||||
scope_values->append(&_illegal_value);
|
scope_values->append(_illegal_value);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2865,7 +2868,7 @@ IRScopeDebugInfo* LinearScan::compute_debug_info_for_scope(int op_id, IRScope* c
|
|||||||
nof_locals = cur_scope->method()->max_locals();
|
nof_locals = cur_scope->method()->max_locals();
|
||||||
locals = new GrowableArray<ScopeValue*>(nof_locals);
|
locals = new GrowableArray<ScopeValue*>(nof_locals);
|
||||||
for(int i = 0; i < nof_locals; i++) {
|
for(int i = 0; i < nof_locals; i++) {
|
||||||
locals->append(&_illegal_value);
|
locals->append(_illegal_value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,11 +160,11 @@ class LinearScan : public CompilationResourceObj {
|
|||||||
// TODO: cached scope values for registers could be static
|
// TODO: cached scope values for registers could be static
|
||||||
ScopeValueArray _scope_value_cache;
|
ScopeValueArray _scope_value_cache;
|
||||||
|
|
||||||
static ConstantOopWriteValue _oop_null_scope_value;
|
static ConstantOopWriteValue* _oop_null_scope_value;
|
||||||
static ConstantIntValue _int_m1_scope_value;
|
static ConstantIntValue* _int_m1_scope_value;
|
||||||
static ConstantIntValue _int_0_scope_value;
|
static ConstantIntValue* _int_0_scope_value;
|
||||||
static ConstantIntValue _int_1_scope_value;
|
static ConstantIntValue* _int_1_scope_value;
|
||||||
static ConstantIntValue _int_2_scope_value;
|
static ConstantIntValue* _int_2_scope_value;
|
||||||
|
|
||||||
// accessors
|
// accessors
|
||||||
IR* ir() const { return _ir; }
|
IR* ir() const { return _ir; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user