src/cpu/x86/vm/macroAssembler_x86.cpp

Print this page




4266   // save the live input values
4267   push(store_addr);
4268   push(new_val);
4269 #ifdef _LP64
4270   call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_post), card_addr, r15_thread);
4271 #else
4272   push(thread);
4273   call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_post), card_addr, thread);
4274   pop(thread);
4275 #endif
4276   pop(new_val);
4277   pop(store_addr);
4278 
4279   bind(done);
4280 }
4281 
4282 #endif // INCLUDE_ALL_GCS
4283 //////////////////////////////////////////////////////////////////////////////////
4284 
4285 
4286 void MacroAssembler::store_check(Register obj) {
4287   // Does a store check for the oop in register obj. The content of
4288   // register obj is destroyed afterwards.
4289   store_check_part_1(obj);
4290   store_check_part_2(obj);
4291 }
4292 
4293 void MacroAssembler::store_check(Register obj, Address dst) {
4294   store_check(obj);
4295 }
4296 



4297 
4298 // split the store check operation so that other instructions can be scheduled inbetween
4299 void MacroAssembler::store_check_part_1(Register obj) {
4300   BarrierSet* bs = Universe::heap()->barrier_set();
4301   assert(bs->kind() == BarrierSet::CardTableModRef, "Wrong barrier set kind");
4302   shrptr(obj, CardTableModRefBS::card_shift);
4303 }
4304 
4305 void MacroAssembler::store_check_part_2(Register obj) {
4306   BarrierSet* bs = Universe::heap()->barrier_set();
4307   assert(bs->kind() == BarrierSet::CardTableModRef, "Wrong barrier set kind");
4308   CardTableModRefBS* ct = barrier_set_cast<CardTableModRefBS>(bs);
4309   assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code");
4310 




4311   // The calculation for byte_map_base is as follows:
4312   // byte_map_base = _byte_map - (uintptr_t(low_bound) >> card_shift);
4313   // So this essentially converts an address to a displacement and it will
4314   // never need to be relocated. On 64bit however the value may be too
4315   // large for a 32bit displacement.
4316   intptr_t disp = (intptr_t) ct->byte_map_base;
4317   if (is_simm32(disp)) {
4318     Address cardtable(noreg, obj, Address::times_1, disp);
4319     movb(cardtable, 0);
4320   } else {
4321     // By doing it as an ExternalAddress 'disp' could be converted to a rip-relative
4322     // displacement and done in a single instruction given favorable mapping and a
4323     // smarter version of as_Address. However, 'ExternalAddress' generates a relocation
4324     // entry and that entry is not properly handled by the relocation code.
4325     AddressLiteral cardtable((address)ct->byte_map_base, relocInfo::none);
4326     Address index(noreg, obj, Address::times_1);
4327     movb(as_Address(ArrayAddress(cardtable, index)), 0);













4328   }
4329 }
4330 
4331 void MacroAssembler::subptr(Register dst, int32_t imm32) {
4332   LP64_ONLY(subq(dst, imm32)) NOT_LP64(subl(dst, imm32));
4333 }
4334 
4335 // Force generation of a 4 byte immediate value even if it fits into 8bit
4336 void MacroAssembler::subptr_imm32(Register dst, int32_t imm32) {
4337   LP64_ONLY(subq_imm32(dst, imm32)) NOT_LP64(subl_imm32(dst, imm32));
4338 }
4339 
4340 void MacroAssembler::subptr(Register dst, Register src) {
4341   LP64_ONLY(subq(dst, src)) NOT_LP64(subl(dst, src));
4342 }
4343 
4344 // C++ bool manipulation
4345 void MacroAssembler::testbool(Register dst) {
4346   if(sizeof(bool) == 1)
4347     testb(dst, 0xff);




4266   // save the live input values
4267   push(store_addr);
4268   push(new_val);
4269 #ifdef _LP64
4270   call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_post), card_addr, r15_thread);
4271 #else
4272   push(thread);
4273   call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_post), card_addr, thread);
4274   pop(thread);
4275 #endif
4276   pop(new_val);
4277   pop(store_addr);
4278 
4279   bind(done);
4280 }
4281 
4282 #endif // INCLUDE_ALL_GCS
4283 //////////////////////////////////////////////////////////////////////////////////
4284 
4285 







4286 void MacroAssembler::store_check(Register obj, Address dst) {
4287   store_check(obj);
4288 }
4289 
4290 void MacroAssembler::store_check(Register obj) {
4291   // Does a store check for the oop in register obj. The content of
4292   // register obj is destroyed afterwards.
4293 


4294   BarrierSet* bs = Universe::heap()->barrier_set();
4295   assert(bs->kind() == BarrierSet::CardTableModRef, "Wrong barrier set kind");


4296 



4297   CardTableModRefBS* ct = barrier_set_cast<CardTableModRefBS>(bs);
4298   assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code");
4299 
4300   shrptr(obj, CardTableModRefBS::card_shift);
4301 
4302   Address card_addr;
4303 
4304   // The calculation for byte_map_base is as follows:
4305   // byte_map_base = _byte_map - (uintptr_t(low_bound) >> card_shift);
4306   // So this essentially converts an address to a displacement and it will
4307   // never need to be relocated. On 64bit however the value may be too
4308   // large for a 32bit displacement.
4309   intptr_t disp = (intptr_t) ct->byte_map_base;
4310   if (is_simm32(disp)) {
4311     card_addr = Address(noreg, obj, Address::times_1, disp);

4312   } else {
4313     // By doing it as an ExternalAddress 'disp' could be converted to a rip-relative
4314     // displacement and done in a single instruction given favorable mapping and a
4315     // smarter version of as_Address. However, 'ExternalAddress' generates a relocation
4316     // entry and that entry is not properly handled by the relocation code.
4317     AddressLiteral cardtable((address)ct->byte_map_base, relocInfo::none);
4318     Address index(noreg, obj, Address::times_1);
4319     card_addr = as_Address(ArrayAddress(cardtable, index));
4320   }
4321 
4322   assert(card_addr != null, "sanity");
4323 
4324   int dirty = CardTableModRefBS::dirty_card_val();
4325   if (UseCondCardMark) {
4326     Label L_already_dirty;
4327     cmpb(card_addr, dirty);
4328     jcc(Assembler::equal, L_already_dirty);
4329     movb(card_addr, dirty);
4330     bind(L_already_dirty);
4331   } else {
4332     movb(card_addr, dirty);
4333   }
4334 }
4335 
4336 void MacroAssembler::subptr(Register dst, int32_t imm32) {
4337   LP64_ONLY(subq(dst, imm32)) NOT_LP64(subl(dst, imm32));
4338 }
4339 
4340 // Force generation of a 4 byte immediate value even if it fits into 8bit
4341 void MacroAssembler::subptr_imm32(Register dst, int32_t imm32) {
4342   LP64_ONLY(subq_imm32(dst, imm32)) NOT_LP64(subl_imm32(dst, imm32));
4343 }
4344 
4345 void MacroAssembler::subptr(Register dst, Register src) {
4346   LP64_ONLY(subq(dst, src)) NOT_LP64(subl(dst, src));
4347 }
4348 
4349 // C++ bool manipulation
4350 void MacroAssembler::testbool(Register dst) {
4351   if(sizeof(bool) == 1)
4352     testb(dst, 0xff);