Mercurial > hg > truffle
comparison src/share/vm/c1/c1_LIRGenerator.cpp @ 2002:ac637b7220d1
6985015: C1 needs to support compressed oops
Summary: This change implements compressed oops for C1 for x64 and sparc. The changes are mostly on the codegen level, with a few exceptions when we do access things outside of the heap that are uncompressed from the IR. Compressed oops are now also enabled with tiered.
Reviewed-by: twisti, kvn, never, phh
author | iveresov |
---|---|
date | Tue, 30 Nov 2010 23:23:40 -0800 |
parents | f95d63e2154a |
children | 5ddfcf4b079e |
comparison
equal
deleted
inserted
replaced
1972:f95d63e2154a | 2002:ac637b7220d1 |
---|---|
862 data_offset_reg); | 862 data_offset_reg); |
863 | 863 |
864 // MDO cells are intptr_t, so the data_reg width is arch-dependent. | 864 // MDO cells are intptr_t, so the data_reg width is arch-dependent. |
865 LIR_Opr data_reg = new_pointer_register(); | 865 LIR_Opr data_reg = new_pointer_register(); |
866 LIR_Address* data_addr = new LIR_Address(md_reg, data_offset_reg, data_reg->type()); | 866 LIR_Address* data_addr = new LIR_Address(md_reg, data_offset_reg, data_reg->type()); |
867 __ move(LIR_OprFact::address(data_addr), data_reg); | 867 __ move(data_addr, data_reg); |
868 // Use leal instead of add to avoid destroying condition codes on x86 | 868 // Use leal instead of add to avoid destroying condition codes on x86 |
869 LIR_Address* fake_incr_value = new LIR_Address(data_reg, DataLayout::counter_increment, T_INT); | 869 LIR_Address* fake_incr_value = new LIR_Address(data_reg, DataLayout::counter_increment, T_INT); |
870 __ leal(LIR_OprFact::address(fake_incr_value), data_reg); | 870 __ leal(LIR_OprFact::address(fake_incr_value), data_reg); |
871 __ move(data_reg, LIR_OprFact::address(data_addr)); | 871 __ move(data_reg, data_addr); |
872 } | 872 } |
873 } | 873 } |
874 | 874 |
875 // Phi technique: | 875 // Phi technique: |
876 // This is about passing live values from one basic block to the other. | 876 // This is about passing live values from one basic block to the other. |
1007 // handlers, so assign operands manually here | 1007 // handlers, so assign operands manually here |
1008 for_each_phi_fun(block(), phi, | 1008 for_each_phi_fun(block(), phi, |
1009 operand_for_instruction(phi)); | 1009 operand_for_instruction(phi)); |
1010 | 1010 |
1011 LIR_Opr thread_reg = getThreadPointer(); | 1011 LIR_Opr thread_reg = getThreadPointer(); |
1012 __ move(new LIR_Address(thread_reg, in_bytes(JavaThread::exception_oop_offset()), T_OBJECT), | 1012 __ move_wide(new LIR_Address(thread_reg, in_bytes(JavaThread::exception_oop_offset()), T_OBJECT), |
1013 exceptionOopOpr()); | 1013 exceptionOopOpr()); |
1014 __ move(LIR_OprFact::oopConst(NULL), | 1014 __ move_wide(LIR_OprFact::oopConst(NULL), |
1015 new LIR_Address(thread_reg, in_bytes(JavaThread::exception_oop_offset()), T_OBJECT)); | 1015 new LIR_Address(thread_reg, in_bytes(JavaThread::exception_oop_offset()), T_OBJECT)); |
1016 __ move(LIR_OprFact::oopConst(NULL), | 1016 __ move_wide(LIR_OprFact::oopConst(NULL), |
1017 new LIR_Address(thread_reg, in_bytes(JavaThread::exception_pc_offset()), T_OBJECT)); | 1017 new LIR_Address(thread_reg, in_bytes(JavaThread::exception_pc_offset()), T_OBJECT)); |
1018 | 1018 |
1019 LIR_Opr result = new_register(T_OBJECT); | 1019 LIR_Opr result = new_register(T_OBJECT); |
1020 __ move(exceptionOopOpr(), result); | 1020 __ move(exceptionOopOpr(), result); |
1021 set_result(x, result); | 1021 set_result(x, result); |
1022 } | 1022 } |
1083 | 1083 |
1084 | 1084 |
1085 void LIRGenerator::do_Return(Return* x) { | 1085 void LIRGenerator::do_Return(Return* x) { |
1086 if (compilation()->env()->dtrace_method_probes()) { | 1086 if (compilation()->env()->dtrace_method_probes()) { |
1087 BasicTypeList signature; | 1087 BasicTypeList signature; |
1088 signature.append(T_INT); // thread | 1088 signature.append(LP64_ONLY(T_LONG) NOT_LP64(T_INT)); // thread |
1089 signature.append(T_OBJECT); // methodOop | 1089 signature.append(T_OBJECT); // methodOop |
1090 LIR_OprList* args = new LIR_OprList(); | 1090 LIR_OprList* args = new LIR_OprList(); |
1091 args->append(getThreadPointer()); | 1091 args->append(getThreadPointer()); |
1092 LIR_Opr meth = new_register(T_OBJECT); | 1092 LIR_Opr meth = new_register(T_OBJECT); |
1093 __ oop2reg(method()->constant_encoding(), meth); | 1093 __ oop2reg(method()->constant_encoding(), meth); |
1120 CodeEmitInfo* info = NULL; | 1120 CodeEmitInfo* info = NULL; |
1121 if (x->needs_null_check()) { | 1121 if (x->needs_null_check()) { |
1122 info = state_for(x); | 1122 info = state_for(x); |
1123 } | 1123 } |
1124 __ move(new LIR_Address(rcvr.result(), oopDesc::klass_offset_in_bytes(), T_OBJECT), result, info); | 1124 __ move(new LIR_Address(rcvr.result(), oopDesc::klass_offset_in_bytes(), T_OBJECT), result, info); |
1125 __ move(new LIR_Address(result, Klass::java_mirror_offset_in_bytes() + | 1125 __ move_wide(new LIR_Address(result, Klass::java_mirror_offset_in_bytes() + |
1126 klassOopDesc::klass_part_offset_in_bytes(), T_OBJECT), result); | 1126 klassOopDesc::klass_part_offset_in_bytes(), T_OBJECT), result); |
1127 } | 1127 } |
1128 | 1128 |
1129 | 1129 |
1130 // Example: Thread.currentThread() | 1130 // Example: Thread.currentThread() |
1131 void LIRGenerator::do_currentThread(Intrinsic* x) { | 1131 void LIRGenerator::do_currentThread(Intrinsic* x) { |
1132 assert(x->number_of_arguments() == 0, "wrong type"); | 1132 assert(x->number_of_arguments() == 0, "wrong type"); |
1133 LIR_Opr reg = rlock_result(x); | 1133 LIR_Opr reg = rlock_result(x); |
1134 __ load(new LIR_Address(getThreadPointer(), in_bytes(JavaThread::threadObj_offset()), T_OBJECT), reg); | 1134 __ move_wide(new LIR_Address(getThreadPointer(), in_bytes(JavaThread::threadObj_offset()), T_OBJECT), reg); |
1135 } | 1135 } |
1136 | 1136 |
1137 | 1137 |
1138 void LIRGenerator::do_RegisterFinalizer(Intrinsic* x) { | 1138 void LIRGenerator::do_RegisterFinalizer(Intrinsic* x) { |
1139 assert(x->number_of_arguments() == 1, "wrong type"); | 1139 assert(x->number_of_arguments() == 1, "wrong type"); |
1906 } | 1906 } |
1907 | 1907 |
1908 if (x->may_be_unaligned() && (dst_type == T_LONG || dst_type == T_DOUBLE)) { | 1908 if (x->may_be_unaligned() && (dst_type == T_LONG || dst_type == T_DOUBLE)) { |
1909 __ unaligned_move(addr, reg); | 1909 __ unaligned_move(addr, reg); |
1910 } else { | 1910 } else { |
1911 __ move(addr, reg); | 1911 if (dst_type == T_OBJECT && x->is_wide()) { |
1912 __ move_wide(addr, reg); | |
1913 } else { | |
1914 __ move(addr, reg); | |
1915 } | |
1912 } | 1916 } |
1913 } | 1917 } |
1914 | 1918 |
1915 | 1919 |
1916 void LIRGenerator::do_UnsafePutRaw(UnsafePutRaw* x) { | 1920 void LIRGenerator::do_UnsafePutRaw(UnsafePutRaw* x) { |
2285 java_index += type2size[t]; | 2289 java_index += type2size[t]; |
2286 } | 2290 } |
2287 | 2291 |
2288 if (compilation()->env()->dtrace_method_probes()) { | 2292 if (compilation()->env()->dtrace_method_probes()) { |
2289 BasicTypeList signature; | 2293 BasicTypeList signature; |
2290 signature.append(T_INT); // thread | 2294 signature.append(LP64_ONLY(T_LONG) NOT_LP64(T_INT)); // thread |
2291 signature.append(T_OBJECT); // methodOop | 2295 signature.append(T_OBJECT); // methodOop |
2292 LIR_OprList* args = new LIR_OprList(); | 2296 LIR_OprList* args = new LIR_OprList(); |
2293 args->append(getThreadPointer()); | 2297 args->append(getThreadPointer()); |
2294 LIR_Opr meth = new_register(T_OBJECT); | 2298 LIR_Opr meth = new_register(T_OBJECT); |
2295 __ oop2reg(method()->constant_encoding(), meth); | 2299 __ oop2reg(method()->constant_encoding(), meth); |
2350 if (loc->is_register()) { | 2354 if (loc->is_register()) { |
2351 param->load_item_force(loc); | 2355 param->load_item_force(loc); |
2352 } else { | 2356 } else { |
2353 LIR_Address* addr = loc->as_address_ptr(); | 2357 LIR_Address* addr = loc->as_address_ptr(); |
2354 param->load_for_store(addr->type()); | 2358 param->load_for_store(addr->type()); |
2355 if (addr->type() == T_LONG || addr->type() == T_DOUBLE) { | 2359 if (addr->type() == T_OBJECT) { |
2356 __ unaligned_move(param->result(), addr); | 2360 __ move_wide(param->result(), addr); |
2357 } else { | 2361 } else |
2358 __ move(param->result(), addr); | 2362 if (addr->type() == T_LONG || addr->type() == T_DOUBLE) { |
2359 } | 2363 __ unaligned_move(param->result(), addr); |
2364 } else { | |
2365 __ move(param->result(), addr); | |
2366 } | |
2360 } | 2367 } |
2361 } | 2368 } |
2362 | 2369 |
2363 if (x->has_receiver()) { | 2370 if (x->has_receiver()) { |
2364 LIRItem* receiver = args->at(0); | 2371 LIRItem* receiver = args->at(0); |
2366 if (loc->is_register()) { | 2373 if (loc->is_register()) { |
2367 receiver->load_item_force(loc); | 2374 receiver->load_item_force(loc); |
2368 } else { | 2375 } else { |
2369 assert(loc->is_address(), "just checking"); | 2376 assert(loc->is_address(), "just checking"); |
2370 receiver->load_for_store(T_OBJECT); | 2377 receiver->load_for_store(T_OBJECT); |
2371 __ move(receiver->result(), loc); | 2378 __ move_wide(receiver->result(), loc->as_address_ptr()); |
2372 } | 2379 } |
2373 } | 2380 } |
2374 } | 2381 } |
2375 | 2382 |
2376 | 2383 |