comparison src/cpu/x86/vm/macroAssembler_x86.cpp @ 13086:096c224171c4

Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/
author Doug Simon <doug.simon@oracle.com>
date Wed, 20 Nov 2013 00:10:38 +0100
parents 359f7e70ae7f be525e91f65b
children 02f27ecb4f3a
comparison
equal deleted inserted replaced
12782:92b7ec34ddfa 13086:096c224171c4
1379 subptr(tmp, os::vm_page_size()); 1379 subptr(tmp, os::vm_page_size());
1380 subl(size, os::vm_page_size()); 1380 subl(size, os::vm_page_size());
1381 jcc(Assembler::greater, loop); 1381 jcc(Assembler::greater, loop);
1382 1382
1383 // Bang down shadow pages too. 1383 // Bang down shadow pages too.
1384 // The -1 because we already subtracted 1 page. 1384 // At this point, (tmp-0) is the last address touched, so don't
1385 for (int i = 0; i< StackShadowPages-1; i++) { 1385 // touch it again. (It was touched as (tmp-pagesize) but then tmp
1386 // was post-decremented.) Skip this address by starting at i=1, and
1387 // touch a few more pages below. N.B. It is important to touch all
1388 // the way down to and including i=StackShadowPages.
1389 for (int i = 1; i <= StackShadowPages; i++) {
1386 // this could be any sized move but this is can be a debugging crumb 1390 // this could be any sized move but this is can be a debugging crumb
1387 // so the bigger the better. 1391 // so the bigger the better.
1388 movptr(Address(tmp, (-i*os::vm_page_size())), size ); 1392 movptr(Address(tmp, (-i*os::vm_page_size())), size );
1389 } 1393 }
1390 } 1394 }
3387 3391
3388 Address index(noreg, card_index, Address::times_1); 3392 Address index(noreg, card_index, Address::times_1);
3389 const Register card_addr = tmp; 3393 const Register card_addr = tmp;
3390 lea(card_addr, as_Address(ArrayAddress(cardtable, index))); 3394 lea(card_addr, as_Address(ArrayAddress(cardtable, index)));
3391 #endif 3395 #endif
3392 cmpb(Address(card_addr, 0), 0); 3396 cmpb(Address(card_addr, 0), (int)G1SATBCardTableModRefBS::g1_young_card_val());
3393 jcc(Assembler::equal, done); 3397 jcc(Assembler::equal, done);
3398
3399 membar(Assembler::Membar_mask_bits(Assembler::StoreLoad));
3400 cmpb(Address(card_addr, 0), (int)CardTableModRefBS::dirty_card_val());
3401 jcc(Assembler::equal, done);
3402
3394 3403
3395 // storing a region crossing, non-NULL oop, card is clean. 3404 // storing a region crossing, non-NULL oop, card is clean.
3396 // dirty card and log. 3405 // dirty card and log.
3397 3406
3398 movb(Address(card_addr, 0), 0); 3407 movb(Address(card_addr, 0), (int)CardTableModRefBS::dirty_card_val());
3399 3408
3400 cmpl(queue_index, 0); 3409 cmpl(queue_index, 0);
3401 jcc(Assembler::equal, runtime); 3410 jcc(Assembler::equal, runtime);
3402 subl(queue_index, wordSize); 3411 subl(queue_index, wordSize);
3403 movptr(tmp2, buffer); 3412 movptr(tmp2, buffer);
5042 } 5051 }
5043 } 5052 }
5044 } 5053 }
5045 5054
5046 void MacroAssembler::encode_klass_not_null(Register r) { 5055 void MacroAssembler::encode_klass_not_null(Register r) {
5047 assert(Universe::narrow_klass_base() != NULL, "Base should be initialized"); 5056 if (Universe::narrow_klass_base() != NULL) {
5048 // Use r12 as a scratch register in which to temporarily load the narrow_klass_base. 5057 // Use r12 as a scratch register in which to temporarily load the narrow_klass_base.
5049 assert(r != r12_heapbase, "Encoding a klass in r12"); 5058 assert(r != r12_heapbase, "Encoding a klass in r12");
5050 mov64(r12_heapbase, (int64_t)Universe::narrow_klass_base()); 5059 mov64(r12_heapbase, (int64_t)Universe::narrow_klass_base());
5051 subq(r, r12_heapbase); 5060 subq(r, r12_heapbase);
5061 }
5052 if (Universe::narrow_klass_shift() != 0) { 5062 if (Universe::narrow_klass_shift() != 0) {
5053 assert (LogKlassAlignmentInBytes == Universe::narrow_klass_shift(), "decode alg wrong"); 5063 assert (LogKlassAlignmentInBytes == Universe::narrow_klass_shift(), "decode alg wrong");
5054 shrq(r, LogKlassAlignmentInBytes); 5064 shrq(r, LogKlassAlignmentInBytes);
5055 } 5065 }
5056 reinit_heapbase(); 5066 if (Universe::narrow_klass_base() != NULL) {
5067 reinit_heapbase();
5068 }
5057 } 5069 }
5058 5070
5059 void MacroAssembler::encode_klass_not_null(Register dst, Register src) { 5071 void MacroAssembler::encode_klass_not_null(Register dst, Register src) {
5060 if (dst == src) { 5072 if (dst == src) {
5061 encode_klass_not_null(src); 5073 encode_klass_not_null(src);
5062 } else { 5074 } else {
5063 mov64(dst, (int64_t)Universe::narrow_klass_base()); 5075 if (Universe::narrow_klass_base() != NULL) {
5064 negq(dst); 5076 mov64(dst, (int64_t)Universe::narrow_klass_base());
5065 addq(dst, src); 5077 negq(dst);
5078 addq(dst, src);
5079 } else {
5080 movptr(dst, src);
5081 }
5066 if (Universe::narrow_klass_shift() != 0) { 5082 if (Universe::narrow_klass_shift() != 0) {
5067 assert (LogKlassAlignmentInBytes == Universe::narrow_klass_shift(), "decode alg wrong"); 5083 assert (LogKlassAlignmentInBytes == Universe::narrow_klass_shift(), "decode alg wrong");
5068 shrq(dst, LogKlassAlignmentInBytes); 5084 shrq(dst, LogKlassAlignmentInBytes);
5069 } 5085 }
5070 } 5086 }
5074 // generated by decode_klass_not_null(register r) and reinit_heapbase(), 5090 // generated by decode_klass_not_null(register r) and reinit_heapbase(),
5075 // when (Universe::heap() != NULL). Hence, if the instructions they 5091 // when (Universe::heap() != NULL). Hence, if the instructions they
5076 // generate change, then this method needs to be updated. 5092 // generate change, then this method needs to be updated.
5077 int MacroAssembler::instr_size_for_decode_klass_not_null() { 5093 int MacroAssembler::instr_size_for_decode_klass_not_null() {
5078 assert (UseCompressedClassPointers, "only for compressed klass ptrs"); 5094 assert (UseCompressedClassPointers, "only for compressed klass ptrs");
5079 // mov64 + addq + shlq? + mov64 (for reinit_heapbase()). 5095 if (Universe::narrow_klass_base() != NULL) {
5080 return (Universe::narrow_klass_shift() == 0 ? 20 : 24); 5096 // mov64 + addq + shlq? + mov64 (for reinit_heapbase()).
5097 return (Universe::narrow_klass_shift() == 0 ? 20 : 24);
5098 } else {
5099 // longest load decode klass function, mov64, leaq
5100 return 16;
5101 }
5081 } 5102 }
5082 5103
5083 // !!! If the instructions that get generated here change then function 5104 // !!! If the instructions that get generated here change then function
5084 // instr_size_for_decode_klass_not_null() needs to get updated. 5105 // instr_size_for_decode_klass_not_null() needs to get updated.
5085 void MacroAssembler::decode_klass_not_null(Register r) { 5106 void MacroAssembler::decode_klass_not_null(Register r) {
5086 // Note: it will change flags 5107 // Note: it will change flags
5087 assert(Universe::narrow_klass_base() != NULL, "Base should be initialized");
5088 assert (UseCompressedClassPointers, "should only be used for compressed headers"); 5108 assert (UseCompressedClassPointers, "should only be used for compressed headers");
5089 assert(r != r12_heapbase, "Decoding a klass in r12"); 5109 assert(r != r12_heapbase, "Decoding a klass in r12");
5090 // Cannot assert, unverified entry point counts instructions (see .ad file) 5110 // Cannot assert, unverified entry point counts instructions (see .ad file)
5091 // vtableStubs also counts instructions in pd_code_size_limit. 5111 // vtableStubs also counts instructions in pd_code_size_limit.
5092 // Also do not verify_oop as this is called by verify_oop. 5112 // Also do not verify_oop as this is called by verify_oop.
5093 if (Universe::narrow_klass_shift() != 0) { 5113 if (Universe::narrow_klass_shift() != 0) {
5094 assert(LogKlassAlignmentInBytes == Universe::narrow_klass_shift(), "decode alg wrong"); 5114 assert(LogKlassAlignmentInBytes == Universe::narrow_klass_shift(), "decode alg wrong");
5095 shlq(r, LogKlassAlignmentInBytes); 5115 shlq(r, LogKlassAlignmentInBytes);
5096 } 5116 }
5097 // Use r12 as a scratch register in which to temporarily load the narrow_klass_base. 5117 // Use r12 as a scratch register in which to temporarily load the narrow_klass_base.
5098 mov64(r12_heapbase, (int64_t)Universe::narrow_klass_base()); 5118 if (Universe::narrow_klass_base() != NULL) {
5099 addq(r, r12_heapbase); 5119 mov64(r12_heapbase, (int64_t)Universe::narrow_klass_base());
5100 reinit_heapbase(); 5120 addq(r, r12_heapbase);
5121 reinit_heapbase();
5122 }
5101 } 5123 }
5102 5124
5103 void MacroAssembler::decode_klass_not_null(Register dst, Register src) { 5125 void MacroAssembler::decode_klass_not_null(Register dst, Register src) {
5104 // Note: it will change flags 5126 // Note: it will change flags
5105 assert(Universe::narrow_klass_base() != NULL, "Base should be initialized");
5106 assert (UseCompressedClassPointers, "should only be used for compressed headers"); 5127 assert (UseCompressedClassPointers, "should only be used for compressed headers");
5107 if (dst == src) { 5128 if (dst == src) {
5108 decode_klass_not_null(dst); 5129 decode_klass_not_null(dst);
5109 } else { 5130 } else {
5110 // Cannot assert, unverified entry point counts instructions (see .ad file) 5131 // Cannot assert, unverified entry point counts instructions (see .ad file)
5111 // vtableStubs also counts instructions in pd_code_size_limit. 5132 // vtableStubs also counts instructions in pd_code_size_limit.
5112 // Also do not verify_oop as this is called by verify_oop. 5133 // Also do not verify_oop as this is called by verify_oop.
5113
5114 mov64(dst, (int64_t)Universe::narrow_klass_base()); 5134 mov64(dst, (int64_t)Universe::narrow_klass_base());
5115 if (Universe::narrow_klass_shift() != 0) { 5135 if (Universe::narrow_klass_shift() != 0) {
5116 assert(LogKlassAlignmentInBytes == Universe::narrow_klass_shift(), "decode alg wrong"); 5136 assert(LogKlassAlignmentInBytes == Universe::narrow_klass_shift(), "decode alg wrong");
5117 assert(LogKlassAlignmentInBytes == Address::times_8, "klass not aligned on 64bits?"); 5137 assert(LogKlassAlignmentInBytes == Address::times_8, "klass not aligned on 64bits?");
5118 leaq(dst, Address(dst, src, Address::times_8, 0)); 5138 leaq(dst, Address(dst, src, Address::times_8, 0));