< prev index next >

src/cpu/x86/vm/macroAssembler_x86.cpp

Print this page
rev 8302 : 8078438: Interpreter should support conditional card marks (UseCondCardMark)
Reviewed-by: kvn
rev 8303 : 8079315: UseCondCardMark broken in conjunction with CMS precleaning
Summary: Insert StoreLoad barriers in CondCardMark sequence
Reviewed-by: kvn


4316   Address card_addr;
4317 
4318   // The calculation for byte_map_base is as follows:
4319   // byte_map_base = _byte_map - (uintptr_t(low_bound) >> card_shift);
4320   // So this essentially converts an address to a displacement and it will
4321   // never need to be relocated. On 64bit however the value may be too
4322   // large for a 32bit displacement.
4323   intptr_t disp = (intptr_t) ct->byte_map_base;
4324   if (is_simm32(disp)) {
4325     card_addr = Address(noreg, obj, Address::times_1, disp);
4326   } else {
4327     // By doing it as an ExternalAddress 'disp' could be converted to a rip-relative
4328     // displacement and done in a single instruction given favorable mapping and a
4329     // smarter version of as_Address. However, 'ExternalAddress' generates a relocation
4330     // entry and that entry is not properly handled by the relocation code.
4331     AddressLiteral cardtable((address)ct->byte_map_base, relocInfo::none);
4332     Address index(noreg, obj, Address::times_1);
4333     card_addr = as_Address(ArrayAddress(cardtable, index));
4334   }
4335 
4336   assert(card_addr != null, "sanity");
4337 
4338   int dirty = CardTableModRefBS::dirty_card_val();
4339   if (UseCondCardMark) {
4340     Label L_already_dirty;



4341     cmpb(card_addr, dirty);
4342     jcc(Assembler::equal, L_already_dirty);
4343     movb(card_addr, dirty);
4344     bind(L_already_dirty);
4345   } else {
4346     movb(card_addr, dirty);
4347   }
4348 }
4349 
4350 void MacroAssembler::subptr(Register dst, int32_t imm32) {
4351   LP64_ONLY(subq(dst, imm32)) NOT_LP64(subl(dst, imm32));
4352 }
4353 
4354 // Force generation of a 4 byte immediate value even if it fits into 8bit
4355 void MacroAssembler::subptr_imm32(Register dst, int32_t imm32) {
4356   LP64_ONLY(subq_imm32(dst, imm32)) NOT_LP64(subl_imm32(dst, imm32));
4357 }
4358 
4359 void MacroAssembler::subptr(Register dst, Register src) {
4360   LP64_ONLY(subq(dst, src)) NOT_LP64(subl(dst, src));




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


4336   int dirty = CardTableModRefBS::dirty_card_val();
4337   if (UseCondCardMark) {
4338     Label L_already_dirty;
4339     if (UseConcMarkSweepGC) {
4340       membar(Assembler::StoreLoad);
4341     }
4342     cmpb(card_addr, dirty);
4343     jcc(Assembler::equal, L_already_dirty);
4344     movb(card_addr, dirty);
4345     bind(L_already_dirty);
4346   } else {
4347     movb(card_addr, dirty);
4348   }
4349 }
4350 
4351 void MacroAssembler::subptr(Register dst, int32_t imm32) {
4352   LP64_ONLY(subq(dst, imm32)) NOT_LP64(subl(dst, imm32));
4353 }
4354 
4355 // Force generation of a 4 byte immediate value even if it fits into 8bit
4356 void MacroAssembler::subptr_imm32(Register dst, int32_t imm32) {
4357   LP64_ONLY(subq_imm32(dst, imm32)) NOT_LP64(subl_imm32(dst, imm32));
4358 }
4359 
4360 void MacroAssembler::subptr(Register dst, Register src) {
4361   LP64_ONLY(subq(dst, src)) NOT_LP64(subl(dst, src));


< prev index next >