src/cpu/x86/vm/c1_MacroAssembler_x86.cpp

changeset 2344
ac637b7220d1
parent 2314
f95d63e2154a
child 2423
b1a2afa37ec4
equal deleted inserted replaced
2314:f95d63e2154a 2344:ac637b7220d1
153 movptr(Address(obj, oopDesc::mark_offset_in_bytes()), t1); 153 movptr(Address(obj, oopDesc::mark_offset_in_bytes()), t1);
154 } else { 154 } else {
155 // This assumes that all prototype bits fit in an int32_t 155 // This assumes that all prototype bits fit in an int32_t
156 movptr(Address(obj, oopDesc::mark_offset_in_bytes ()), (int32_t)(intptr_t)markOopDesc::prototype()); 156 movptr(Address(obj, oopDesc::mark_offset_in_bytes ()), (int32_t)(intptr_t)markOopDesc::prototype());
157 } 157 }
158 158 #ifdef _LP64
159 movptr(Address(obj, oopDesc::klass_offset_in_bytes()), klass); 159 if (UseCompressedOops) { // Take care not to kill klass
160 movptr(t1, klass);
161 encode_heap_oop_not_null(t1);
162 movl(Address(obj, oopDesc::klass_offset_in_bytes()), t1);
163 } else
164 #endif
165 {
166 movptr(Address(obj, oopDesc::klass_offset_in_bytes()), klass);
167 }
168
160 if (len->is_valid()) { 169 if (len->is_valid()) {
161 movl(Address(obj, arrayOopDesc::length_offset_in_bytes()), len); 170 movl(Address(obj, arrayOopDesc::length_offset_in_bytes()), len);
162 } 171 }
172 #ifdef _LP64
173 else if (UseCompressedOops) {
174 xorptr(t1, t1);
175 store_klass_gap(obj, t1);
176 }
177 #endif
163 } 178 }
164 179
165 180
166 // preserves obj, destroys len_in_bytes 181 // preserves obj, destroys len_in_bytes
167 void C1_MacroAssembler::initialize_body(Register obj, Register len_in_bytes, int hdr_size_in_bytes, Register t1) { 182 void C1_MacroAssembler::initialize_body(Register obj, Register len_in_bytes, int hdr_size_in_bytes, Register t1) {
228 } 243 }
229 244
230 void C1_MacroAssembler::initialize_object(Register obj, Register klass, Register var_size_in_bytes, int con_size_in_bytes, Register t1, Register t2) { 245 void C1_MacroAssembler::initialize_object(Register obj, Register klass, Register var_size_in_bytes, int con_size_in_bytes, Register t1, Register t2) {
231 assert((con_size_in_bytes & MinObjAlignmentInBytesMask) == 0, 246 assert((con_size_in_bytes & MinObjAlignmentInBytesMask) == 0,
232 "con_size_in_bytes is not multiple of alignment"); 247 "con_size_in_bytes is not multiple of alignment");
233 const int hdr_size_in_bytes = instanceOopDesc::base_offset_in_bytes(); 248 const int hdr_size_in_bytes = instanceOopDesc::header_size() * HeapWordSize;
234 249
235 initialize_header(obj, klass, noreg, t1, t2); 250 initialize_header(obj, klass, noreg, t1, t2);
236 251
237 // clear rest of allocated space 252 // clear rest of allocated space
238 const Register t1_zero = t1; 253 const Register t1_zero = t1;
315 verify_oop(receiver); 330 verify_oop(receiver);
316 // explicit NULL check not needed since load from [klass_offset] causes a trap 331 // explicit NULL check not needed since load from [klass_offset] causes a trap
317 // check against inline cache 332 // check against inline cache
318 assert(!MacroAssembler::needs_explicit_null_check(oopDesc::klass_offset_in_bytes()), "must add explicit null check"); 333 assert(!MacroAssembler::needs_explicit_null_check(oopDesc::klass_offset_in_bytes()), "must add explicit null check");
319 int start_offset = offset(); 334 int start_offset = offset();
320 cmpptr(iCache, Address(receiver, oopDesc::klass_offset_in_bytes())); 335
336 if (UseCompressedOops) {
337 load_klass(rscratch1, receiver);
338 cmpptr(rscratch1, iCache);
339 } else {
340 cmpptr(iCache, Address(receiver, oopDesc::klass_offset_in_bytes()));
341 }
321 // if icache check fails, then jump to runtime routine 342 // if icache check fails, then jump to runtime routine
322 // Note: RECEIVER must still contain the receiver! 343 // Note: RECEIVER must still contain the receiver!
323 jump_cc(Assembler::notEqual, 344 jump_cc(Assembler::notEqual,
324 RuntimeAddress(SharedRuntime::get_ic_miss_stub())); 345 RuntimeAddress(SharedRuntime::get_ic_miss_stub()));
325 const int ic_cmp_size = LP64_ONLY(10) NOT_LP64(9); 346 const int ic_cmp_size = LP64_ONLY(10) NOT_LP64(9);
326 assert(offset() - start_offset == ic_cmp_size, "check alignment in emit_method_entry"); 347 assert(UseCompressedOops || offset() - start_offset == ic_cmp_size, "check alignment in emit_method_entry");
327 } 348 }
328 349
329 350
330 void C1_MacroAssembler::build_frame(int frame_size_in_bytes) { 351 void C1_MacroAssembler::build_frame(int frame_size_in_bytes) {
331 // Make sure there is enough stack space for this method's activation. 352 // Make sure there is enough stack space for this method's activation.

mercurial