1.1 --- a/src/cpu/x86/vm/assembler_x86_64.cpp Wed May 21 10:45:07 2008 -0700 1.2 +++ b/src/cpu/x86/vm/assembler_x86_64.cpp Wed May 21 13:46:23 2008 -0700 1.3 @@ -683,7 +683,8 @@ 1.4 1.5 case REP8(0xB8): // movl/q r, #32/#64(oop?) 1.6 if (which == end_pc_operand) return ip + (is_64bit ? 8 : 4); 1.7 - assert((which == call32_operand || which == imm64_operand) && is_64bit, ""); 1.8 + assert((which == call32_operand || which == imm64_operand) && is_64bit || 1.9 + which == narrow_oop_operand && !is_64bit, ""); 1.10 return ip; 1.11 1.12 case 0x69: // imul r, a, #32 1.13 @@ -909,7 +910,8 @@ 1.14 } else if (r->is_call() || format == call32_operand) { 1.15 opnd = locate_operand(inst, call32_operand); 1.16 } else if (r->is_data()) { 1.17 - assert(format == imm64_operand || format == disp32_operand, "format ok"); 1.18 + assert(format == imm64_operand || format == disp32_operand || 1.19 + format == narrow_oop_operand, "format ok"); 1.20 opnd = locate_operand(inst, (WhichOperand) format); 1.21 } else { 1.22 assert(format == 0, "cannot specify a format"); 1.23 @@ -5157,12 +5159,9 @@ 1.24 void MacroAssembler::store_klass(Register dst, Register src) { 1.25 if (UseCompressedOops) { 1.26 encode_heap_oop_not_null(src); 1.27 - // zero the entire klass field first as the gap needs to be zeroed too. 1.28 - movptr(Address(dst, oopDesc::klass_offset_in_bytes()), NULL_WORD); 1.29 - movl(Address(dst, oopDesc::klass_offset_in_bytes()), src); 1.30 - } else { 1.31 - movq(Address(dst, oopDesc::klass_offset_in_bytes()), src); 1.32 + // Store to the wide klass field to zero the gap. 1.33 } 1.34 + movq(Address(dst, oopDesc::klass_offset_in_bytes()), src); 1.35 } 1.36 1.37 void MacroAssembler::load_heap_oop(Register dst, Address src) { 1.38 @@ -5188,13 +5187,15 @@ 1.39 void MacroAssembler::encode_heap_oop(Register r) { 1.40 assert (UseCompressedOops, "should be compressed"); 1.41 #ifdef ASSERT 1.42 - Label ok; 1.43 - pushq(rscratch1); // cmpptr trashes rscratch1 1.44 - cmpptr(r12_heapbase, ExternalAddress((address)Universe::heap_base_addr())); 1.45 - jcc(Assembler::equal, ok); 1.46 - stop("MacroAssembler::encode_heap_oop: heap base corrupted?"); 1.47 - bind(ok); 1.48 - popq(rscratch1); 1.49 + if (CheckCompressedOops) { 1.50 + Label ok; 1.51 + pushq(rscratch1); // cmpptr trashes rscratch1 1.52 + cmpptr(r12_heapbase, ExternalAddress((address)Universe::heap_base_addr())); 1.53 + jcc(Assembler::equal, ok); 1.54 + stop("MacroAssembler::encode_heap_oop: heap base corrupted?"); 1.55 + bind(ok); 1.56 + popq(rscratch1); 1.57 + } 1.58 #endif 1.59 verify_oop(r, "broken oop in encode_heap_oop"); 1.60 testq(r, r); 1.61 @@ -5206,11 +5207,13 @@ 1.62 void MacroAssembler::encode_heap_oop_not_null(Register r) { 1.63 assert (UseCompressedOops, "should be compressed"); 1.64 #ifdef ASSERT 1.65 - Label ok; 1.66 - testq(r, r); 1.67 - jcc(Assembler::notEqual, ok); 1.68 - stop("null oop passed to encode_heap_oop_not_null"); 1.69 - bind(ok); 1.70 + if (CheckCompressedOops) { 1.71 + Label ok; 1.72 + testq(r, r); 1.73 + jcc(Assembler::notEqual, ok); 1.74 + stop("null oop passed to encode_heap_oop_not_null"); 1.75 + bind(ok); 1.76 + } 1.77 #endif 1.78 verify_oop(r, "broken oop in encode_heap_oop_not_null"); 1.79 subq(r, r12_heapbase); 1.80 @@ -5220,11 +5223,13 @@ 1.81 void MacroAssembler::encode_heap_oop_not_null(Register dst, Register src) { 1.82 assert (UseCompressedOops, "should be compressed"); 1.83 #ifdef ASSERT 1.84 - Label ok; 1.85 - testq(src, src); 1.86 - jcc(Assembler::notEqual, ok); 1.87 - stop("null oop passed to encode_heap_oop_not_null2"); 1.88 - bind(ok); 1.89 + if (CheckCompressedOops) { 1.90 + Label ok; 1.91 + testq(src, src); 1.92 + jcc(Assembler::notEqual, ok); 1.93 + stop("null oop passed to encode_heap_oop_not_null2"); 1.94 + bind(ok); 1.95 + } 1.96 #endif 1.97 verify_oop(src, "broken oop in encode_heap_oop_not_null2"); 1.98 if (dst != src) { 1.99 @@ -5237,14 +5242,16 @@ 1.100 void MacroAssembler::decode_heap_oop(Register r) { 1.101 assert (UseCompressedOops, "should be compressed"); 1.102 #ifdef ASSERT 1.103 - Label ok; 1.104 - pushq(rscratch1); 1.105 - cmpptr(r12_heapbase, 1.106 - ExternalAddress((address)Universe::heap_base_addr())); 1.107 - jcc(Assembler::equal, ok); 1.108 - stop("MacroAssembler::decode_heap_oop: heap base corrupted?"); 1.109 - bind(ok); 1.110 - popq(rscratch1); 1.111 + if (CheckCompressedOops) { 1.112 + Label ok; 1.113 + pushq(rscratch1); 1.114 + cmpptr(r12_heapbase, 1.115 + ExternalAddress((address)Universe::heap_base_addr())); 1.116 + jcc(Assembler::equal, ok); 1.117 + stop("MacroAssembler::decode_heap_oop: heap base corrupted?"); 1.118 + bind(ok); 1.119 + popq(rscratch1); 1.120 + } 1.121 #endif 1.122 1.123 Label done; 1.124 @@ -5277,6 +5284,19 @@ 1.125 leaq(dst, Address(r12_heapbase, src, Address::times_8, 0)); 1.126 } 1.127 1.128 +void MacroAssembler::set_narrow_oop(Register dst, jobject obj) { 1.129 + assert(oop_recorder() != NULL, "this assembler needs an OopRecorder"); 1.130 + int oop_index = oop_recorder()->find_index(obj); 1.131 + RelocationHolder rspec = oop_Relocation::spec(oop_index); 1.132 + 1.133 + // movl dst,obj 1.134 + InstructionMark im(this); 1.135 + int encode = prefix_and_encode(dst->encoding()); 1.136 + emit_byte(0xB8 | encode); 1.137 + emit_data(oop_index, rspec, narrow_oop_operand); 1.138 +} 1.139 + 1.140 + 1.141 Assembler::Condition MacroAssembler::negate_condition(Assembler::Condition cond) { 1.142 switch (cond) { 1.143 // Note some conditions are synonyms for others