16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "c1/c1_Compilation.hpp"
27 #include "c1/c1_FrameMap.hpp"
28 #include "c1/c1_Instruction.hpp"
29 #include "c1/c1_LIRAssembler.hpp"
30 #include "c1/c1_LIRGenerator.hpp"
31 #include "c1/c1_Runtime1.hpp"
32 #include "c1/c1_ValueStack.hpp"
33 #include "ci/ciArray.hpp"
34 #include "ci/ciObjArrayKlass.hpp"
35 #include "ci/ciTypeArrayKlass.hpp"
36 #include "gc/shared/c1/barrierSetC1.hpp"
37 #include "runtime/sharedRuntime.hpp"
38 #include "runtime/stubRoutines.hpp"
39 #include "vmreg_x86.inline.hpp"
40
41 #ifdef ASSERT
42 #define __ gen()->lir(__FILE__, __LINE__)->
43 #else
44 #define __ gen()->lir()->
45 #endif
46
47 // Item will be loaded into a byte register; Intel only
48 void LIRItem::load_byte_item() {
49 load_item();
50 LIR_Opr res = result();
51
52 if (!res->is_virtual() || !_gen->is_vreg_flag_set(res, LIRGenerator::byte_reg)) {
53 // make sure that it is a byte register
54 assert(!value()->type()->is_float() && !value()->type()->is_double(),
55 "can't load floats in byte register");
1181 assert(result->is_virtual(), "result must be virtual register");
1182 set_result(x, result);
1183 }
1184
1185
1186 void LIRGenerator::do_NewInstance(NewInstance* x) {
1187 print_if_not_loaded(x);
1188
1189 CodeEmitInfo* info = state_for(x, x->state());
1190 LIR_Opr reg = result_register_for(x->type());
1191 new_instance(reg, x->klass(), x->is_unresolved(),
1192 FrameMap::rcx_oop_opr,
1193 FrameMap::rdi_oop_opr,
1194 FrameMap::rsi_oop_opr,
1195 LIR_OprFact::illegalOpr,
1196 FrameMap::rdx_metadata_opr, info);
1197 LIR_Opr result = rlock_result(x);
1198 __ move(reg, result);
1199 }
1200
1201
1202 void LIRGenerator::do_NewTypeArray(NewTypeArray* x) {
1203 CodeEmitInfo* info = state_for(x, x->state());
1204
1205 LIRItem length(x->length(), this);
1206 length.load_item_force(FrameMap::rbx_opr);
1207
1208 LIR_Opr reg = result_register_for(x->type());
1209 LIR_Opr tmp1 = FrameMap::rcx_oop_opr;
1210 LIR_Opr tmp2 = FrameMap::rsi_oop_opr;
1211 LIR_Opr tmp3 = FrameMap::rdi_oop_opr;
1212 LIR_Opr tmp4 = reg;
1213 LIR_Opr klass_reg = FrameMap::rdx_metadata_opr;
1214 LIR_Opr len = length.result();
1215 BasicType elem_type = x->elt_type();
1216
1217 __ metadata2reg(ciTypeArrayKlass::make(elem_type)->constant_encoding(), klass_reg);
1218
1219 CodeStub* slow_path = new NewTypeArrayStub(klass_reg, len, reg, info);
1220 __ allocate_array(reg, len, tmp1, tmp2, tmp3, tmp4, elem_type, klass_reg, slow_path);
|
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "c1/c1_Compilation.hpp"
27 #include "c1/c1_FrameMap.hpp"
28 #include "c1/c1_Instruction.hpp"
29 #include "c1/c1_LIRAssembler.hpp"
30 #include "c1/c1_LIRGenerator.hpp"
31 #include "c1/c1_Runtime1.hpp"
32 #include "c1/c1_ValueStack.hpp"
33 #include "ci/ciArray.hpp"
34 #include "ci/ciObjArrayKlass.hpp"
35 #include "ci/ciTypeArrayKlass.hpp"
36 #include "ci/ciValueKlass.hpp"
37 #include "gc/shared/c1/barrierSetC1.hpp"
38 #include "runtime/sharedRuntime.hpp"
39 #include "runtime/stubRoutines.hpp"
40 #include "vmreg_x86.inline.hpp"
41
42 #ifdef ASSERT
43 #define __ gen()->lir(__FILE__, __LINE__)->
44 #else
45 #define __ gen()->lir()->
46 #endif
47
48 // Item will be loaded into a byte register; Intel only
49 void LIRItem::load_byte_item() {
50 load_item();
51 LIR_Opr res = result();
52
53 if (!res->is_virtual() || !_gen->is_vreg_flag_set(res, LIRGenerator::byte_reg)) {
54 // make sure that it is a byte register
55 assert(!value()->type()->is_float() && !value()->type()->is_double(),
56 "can't load floats in byte register");
1182 assert(result->is_virtual(), "result must be virtual register");
1183 set_result(x, result);
1184 }
1185
1186
1187 void LIRGenerator::do_NewInstance(NewInstance* x) {
1188 print_if_not_loaded(x);
1189
1190 CodeEmitInfo* info = state_for(x, x->state());
1191 LIR_Opr reg = result_register_for(x->type());
1192 new_instance(reg, x->klass(), x->is_unresolved(),
1193 FrameMap::rcx_oop_opr,
1194 FrameMap::rdi_oop_opr,
1195 FrameMap::rsi_oop_opr,
1196 LIR_OprFact::illegalOpr,
1197 FrameMap::rdx_metadata_opr, info);
1198 LIR_Opr result = rlock_result(x);
1199 __ move(reg, result);
1200 }
1201
1202 void LIRGenerator::do_NewValueTypeInstance (NewValueTypeInstance* x) {
1203 // Mapping to do_NewInstance (same code)
1204 CodeEmitInfo* info = state_for(x, x->state());
1205 x->set_to_object_type();
1206 LIR_Opr reg = result_register_for(x->type());
1207 new_instance(reg, x->klass(), x->is_unresolved(),
1208 FrameMap::rcx_oop_opr,
1209 FrameMap::rdi_oop_opr,
1210 FrameMap::rsi_oop_opr,
1211 LIR_OprFact::illegalOpr,
1212 FrameMap::rdx_metadata_opr, info);
1213 LIR_Opr result = rlock_result(x);
1214 __ move(reg, result);
1215
1216 }
1217
1218 void LIRGenerator::do_NewTypeArray(NewTypeArray* x) {
1219 CodeEmitInfo* info = state_for(x, x->state());
1220
1221 LIRItem length(x->length(), this);
1222 length.load_item_force(FrameMap::rbx_opr);
1223
1224 LIR_Opr reg = result_register_for(x->type());
1225 LIR_Opr tmp1 = FrameMap::rcx_oop_opr;
1226 LIR_Opr tmp2 = FrameMap::rsi_oop_opr;
1227 LIR_Opr tmp3 = FrameMap::rdi_oop_opr;
1228 LIR_Opr tmp4 = reg;
1229 LIR_Opr klass_reg = FrameMap::rdx_metadata_opr;
1230 LIR_Opr len = length.result();
1231 BasicType elem_type = x->elt_type();
1232
1233 __ metadata2reg(ciTypeArrayKlass::make(elem_type)->constant_encoding(), klass_reg);
1234
1235 CodeStub* slow_path = new NewTypeArrayStub(klass_reg, len, reg, info);
1236 __ allocate_array(reg, len, tmp1, tmp2, tmp3, tmp4, elem_type, klass_reg, slow_path);
|