提交 40b91c27 编写于 作者: I iveresov

8029668: Kithcensink crashed with guarantee(Assembler::is_simm13(disp))...

8029668: Kithcensink crashed with guarantee(Assembler::is_simm13(disp)) failed: Do not match large constant offsets
Summary: Bailout if we try to reference a stack location that we can't encode
Reviewed-by: kvn, twisti
上级 de53f6db
...@@ -757,7 +757,7 @@ void verify_oops_warning(const MachNode *n, int ideal_op, int mem_op) { ...@@ -757,7 +757,7 @@ void verify_oops_warning(const MachNode *n, int ideal_op, int mem_op) {
#endif #endif
void emit_form3_mem_reg(CodeBuffer &cbuf, const MachNode* n, int primary, int tertiary, void emit_form3_mem_reg(CodeBuffer &cbuf, PhaseRegAlloc* ra, const MachNode* n, int primary, int tertiary,
int src1_enc, int disp32, int src2_enc, int dst_enc) { int src1_enc, int disp32, int src2_enc, int dst_enc) {
#ifdef ASSERT #ifdef ASSERT
...@@ -912,8 +912,14 @@ void emit_form3_mem_reg(CodeBuffer &cbuf, const MachNode* n, int primary, int te ...@@ -912,8 +912,14 @@ void emit_form3_mem_reg(CodeBuffer &cbuf, const MachNode* n, int primary, int te
uint index = src2_enc; uint index = src2_enc;
int disp = disp32; int disp = disp32;
if (src1_enc == R_SP_enc || src1_enc == R_FP_enc) if (src1_enc == R_SP_enc || src1_enc == R_FP_enc) {
disp += STACK_BIAS; disp += STACK_BIAS;
// Quick fix for JDK-8029668: check that stack offset fits, bailout if not
if (!Assembler::is_simm13(disp)) {
ra->C->record_method_not_compilable("unable to handle large constant offsets");
return;
}
}
// We should have a compiler bailout here rather than a guarantee. // We should have a compiler bailout here rather than a guarantee.
// Better yet would be some mechanism to handle variable-size matches correctly. // Better yet would be some mechanism to handle variable-size matches correctly.
...@@ -1279,19 +1285,14 @@ static enum RC rc_class( OptoReg::Name reg ) { ...@@ -1279,19 +1285,14 @@ static enum RC rc_class( OptoReg::Name reg ) {
return rc_float; return rc_float;
} }
static int impl_helper( const MachNode *mach, CodeBuffer *cbuf, PhaseRegAlloc *ra_, bool do_size, bool is_load, int offset, int reg, int opcode, const char *op_str, int size, outputStream* st ) { static int impl_helper(const MachNode* mach, CodeBuffer* cbuf, PhaseRegAlloc* ra, bool do_size, bool is_load, int offset, int reg, int opcode, const char *op_str, int size, outputStream* st ) {
if( cbuf ) { if (cbuf) {
// Better yet would be some mechanism to handle variable-size matches correctly emit_form3_mem_reg(*cbuf, ra, mach, opcode, -1, R_SP_enc, offset, 0, Matcher::_regEncode[reg]);
if (!Assembler::is_simm13(offset + STACK_BIAS)) {
ra_->C->record_method_not_compilable("unable to handle large constant offsets");
} else {
emit_form3_mem_reg(*cbuf, mach, opcode, -1, R_SP_enc, offset, 0, Matcher::_regEncode[reg]);
}
} }
#ifndef PRODUCT #ifndef PRODUCT
else if( !do_size ) { else if (!do_size) {
if( size != 0 ) st->print("\n\t"); if (size != 0) st->print("\n\t");
if( is_load ) st->print("%s [R_SP + #%d],R_%s\t! spill",op_str,offset,OptoReg::regname(reg)); if (is_load) st->print("%s [R_SP + #%d],R_%s\t! spill",op_str,offset,OptoReg::regname(reg));
else st->print("%s R_%s,[R_SP + #%d]\t! spill",op_str,OptoReg::regname(reg),offset); else st->print("%s R_%s,[R_SP + #%d]\t! spill",op_str,OptoReg::regname(reg),offset);
} }
#endif #endif
...@@ -2087,22 +2088,22 @@ encode %{ ...@@ -2087,22 +2088,22 @@ encode %{
%} %}
enc_class form3_mem_reg( memory mem, iRegI dst ) %{ enc_class form3_mem_reg( memory mem, iRegI dst ) %{
emit_form3_mem_reg(cbuf, this, $primary, $tertiary, emit_form3_mem_reg(cbuf, ra_, this, $primary, $tertiary,
$mem$$base, $mem$$disp, $mem$$index, $dst$$reg); $mem$$base, $mem$$disp, $mem$$index, $dst$$reg);
%} %}
enc_class simple_form3_mem_reg( memory mem, iRegI dst ) %{ enc_class simple_form3_mem_reg( memory mem, iRegI dst ) %{
emit_form3_mem_reg(cbuf, this, $primary, -1, emit_form3_mem_reg(cbuf, ra_, this, $primary, -1,
$mem$$base, $mem$$disp, $mem$$index, $dst$$reg); $mem$$base, $mem$$disp, $mem$$index, $dst$$reg);
%} %}
enc_class form3_mem_prefetch_read( memory mem ) %{ enc_class form3_mem_prefetch_read( memory mem ) %{
emit_form3_mem_reg(cbuf, this, $primary, -1, emit_form3_mem_reg(cbuf, ra_, this, $primary, -1,
$mem$$base, $mem$$disp, $mem$$index, 0/*prefetch function many-reads*/); $mem$$base, $mem$$disp, $mem$$index, 0/*prefetch function many-reads*/);
%} %}
enc_class form3_mem_prefetch_write( memory mem ) %{ enc_class form3_mem_prefetch_write( memory mem ) %{
emit_form3_mem_reg(cbuf, this, $primary, -1, emit_form3_mem_reg(cbuf, ra_, this, $primary, -1,
$mem$$base, $mem$$disp, $mem$$index, 2/*prefetch function many-writes*/); $mem$$base, $mem$$disp, $mem$$index, 2/*prefetch function many-writes*/);
%} %}
...@@ -2110,8 +2111,8 @@ encode %{ ...@@ -2110,8 +2111,8 @@ encode %{
assert(Assembler::is_simm13($mem$$disp ), "need disp and disp+4"); assert(Assembler::is_simm13($mem$$disp ), "need disp and disp+4");
assert(Assembler::is_simm13($mem$$disp+4), "need disp and disp+4"); assert(Assembler::is_simm13($mem$$disp+4), "need disp and disp+4");
guarantee($mem$$index == R_G0_enc, "double index?"); guarantee($mem$$index == R_G0_enc, "double index?");
emit_form3_mem_reg(cbuf, this, $primary, -1, $mem$$base, $mem$$disp+4, R_G0_enc, R_O7_enc ); emit_form3_mem_reg(cbuf, ra_, this, $primary, -1, $mem$$base, $mem$$disp+4, R_G0_enc, R_O7_enc );
emit_form3_mem_reg(cbuf, this, $primary, -1, $mem$$base, $mem$$disp, R_G0_enc, $reg$$reg ); emit_form3_mem_reg(cbuf, ra_, this, $primary, -1, $mem$$base, $mem$$disp, R_G0_enc, $reg$$reg );
emit3_simm13( cbuf, Assembler::arith_op, $reg$$reg, Assembler::sllx_op3, $reg$$reg, 0x1020 ); emit3_simm13( cbuf, Assembler::arith_op, $reg$$reg, Assembler::sllx_op3, $reg$$reg, 0x1020 );
emit3( cbuf, Assembler::arith_op, $reg$$reg, Assembler::or_op3, $reg$$reg, 0, R_O7_enc ); emit3( cbuf, Assembler::arith_op, $reg$$reg, Assembler::or_op3, $reg$$reg, 0, R_O7_enc );
%} %}
...@@ -2121,14 +2122,14 @@ encode %{ ...@@ -2121,14 +2122,14 @@ encode %{
assert(Assembler::is_simm13($mem$$disp+4), "need disp and disp+4"); assert(Assembler::is_simm13($mem$$disp+4), "need disp and disp+4");
guarantee($mem$$index == R_G0_enc, "double index?"); guarantee($mem$$index == R_G0_enc, "double index?");
// Load long with 2 instructions // Load long with 2 instructions
emit_form3_mem_reg(cbuf, this, $primary, -1, $mem$$base, $mem$$disp, R_G0_enc, $reg$$reg+0 ); emit_form3_mem_reg(cbuf, ra_, this, $primary, -1, $mem$$base, $mem$$disp, R_G0_enc, $reg$$reg+0 );
emit_form3_mem_reg(cbuf, this, $primary, -1, $mem$$base, $mem$$disp+4, R_G0_enc, $reg$$reg+1 ); emit_form3_mem_reg(cbuf, ra_, this, $primary, -1, $mem$$base, $mem$$disp+4, R_G0_enc, $reg$$reg+1 );
%} %}
//%%% form3_mem_plus_4_reg is a hack--get rid of it //%%% form3_mem_plus_4_reg is a hack--get rid of it
enc_class form3_mem_plus_4_reg( memory mem, iRegI dst ) %{ enc_class form3_mem_plus_4_reg( memory mem, iRegI dst ) %{
guarantee($mem$$disp, "cannot offset a reg-reg operand by 4"); guarantee($mem$$disp, "cannot offset a reg-reg operand by 4");
emit_form3_mem_reg(cbuf, this, $primary, -1, $mem$$base, $mem$$disp + 4, $mem$$index, $dst$$reg); emit_form3_mem_reg(cbuf, ra_, this, $primary, -1, $mem$$base, $mem$$disp + 4, $mem$$index, $dst$$reg);
%} %}
enc_class form3_g0_rs2_rd_move( iRegI rs2, iRegI rd ) %{ enc_class form3_g0_rs2_rd_move( iRegI rs2, iRegI rd ) %{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册