< prev index next >

src/hotspot/cpu/x86/macroAssembler_x86.cpp

Print this page

4521 
4522 void MacroAssembler::load_mirror(Register mirror, Register method, Register tmp) {
4523   // get mirror
4524   const int mirror_offset = in_bytes(Klass::java_mirror_offset());
4525   load_method_holder(mirror, method);
4526   movptr(mirror, Address(mirror, mirror_offset));
4527   resolve_oop_handle(mirror, tmp);
4528 }
4529 
4530 void MacroAssembler::load_method_holder_cld(Register rresult, Register rmethod) {
4531   load_method_holder(rresult, rmethod);
4532   movptr(rresult, Address(rresult, InstanceKlass::class_loader_data_offset()));
4533 }
4534 
4535 void MacroAssembler::load_method_holder(Register holder, Register method) {
4536   movptr(holder, Address(method, Method::const_offset()));                      // ConstMethod*
4537   movptr(holder, Address(holder, ConstMethod::constants_offset()));             // ConstantPool*
4538   movptr(holder, Address(holder, ConstantPool::pool_holder_offset_in_bytes())); // InstanceKlass*
4539 }
4540 
4541 void MacroAssembler::load_klass(Register dst, Register src, Register tmp) {
4542   assert_different_registers(src, tmp);
4543   assert_different_registers(dst, tmp);
4544 #ifdef _LP64
4545   if (UseCompressedClassPointers) {
4546     movl(dst, Address(src, oopDesc::klass_offset_in_bytes()));
4547     decode_klass_not_null(dst, tmp);
4548   } else

















































4549 #endif
4550     movptr(dst, Address(src, oopDesc::klass_offset_in_bytes()));
4551 }
4552 
4553 void MacroAssembler::store_klass(Register dst, Register src, Register tmp) {
4554   assert_different_registers(src, tmp);
4555   assert_different_registers(dst, tmp);
4556 #ifdef _LP64
4557   if (UseCompressedClassPointers) {
4558     encode_klass_not_null(src, tmp);
4559     movl(Address(dst, oopDesc::klass_offset_in_bytes()), src);
4560   } else
4561 #endif
4562     movptr(Address(dst, oopDesc::klass_offset_in_bytes()), src);
4563 }
4564 
4565 void MacroAssembler::access_load_at(BasicType type, DecoratorSet decorators, Register dst, Address src,
4566                                     Register tmp1, Register thread_tmp) {
4567   BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler();
4568   decorators = AccessInternal::decorator_fixup(decorators);
4569   bool as_raw = (decorators & AS_RAW) != 0;
4570   if (as_raw) {

4521 
4522 void MacroAssembler::load_mirror(Register mirror, Register method, Register tmp) {
4523   // get mirror
4524   const int mirror_offset = in_bytes(Klass::java_mirror_offset());
4525   load_method_holder(mirror, method);
4526   movptr(mirror, Address(mirror, mirror_offset));
4527   resolve_oop_handle(mirror, tmp);
4528 }
4529 
4530 void MacroAssembler::load_method_holder_cld(Register rresult, Register rmethod) {
4531   load_method_holder(rresult, rmethod);
4532   movptr(rresult, Address(rresult, InstanceKlass::class_loader_data_offset()));
4533 }
4534 
4535 void MacroAssembler::load_method_holder(Register holder, Register method) {
4536   movptr(holder, Address(method, Method::const_offset()));                      // ConstMethod*
4537   movptr(holder, Address(holder, ConstMethod::constants_offset()));             // ConstantPool*
4538   movptr(holder, Address(holder, ConstantPool::pool_holder_offset_in_bytes())); // InstanceKlass*
4539 }
4540 
4541 void MacroAssembler::load_klass(Register dst, Register src, Register tmp, bool null_check_src) {
4542   assert_different_registers(src, tmp);
4543   assert_different_registers(dst, tmp);
4544 #ifdef _LP64
4545   assert(UseCompressedClassPointers, "expect compressed class pointers");
4546 
4547   Label slow, done;
4548   if (null_check_src) {
4549     null_check(src, oopDesc::mark_offset_in_bytes());
4550   }
4551   movq(tmp, Address(src, oopDesc::mark_offset_in_bytes()));
4552   // NOTE: While it would seem nice to use xorb instead (for which we don't have an encoding in our assembler),
4553   // the encoding for xorq uses the signed version (0x81/6) of xor, which encodes as compact as xorb would,
4554   // and does't make a difference performance-wise.
4555   xorq(tmp, markWord::unlocked_value);
4556   testb(tmp, markWord::lock_mask_in_place);
4557   jccb(Assembler::notZero, slow);
4558 
4559   movq(dst, tmp);
4560   shrq(dst, markWord::klass_shift);
4561   decode_klass_not_null(dst, tmp);
4562   jmp(done);
4563   bind(slow);
4564 
4565   if (dst != rax) {
4566     push(rax);
4567   }
4568   push(rdi);
4569   push(rsi);
4570   push(rdx);
4571   push(rcx);
4572   push(r8);
4573   push(r9);
4574   push(r10);
4575   push(r11);
4576 
4577   MacroAssembler::call_VM_leaf(CAST_FROM_FN_PTR(address, oopDesc::load_klass_runtime), src);
4578 
4579   pop(r11);
4580   pop(r10);
4581   pop(r9);
4582   pop(r8);
4583   pop(rcx);
4584   pop(rdx);
4585   pop(rsi);
4586   pop(rdi);
4587   if (dst != rax) {
4588     mov(dst, rax);
4589     pop(rax);
4590   }
4591 
4592   bind(done);
4593 #else
4594   if (null_check_src) {
4595     null_check(src, oopDesc::klass_offset_in_bytes());
4596   }
4597   movptr(dst, Address(src, oopDesc::klass_offset_in_bytes()));
4598 #endif

4599 }
4600 
4601 void MacroAssembler::store_klass(Register dst, Register src, Register tmp) {
4602   assert_different_registers(src, tmp);
4603   assert_different_registers(dst, tmp);
4604 #ifdef _LP64
4605   if (UseCompressedClassPointers) {
4606     encode_klass_not_null(src, tmp);
4607     movl(Address(dst, oopDesc::klass_offset_in_bytes()), src);
4608   } else
4609 #endif
4610     movptr(Address(dst, oopDesc::klass_offset_in_bytes()), src);
4611 }
4612 
4613 void MacroAssembler::access_load_at(BasicType type, DecoratorSet decorators, Register dst, Address src,
4614                                     Register tmp1, Register thread_tmp) {
4615   BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler();
4616   decorators = AccessInternal::decorator_fixup(decorators);
4617   bool as_raw = (decorators & AS_RAW) != 0;
4618   if (as_raw) {
< prev index next >