Mercurial > hg > truffle
comparison src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp @ 7066:7d815d842ee0
Merge.
author | Christian Haeubl <haeubl@ssw.jku.at> |
---|---|
date | Fri, 23 Nov 2012 11:50:27 +0100 |
parents | 7eca5de9e0b6 |
children | 46f6f063b272 |
comparison
equal
deleted
inserted
replaced
7065:cfacf5d5bade | 7066:7d815d842ee0 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
882 CodeEmitInfo* info = state_for(x, x->state()); | 882 CodeEmitInfo* info = state_for(x, x->state()); |
883 LIR_Opr tmp1 = FrameMap::G1_oop_opr; | 883 LIR_Opr tmp1 = FrameMap::G1_oop_opr; |
884 LIR_Opr tmp2 = FrameMap::G3_oop_opr; | 884 LIR_Opr tmp2 = FrameMap::G3_oop_opr; |
885 LIR_Opr tmp3 = FrameMap::G4_oop_opr; | 885 LIR_Opr tmp3 = FrameMap::G4_oop_opr; |
886 LIR_Opr tmp4 = FrameMap::O1_oop_opr; | 886 LIR_Opr tmp4 = FrameMap::O1_oop_opr; |
887 LIR_Opr klass_reg = FrameMap::G5_oop_opr; | 887 LIR_Opr klass_reg = FrameMap::G5_metadata_opr; |
888 new_instance(reg, x->klass(), tmp1, tmp2, tmp3, tmp4, klass_reg, info); | 888 new_instance(reg, x->klass(), tmp1, tmp2, tmp3, tmp4, klass_reg, info); |
889 LIR_Opr result = rlock_result(x); | 889 LIR_Opr result = rlock_result(x); |
890 __ move(reg, result); | 890 __ move(reg, result); |
891 } | 891 } |
892 | 892 |
901 LIR_Opr reg = result_register_for(x->type()); | 901 LIR_Opr reg = result_register_for(x->type()); |
902 LIR_Opr tmp1 = FrameMap::G1_oop_opr; | 902 LIR_Opr tmp1 = FrameMap::G1_oop_opr; |
903 LIR_Opr tmp2 = FrameMap::G3_oop_opr; | 903 LIR_Opr tmp2 = FrameMap::G3_oop_opr; |
904 LIR_Opr tmp3 = FrameMap::G4_oop_opr; | 904 LIR_Opr tmp3 = FrameMap::G4_oop_opr; |
905 LIR_Opr tmp4 = FrameMap::O1_oop_opr; | 905 LIR_Opr tmp4 = FrameMap::O1_oop_opr; |
906 LIR_Opr klass_reg = FrameMap::G5_oop_opr; | 906 LIR_Opr klass_reg = FrameMap::G5_metadata_opr; |
907 LIR_Opr len = length.result(); | 907 LIR_Opr len = length.result(); |
908 BasicType elem_type = x->elt_type(); | 908 BasicType elem_type = x->elt_type(); |
909 | 909 |
910 __ oop2reg(ciTypeArrayKlass::make(elem_type)->constant_encoding(), klass_reg); | 910 __ metadata2reg(ciTypeArrayKlass::make(elem_type)->constant_encoding(), klass_reg); |
911 | 911 |
912 CodeStub* slow_path = new NewTypeArrayStub(klass_reg, len, reg, info); | 912 CodeStub* slow_path = new NewTypeArrayStub(klass_reg, len, reg, info); |
913 __ allocate_array(reg, len, tmp1, tmp2, tmp3, tmp4, elem_type, klass_reg, slow_path); | 913 __ allocate_array(reg, len, tmp1, tmp2, tmp3, tmp4, elem_type, klass_reg, slow_path); |
914 | 914 |
915 LIR_Opr result = rlock_result(x); | 915 LIR_Opr result = rlock_result(x); |
933 const LIR_Opr reg = result_register_for(x->type()); | 933 const LIR_Opr reg = result_register_for(x->type()); |
934 LIR_Opr tmp1 = FrameMap::G1_oop_opr; | 934 LIR_Opr tmp1 = FrameMap::G1_oop_opr; |
935 LIR_Opr tmp2 = FrameMap::G3_oop_opr; | 935 LIR_Opr tmp2 = FrameMap::G3_oop_opr; |
936 LIR_Opr tmp3 = FrameMap::G4_oop_opr; | 936 LIR_Opr tmp3 = FrameMap::G4_oop_opr; |
937 LIR_Opr tmp4 = FrameMap::O1_oop_opr; | 937 LIR_Opr tmp4 = FrameMap::O1_oop_opr; |
938 LIR_Opr klass_reg = FrameMap::G5_oop_opr; | 938 LIR_Opr klass_reg = FrameMap::G5_metadata_opr; |
939 LIR_Opr len = length.result(); | 939 LIR_Opr len = length.result(); |
940 | 940 |
941 CodeStub* slow_path = new NewObjectArrayStub(klass_reg, len, reg, info); | 941 CodeStub* slow_path = new NewObjectArrayStub(klass_reg, len, reg, info); |
942 ciObject* obj = (ciObject*) ciObjArrayKlass::make(x->klass()); | 942 ciMetadata* obj = ciObjArrayKlass::make(x->klass()); |
943 if (obj == ciEnv::unloaded_ciobjarrayklass()) { | 943 if (obj == ciEnv::unloaded_ciobjarrayklass()) { |
944 BAILOUT("encountered unloaded_ciobjarrayklass due to out of memory error"); | 944 BAILOUT("encountered unloaded_ciobjarrayklass due to out of memory error"); |
945 } | 945 } |
946 jobject2reg_with_patching(klass_reg, obj, patching_info); | 946 klass2reg_with_patching(klass_reg, obj, patching_info); |
947 __ allocate_array(reg, len, tmp1, tmp2, tmp3, tmp4, T_OBJECT, klass_reg, slow_path); | 947 __ allocate_array(reg, len, tmp1, tmp2, tmp3, tmp4, T_OBJECT, klass_reg, slow_path); |
948 | 948 |
949 LIR_Opr result = rlock_result(x); | 949 LIR_Opr result = rlock_result(x); |
950 __ move(reg, result); | 950 __ move(reg, result); |
951 } | 951 } |
983 i * sizeof(jint))); | 983 i * sizeof(jint))); |
984 } | 984 } |
985 | 985 |
986 // This instruction can be deoptimized in the slow path : use | 986 // This instruction can be deoptimized in the slow path : use |
987 // O0 as result register. | 987 // O0 as result register. |
988 const LIR_Opr reg = result_register_for(x->type()); | 988 const LIR_Opr klass_reg = FrameMap::O0_metadata_opr; |
989 jobject2reg_with_patching(reg, x->klass(), patching_info); | 989 klass2reg_with_patching(klass_reg, x->klass(), patching_info); |
990 LIR_Opr rank = FrameMap::O1_opr; | 990 LIR_Opr rank = FrameMap::O1_opr; |
991 __ move(LIR_OprFact::intConst(x->rank()), rank); | 991 __ move(LIR_OprFact::intConst(x->rank()), rank); |
992 LIR_Opr varargs = FrameMap::as_pointer_opr(O2); | 992 LIR_Opr varargs = FrameMap::as_pointer_opr(O2); |
993 int offset_from_sp = (frame::memory_parameter_word_sp_offset * wordSize) + STACK_BIAS; | 993 int offset_from_sp = (frame::memory_parameter_word_sp_offset * wordSize) + STACK_BIAS; |
994 __ add(FrameMap::SP_opr, | 994 __ add(FrameMap::SP_opr, |
995 LIR_OprFact::intptrConst(offset_from_sp), | 995 LIR_OprFact::intptrConst(offset_from_sp), |
996 varargs); | 996 varargs); |
997 LIR_OprList* args = new LIR_OprList(3); | 997 LIR_OprList* args = new LIR_OprList(3); |
998 args->append(reg); | 998 args->append(klass_reg); |
999 args->append(rank); | 999 args->append(rank); |
1000 args->append(varargs); | 1000 args->append(varargs); |
1001 const LIR_Opr reg = result_register_for(x->type()); | |
1001 __ call_runtime(Runtime1::entry_for(Runtime1::new_multi_array_id), | 1002 __ call_runtime(Runtime1::entry_for(Runtime1::new_multi_array_id), |
1002 LIR_OprFact::illegalOpr, | 1003 LIR_OprFact::illegalOpr, |
1003 reg, args, info); | 1004 reg, args, info); |
1004 | 1005 |
1005 LIR_Opr result = rlock_result(x); | 1006 LIR_Opr result = rlock_result(x); |
1201 { | 1202 { |
1202 LIR_Address* addr = new LIR_Address(src, offset, type); | 1203 LIR_Address* addr = new LIR_Address(src, offset, type); |
1203 __ load(addr, dst); | 1204 __ load(addr, dst); |
1204 } | 1205 } |
1205 } | 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 } |