comparison src/share/vm/c1/c1_LIRGenerator.cpp @ 20519:b29261b17343

8059621: JVM crashes with "unexpected index type" assert in LIRGenerator::do_UnsafeGetRaw Summary: Get types from LIR instructions instead of HIR Reviewed-by: kvn
author iveresov
date Fri, 03 Oct 2014 13:34:46 -0700
parents a60a1309a03a
children 7848fc12602b
comparison
equal deleted inserted replaced
20518:23e730f036b1 20519:b29261b17343
2064 assert(!x->has_index() || idx.value() == x->index(), "should match"); 2064 assert(!x->has_index() || idx.value() == x->index(), "should match");
2065 2065
2066 LIR_Opr base_op = base.result(); 2066 LIR_Opr base_op = base.result();
2067 LIR_Opr index_op = idx.result(); 2067 LIR_Opr index_op = idx.result();
2068 #ifndef _LP64 2068 #ifndef _LP64
2069 if (x->base()->type()->tag() == longTag) { 2069 if (base_op->type() == T_LONG) {
2070 base_op = new_register(T_INT); 2070 base_op = new_register(T_INT);
2071 __ convert(Bytecodes::_l2i, base.result(), base_op); 2071 __ convert(Bytecodes::_l2i, base.result(), base_op);
2072 } 2072 }
2073 if (x->has_index()) { 2073 if (x->has_index()) {
2074 if (x->index()->type()->tag() == longTag) { 2074 if (index_op->type() == T_LONG) {
2075 LIR_Opr long_index_op = index_op; 2075 LIR_Opr long_index_op = index_op;
2076 if (x->index()->type()->is_constant()) { 2076 if (index_op->is_constant()) {
2077 long_index_op = new_register(T_LONG); 2077 long_index_op = new_register(T_LONG);
2078 __ move(index_op, long_index_op); 2078 __ move(index_op, long_index_op);
2079 } 2079 }
2080 index_op = new_register(T_INT); 2080 index_op = new_register(T_INT);
2081 __ convert(Bytecodes::_l2i, long_index_op, index_op); 2081 __ convert(Bytecodes::_l2i, long_index_op, index_op);
2086 // At this point base and index should be all ints. 2086 // At this point base and index should be all ints.
2087 assert(base_op->type() == T_INT && !base_op->is_constant(), "base should be an non-constant int"); 2087 assert(base_op->type() == T_INT && !base_op->is_constant(), "base should be an non-constant int");
2088 assert(!x->has_index() || index_op->type() == T_INT, "index should be an int"); 2088 assert(!x->has_index() || index_op->type() == T_INT, "index should be an int");
2089 #else 2089 #else
2090 if (x->has_index()) { 2090 if (x->has_index()) {
2091 if (x->index()->type()->tag() == intTag) { 2091 if (index_op->type() == T_INT) {
2092 if (!x->index()->type()->is_constant()) { 2092 if (!index_op->is_constant()) {
2093 index_op = new_register(T_LONG); 2093 index_op = new_register(T_LONG);
2094 __ convert(Bytecodes::_i2l, idx.result(), index_op); 2094 __ convert(Bytecodes::_i2l, idx.result(), index_op);
2095 } 2095 }
2096 } else { 2096 } else {
2097 assert(x->index()->type()->tag() == longTag, "must be"); 2097 assert(index_op->type() == T_LONG, "must be");
2098 if (x->index()->type()->is_constant()) { 2098 if (index_op->is_constant()) {
2099 index_op = new_register(T_LONG); 2099 index_op = new_register(T_LONG);
2100 __ move(idx.result(), index_op); 2100 __ move(idx.result(), index_op);
2101 } 2101 }
2102 } 2102 }
2103 } 2103 }
2174 2174
2175 LIR_Opr base_op = base.result(); 2175 LIR_Opr base_op = base.result();
2176 LIR_Opr index_op = idx.result(); 2176 LIR_Opr index_op = idx.result();
2177 2177
2178 #ifndef _LP64 2178 #ifndef _LP64
2179 if (x->base()->type()->tag() == longTag) { 2179 if (base_op->type() == T_LONG) {
2180 base_op = new_register(T_INT); 2180 base_op = new_register(T_INT);
2181 __ convert(Bytecodes::_l2i, base.result(), base_op); 2181 __ convert(Bytecodes::_l2i, base.result(), base_op);
2182 } 2182 }
2183 if (x->has_index()) { 2183 if (x->has_index()) {
2184 if (x->index()->type()->tag() == longTag) { 2184 if (index_op->type() == T_LONG) {
2185 index_op = new_register(T_INT); 2185 index_op = new_register(T_INT);
2186 __ convert(Bytecodes::_l2i, idx.result(), index_op); 2186 __ convert(Bytecodes::_l2i, idx.result(), index_op);
2187 } 2187 }
2188 } 2188 }
2189 // At this point base and index should be all ints and not constants 2189 // At this point base and index should be all ints and not constants
2190 assert(base_op->type() == T_INT && !base_op->is_constant(), "base should be an non-constant int"); 2190 assert(base_op->type() == T_INT && !base_op->is_constant(), "base should be an non-constant int");
2191 assert(!x->has_index() || (index_op->type() == T_INT && !index_op->is_constant()), "index should be an non-constant int"); 2191 assert(!x->has_index() || (index_op->type() == T_INT && !index_op->is_constant()), "index should be an non-constant int");
2192 #else 2192 #else
2193 if (x->has_index()) { 2193 if (x->has_index()) {
2194 if (x->index()->type()->tag() == intTag) { 2194 if (index_op->type() == T_INT) {
2195 index_op = new_register(T_LONG); 2195 index_op = new_register(T_LONG);
2196 __ convert(Bytecodes::_i2l, idx.result(), index_op); 2196 __ convert(Bytecodes::_i2l, idx.result(), index_op);
2197 } 2197 }
2198 } 2198 }
2199 // At this point base and index are long and non-constant 2199 // At this point base and index are long and non-constant