1202 { |
1202 { |
1203 LIR_Address* addr = new LIR_Address(src, offset, type); |
1203 LIR_Address* addr = new LIR_Address(src, offset, type); |
1204 __ load(addr, dst); |
1204 __ load(addr, dst); |
1205 } |
1205 } |
1206 } |
1206 } |
|
1207 |
|
1208 void LIRGenerator::do_UnsafeGetAndSetObject(UnsafeGetAndSetObject* x) { |
|
1209 BasicType type = x->basic_type(); |
|
1210 LIRItem src(x->object(), this); |
|
1211 LIRItem off(x->offset(), this); |
|
1212 LIRItem value(x->value(), this); |
|
1213 |
|
1214 src.load_item(); |
|
1215 value.load_item(); |
|
1216 off.load_nonconstant(); |
|
1217 |
|
1218 LIR_Opr dst = rlock_result(x, type); |
|
1219 LIR_Opr data = value.result(); |
|
1220 bool is_obj = (type == T_ARRAY || type == T_OBJECT); |
|
1221 LIR_Opr offset = off.result(); |
|
1222 |
|
1223 if (data != dst) { |
|
1224 __ move(data, dst); |
|
1225 data = dst; |
|
1226 } |
|
1227 |
|
1228 assert (!x->is_add() && (type == T_INT || (is_obj LP64_ONLY(&& UseCompressedOops))), "unexpected type"); |
|
1229 LIR_Address* addr; |
|
1230 if (offset->is_constant()) { |
|
1231 |
|
1232 #ifdef _LP64 |
|
1233 jlong l = offset->as_jlong(); |
|
1234 assert((jlong)((jint)l) == l, "offset too large for constant"); |
|
1235 jint c = (jint)l; |
|
1236 #else |
|
1237 jint c = offset->as_jint(); |
|
1238 #endif |
|
1239 addr = new LIR_Address(src.result(), c, type); |
|
1240 } else { |
|
1241 addr = new LIR_Address(src.result(), offset, type); |
|
1242 } |
|
1243 |
|
1244 LIR_Opr tmp = LIR_OprFact::illegalOpr; |
|
1245 LIR_Opr ptr = LIR_OprFact::illegalOpr; |
|
1246 |
|
1247 if (is_obj) { |
|
1248 // Do the pre-write barrier, if any. |
|
1249 // barriers on sparc don't work with a base + index address |
|
1250 tmp = FrameMap::G3_opr; |
|
1251 ptr = new_pointer_register(); |
|
1252 __ add(src.result(), off.result(), ptr); |
|
1253 pre_barrier(ptr, LIR_OprFact::illegalOpr /* pre_val */, |
|
1254 true /* do_load */, false /* patch */, NULL); |
|
1255 } |
|
1256 __ xchg(LIR_OprFact::address(addr), data, dst, tmp); |
|
1257 if (is_obj) { |
|
1258 // Seems to be a precise address |
|
1259 post_barrier(ptr, data); |
|
1260 } |
|
1261 } |