comparison src/cpu/x86/vm/c1_Runtime1_x86.cpp @ 4970:33df1aeaebbf

Merge with http://hg.openjdk.java.net/hsx/hsx24/hotspot/
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Mon, 27 Feb 2012 13:10:13 +0100
parents e29339f342de 22cee0ee8927
children 8f01f899bccd
comparison
equal deleted inserted replaced
4703:2cfb7fb2dce7 4970:33df1aeaebbf
1059 __ push(rdi); 1059 __ push(rdi);
1060 __ push(rbx); 1060 __ push(rbx);
1061 1061
1062 if (id == fast_new_instance_init_check_id) { 1062 if (id == fast_new_instance_init_check_id) {
1063 // make sure the klass is initialized 1063 // make sure the klass is initialized
1064 __ cmpl(Address(klass, instanceKlass::init_state_offset_in_bytes() + sizeof(oopDesc)), instanceKlass::fully_initialized); 1064 __ cmpb(Address(klass, instanceKlass::init_state_offset()), instanceKlass::fully_initialized);
1065 __ jcc(Assembler::notEqual, slow_path); 1065 __ jcc(Assembler::notEqual, slow_path);
1066 } 1066 }
1067 1067
1068 #ifdef ASSERT 1068 #ifdef ASSERT
1069 // assert object can be fast path allocated 1069 // assert object can be fast path allocated
1070 { 1070 {
1071 Label ok, not_ok; 1071 Label ok, not_ok;
1072 __ movl(obj_size, Address(klass, Klass::layout_helper_offset_in_bytes() + sizeof(oopDesc))); 1072 __ movl(obj_size, Address(klass, Klass::layout_helper_offset()));
1073 __ cmpl(obj_size, 0); // make sure it's an instance (LH > 0) 1073 __ cmpl(obj_size, 0); // make sure it's an instance (LH > 0)
1074 __ jcc(Assembler::lessEqual, not_ok); 1074 __ jcc(Assembler::lessEqual, not_ok);
1075 __ testl(obj_size, Klass::_lh_instance_slow_path_bit); 1075 __ testl(obj_size, Klass::_lh_instance_slow_path_bit);
1076 __ jcc(Assembler::zero, ok); 1076 __ jcc(Assembler::zero, ok);
1077 __ bind(not_ok); 1077 __ bind(not_ok);
1088 __ tlab_refill(retry_tlab, try_eden, slow_path); // does not destroy rdx (klass), returns rdi 1088 __ tlab_refill(retry_tlab, try_eden, slow_path); // does not destroy rdx (klass), returns rdi
1089 1089
1090 __ bind(retry_tlab); 1090 __ bind(retry_tlab);
1091 1091
1092 // get the instance size (size is postive so movl is fine for 64bit) 1092 // get the instance size (size is postive so movl is fine for 64bit)
1093 __ movl(obj_size, Address(klass, klassOopDesc::header_size() * HeapWordSize + Klass::layout_helper_offset_in_bytes())); 1093 __ movl(obj_size, Address(klass, Klass::layout_helper_offset()));
1094 1094
1095 __ tlab_allocate(obj, obj_size, 0, t1, t2, slow_path); 1095 __ tlab_allocate(obj, obj_size, 0, t1, t2, slow_path);
1096 1096
1097 __ initialize_object(obj, klass, obj_size, 0, t1, t2); 1097 __ initialize_object(obj, klass, obj_size, 0, t1, t2);
1098 __ verify_oop(obj); 1098 __ verify_oop(obj);
1100 __ pop(rdi); 1100 __ pop(rdi);
1101 __ ret(0); 1101 __ ret(0);
1102 1102
1103 __ bind(try_eden); 1103 __ bind(try_eden);
1104 // get the instance size (size is postive so movl is fine for 64bit) 1104 // get the instance size (size is postive so movl is fine for 64bit)
1105 __ movl(obj_size, Address(klass, klassOopDesc::header_size() * HeapWordSize + Klass::layout_helper_offset_in_bytes())); 1105 __ movl(obj_size, Address(klass, Klass::layout_helper_offset()));
1106 1106
1107 __ eden_allocate(obj, obj_size, 0, t1, slow_path); 1107 __ eden_allocate(obj, obj_size, 0, t1, slow_path);
1108 __ incr_allocated_bytes(thread, obj_size, 0); 1108 __ incr_allocated_bytes(thread, obj_size, 0);
1109 1109
1110 __ initialize_object(obj, klass, obj_size, 0, t1, t2); 1110 __ initialize_object(obj, klass, obj_size, 0, t1, t2);
1167 #ifdef ASSERT 1167 #ifdef ASSERT
1168 // assert object type is really an array of the proper kind 1168 // assert object type is really an array of the proper kind
1169 { 1169 {
1170 Label ok; 1170 Label ok;
1171 Register t0 = obj; 1171 Register t0 = obj;
1172 __ movl(t0, Address(klass, Klass::layout_helper_offset_in_bytes() + sizeof(oopDesc))); 1172 __ movl(t0, Address(klass, Klass::layout_helper_offset()));
1173 __ sarl(t0, Klass::_lh_array_tag_shift); 1173 __ sarl(t0, Klass::_lh_array_tag_shift);
1174 int tag = ((id == new_type_array_id) 1174 int tag = ((id == new_type_array_id)
1175 ? Klass::_lh_array_tag_type_value 1175 ? Klass::_lh_array_tag_type_value
1176 : Klass::_lh_array_tag_obj_value); 1176 : Klass::_lh_array_tag_obj_value);
1177 __ cmpl(t0, tag); 1177 __ cmpl(t0, tag);
1201 1201
1202 __ bind(retry_tlab); 1202 __ bind(retry_tlab);
1203 1203
1204 // get the allocation size: round_up(hdr + length << (layout_helper & 0x1F)) 1204 // get the allocation size: round_up(hdr + length << (layout_helper & 0x1F))
1205 // since size is positive movl does right thing on 64bit 1205 // since size is positive movl does right thing on 64bit
1206 __ movl(t1, Address(klass, klassOopDesc::header_size() * HeapWordSize + Klass::layout_helper_offset_in_bytes())); 1206 __ movl(t1, Address(klass, Klass::layout_helper_offset()));
1207 // since size is postive movl does right thing on 64bit 1207 // since size is postive movl does right thing on 64bit
1208 __ movl(arr_size, length); 1208 __ movl(arr_size, length);
1209 assert(t1 == rcx, "fixed register usage"); 1209 assert(t1 == rcx, "fixed register usage");
1210 __ shlptr(arr_size /* by t1=rcx, mod 32 */); 1210 __ shlptr(arr_size /* by t1=rcx, mod 32 */);
1211 __ shrptr(t1, Klass::_lh_header_size_shift); 1211 __ shrptr(t1, Klass::_lh_header_size_shift);
1215 __ andptr(arr_size, ~MinObjAlignmentInBytesMask); 1215 __ andptr(arr_size, ~MinObjAlignmentInBytesMask);
1216 1216
1217 __ tlab_allocate(obj, arr_size, 0, t1, t2, slow_path); // preserves arr_size 1217 __ tlab_allocate(obj, arr_size, 0, t1, t2, slow_path); // preserves arr_size
1218 1218
1219 __ initialize_header(obj, klass, length, t1, t2); 1219 __ initialize_header(obj, klass, length, t1, t2);
1220 __ movb(t1, Address(klass, klassOopDesc::header_size() * HeapWordSize + Klass::layout_helper_offset_in_bytes() + (Klass::_lh_header_size_shift / BitsPerByte))); 1220 __ movb(t1, Address(klass, in_bytes(Klass::layout_helper_offset()) + (Klass::_lh_header_size_shift / BitsPerByte)));
1221 assert(Klass::_lh_header_size_shift % BitsPerByte == 0, "bytewise"); 1221 assert(Klass::_lh_header_size_shift % BitsPerByte == 0, "bytewise");
1222 assert(Klass::_lh_header_size_mask <= 0xFF, "bytewise"); 1222 assert(Klass::_lh_header_size_mask <= 0xFF, "bytewise");
1223 __ andptr(t1, Klass::_lh_header_size_mask); 1223 __ andptr(t1, Klass::_lh_header_size_mask);
1224 __ subptr(arr_size, t1); // body length 1224 __ subptr(arr_size, t1); // body length
1225 __ addptr(t1, obj); // body start 1225 __ addptr(t1, obj); // body start
1228 __ ret(0); 1228 __ ret(0);
1229 1229
1230 __ bind(try_eden); 1230 __ bind(try_eden);
1231 // get the allocation size: round_up(hdr + length << (layout_helper & 0x1F)) 1231 // get the allocation size: round_up(hdr + length << (layout_helper & 0x1F))
1232 // since size is positive movl does right thing on 64bit 1232 // since size is positive movl does right thing on 64bit
1233 __ movl(t1, Address(klass, klassOopDesc::header_size() * HeapWordSize + Klass::layout_helper_offset_in_bytes())); 1233 __ movl(t1, Address(klass, Klass::layout_helper_offset()));
1234 // since size is postive movl does right thing on 64bit 1234 // since size is postive movl does right thing on 64bit
1235 __ movl(arr_size, length); 1235 __ movl(arr_size, length);
1236 assert(t1 == rcx, "fixed register usage"); 1236 assert(t1 == rcx, "fixed register usage");
1237 __ shlptr(arr_size /* by t1=rcx, mod 32 */); 1237 __ shlptr(arr_size /* by t1=rcx, mod 32 */);
1238 __ shrptr(t1, Klass::_lh_header_size_shift); 1238 __ shrptr(t1, Klass::_lh_header_size_shift);
1243 1243
1244 __ eden_allocate(obj, arr_size, 0, t1, slow_path); // preserves arr_size 1244 __ eden_allocate(obj, arr_size, 0, t1, slow_path); // preserves arr_size
1245 __ incr_allocated_bytes(thread, arr_size, 0); 1245 __ incr_allocated_bytes(thread, arr_size, 0);
1246 1246
1247 __ initialize_header(obj, klass, length, t1, t2); 1247 __ initialize_header(obj, klass, length, t1, t2);
1248 __ movb(t1, Address(klass, klassOopDesc::header_size() * HeapWordSize + Klass::layout_helper_offset_in_bytes() + (Klass::_lh_header_size_shift / BitsPerByte))); 1248 __ movb(t1, Address(klass, in_bytes(Klass::layout_helper_offset()) + (Klass::_lh_header_size_shift / BitsPerByte)));
1249 assert(Klass::_lh_header_size_shift % BitsPerByte == 0, "bytewise"); 1249 assert(Klass::_lh_header_size_shift % BitsPerByte == 0, "bytewise");
1250 assert(Klass::_lh_header_size_mask <= 0xFF, "bytewise"); 1250 assert(Klass::_lh_header_size_mask <= 0xFF, "bytewise");
1251 __ andptr(t1, Klass::_lh_header_size_mask); 1251 __ andptr(t1, Klass::_lh_header_size_mask);
1252 __ subptr(arr_size, t1); // body length 1252 __ subptr(arr_size, t1); // body length
1253 __ addptr(t1, obj); // body start 1253 __ addptr(t1, obj); // body start
1320 1320
1321 // load the klass and check the has finalizer flag 1321 // load the klass and check the has finalizer flag
1322 Label register_finalizer; 1322 Label register_finalizer;
1323 Register t = rsi; 1323 Register t = rsi;
1324 __ load_klass(t, rax); 1324 __ load_klass(t, rax);
1325 __ movl(t, Address(t, Klass::access_flags_offset_in_bytes() + sizeof(oopDesc))); 1325 __ movl(t, Address(t, Klass::access_flags_offset()));
1326 __ testl(t, JVM_ACC_HAS_FINALIZER); 1326 __ testl(t, JVM_ACC_HAS_FINALIZER);
1327 __ jcc(Assembler::notZero, register_finalizer); 1327 __ jcc(Assembler::notZero, register_finalizer);
1328 __ ret(0); 1328 __ ret(0);
1329 1329
1330 __ bind(register_finalizer); 1330 __ bind(register_finalizer);