< prev index next >

src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp

Print this page

4461   adrp(rscratch1, src2, offset);
4462   ldr(rscratch1, Address(rscratch1, offset));
4463   cmp(src1, rscratch1);
4464 }
4465 
4466 void MacroAssembler::cmpoop(Register obj1, Register obj2) {
4467   cmp(obj1, obj2);
4468 }
4469 
4470 void MacroAssembler::load_method_holder_cld(Register rresult, Register rmethod) {
4471   load_method_holder(rresult, rmethod);
4472   ldr(rresult, Address(rresult, InstanceKlass::class_loader_data_offset()));
4473 }
4474 
4475 void MacroAssembler::load_method_holder(Register holder, Register method) {
4476   ldr(holder, Address(method, Method::const_offset()));                      // ConstMethod*
4477   ldr(holder, Address(holder, ConstMethod::constants_offset()));             // ConstantPool*
4478   ldr(holder, Address(holder, ConstantPool::pool_holder_offset()));          // InstanceKlass*
4479 }
4480 



















4481 void MacroAssembler::load_klass(Register dst, Register src) {
4482   if (UseCompressedClassPointers) {



4483     ldrw(dst, Address(src, oopDesc::klass_offset_in_bytes()));
4484     decode_klass_not_null(dst);
4485   } else {
4486     ldr(dst, Address(src, oopDesc::klass_offset_in_bytes()));
4487   }
4488 }
4489 
4490 void MacroAssembler::restore_cpu_control_state_after_jni(Register tmp1, Register tmp2) {
4491   if (RestoreMXCSROnJNICalls) {
4492     Label OK;
4493     get_fpcr(tmp1);
4494     mov(tmp2, tmp1);
4495     // Set FPCR to the state we need. We do want Round to Nearest. We
4496     // don't want non-IEEE rounding modes or floating-point traps.
4497     bfi(tmp1, zr, 22, 4); // Clear DN, FZ, and Rmode
4498     bfi(tmp1, zr, 8, 5);  // Clear exception-control bits (8-12)
4499     bfi(tmp1, zr, 0, 2);  // Clear AH:FIZ
4500     eor(tmp2, tmp1, tmp2);
4501     cbz(tmp2, OK);        // Only reset FPCR if it's wrong
4502     set_fpcr(tmp1);

4518   // A null weak handle resolves to null.
4519   cbz(result, resolved);
4520 
4521   // Only 64 bit platforms support GCs that require a tmp register
4522   // WeakHandle::resolve is an indirection like jweak.
4523   access_load_at(T_OBJECT, IN_NATIVE | ON_PHANTOM_OOP_REF,
4524                  result, Address(result), tmp1, tmp2);
4525   bind(resolved);
4526 }
4527 
4528 void MacroAssembler::load_mirror(Register dst, Register method, Register tmp1, Register tmp2) {
4529   const int mirror_offset = in_bytes(Klass::java_mirror_offset());
4530   ldr(dst, Address(rmethod, Method::const_offset()));
4531   ldr(dst, Address(dst, ConstMethod::constants_offset()));
4532   ldr(dst, Address(dst, ConstantPool::pool_holder_offset()));
4533   ldr(dst, Address(dst, mirror_offset));
4534   resolve_oop_handle(dst, tmp1, tmp2);
4535 }
4536 
4537 void MacroAssembler::cmp_klass(Register oop, Register trial_klass, Register tmp) {

4538   if (UseCompressedClassPointers) {
4539     ldrw(tmp, Address(oop, oopDesc::klass_offset_in_bytes()));




4540     if (CompressedKlassPointers::base() == nullptr) {
4541       cmp(trial_klass, tmp, LSL, CompressedKlassPointers::shift());
4542       return;
4543     } else if (((uint64_t)CompressedKlassPointers::base() & 0xffffffff) == 0
4544                && CompressedKlassPointers::shift() == 0) {
4545       // Only the bottom 32 bits matter
4546       cmpw(trial_klass, tmp);
4547       return;
4548     }
4549     decode_klass_not_null(tmp);
4550   } else {
4551     ldr(tmp, Address(oop, oopDesc::klass_offset_in_bytes()));
4552   }
4553   cmp(trial_klass, tmp);
4554 }
4555 
















4556 void MacroAssembler::store_klass(Register dst, Register src) {
4557   // FIXME: Should this be a store release?  concurrent gcs assumes
4558   // klass length is valid if klass field is not null.

4559   if (UseCompressedClassPointers) {
4560     encode_klass_not_null(src);
4561     strw(src, Address(dst, oopDesc::klass_offset_in_bytes()));
4562   } else {
4563     str(src, Address(dst, oopDesc::klass_offset_in_bytes()));
4564   }
4565 }
4566 
4567 void MacroAssembler::store_klass_gap(Register dst, Register src) {

4568   if (UseCompressedClassPointers) {
4569     // Store to klass gap in destination
4570     strw(src, Address(dst, oopDesc::klass_gap_offset_in_bytes()));
4571   }
4572 }
4573 
4574 // Algorithm must match CompressedOops::encode.
4575 void MacroAssembler::encode_heap_oop(Register d, Register s) {
4576 #ifdef ASSERT
4577   verify_heapbase("MacroAssembler::encode_heap_oop: heap base corrupted?");
4578 #endif
4579   verify_oop_msg(s, "broken oop in encode_heap_oop");
4580   if (CompressedOops::base() == nullptr) {
4581     if (CompressedOops::shift() != 0) {
4582       assert (LogMinObjAlignmentInBytes == CompressedOops::shift(), "decode alg wrong");
4583       lsr(d, s, LogMinObjAlignmentInBytes);
4584     } else {
4585       mov(d, s);
4586     }
4587   } else {

4461   adrp(rscratch1, src2, offset);
4462   ldr(rscratch1, Address(rscratch1, offset));
4463   cmp(src1, rscratch1);
4464 }
4465 
4466 void MacroAssembler::cmpoop(Register obj1, Register obj2) {
4467   cmp(obj1, obj2);
4468 }
4469 
4470 void MacroAssembler::load_method_holder_cld(Register rresult, Register rmethod) {
4471   load_method_holder(rresult, rmethod);
4472   ldr(rresult, Address(rresult, InstanceKlass::class_loader_data_offset()));
4473 }
4474 
4475 void MacroAssembler::load_method_holder(Register holder, Register method) {
4476   ldr(holder, Address(method, Method::const_offset()));                      // ConstMethod*
4477   ldr(holder, Address(holder, ConstMethod::constants_offset()));             // ConstantPool*
4478   ldr(holder, Address(holder, ConstantPool::pool_holder_offset()));          // InstanceKlass*
4479 }
4480 
4481 // Loads the obj's Klass* into dst.
4482 // Preserves all registers (incl src, rscratch1 and rscratch2).
4483 void MacroAssembler::load_nklass(Register dst, Register src) {
4484   assert(UseCompactObjectHeaders, "expects UseCompactObjectHeaders");
4485 
4486   Label fast;
4487 
4488   // Check if we can take the (common) fast path, if obj is unlocked.
4489   ldr(dst, Address(src, oopDesc::mark_offset_in_bytes()));
4490   tbz(dst, exact_log2(markWord::monitor_value), fast);
4491 
4492   // Fetch displaced header
4493   ldr(dst, Address(dst, OM_OFFSET_NO_MONITOR_VALUE_TAG(header)));
4494 
4495   // Fast-path: shift and decode Klass*.
4496   bind(fast);
4497   lsr(dst, dst, markWord::klass_shift);
4498 }
4499 
4500 void MacroAssembler::load_klass(Register dst, Register src) {
4501   if (UseCompactObjectHeaders) {
4502     load_nklass(dst, src);
4503     decode_klass_not_null(dst);
4504   } else if (UseCompressedClassPointers) {
4505     ldrw(dst, Address(src, oopDesc::klass_offset_in_bytes()));
4506     decode_klass_not_null(dst);
4507   } else {
4508     ldr(dst, Address(src, oopDesc::klass_offset_in_bytes()));
4509   }
4510 }
4511 
4512 void MacroAssembler::restore_cpu_control_state_after_jni(Register tmp1, Register tmp2) {
4513   if (RestoreMXCSROnJNICalls) {
4514     Label OK;
4515     get_fpcr(tmp1);
4516     mov(tmp2, tmp1);
4517     // Set FPCR to the state we need. We do want Round to Nearest. We
4518     // don't want non-IEEE rounding modes or floating-point traps.
4519     bfi(tmp1, zr, 22, 4); // Clear DN, FZ, and Rmode
4520     bfi(tmp1, zr, 8, 5);  // Clear exception-control bits (8-12)
4521     bfi(tmp1, zr, 0, 2);  // Clear AH:FIZ
4522     eor(tmp2, tmp1, tmp2);
4523     cbz(tmp2, OK);        // Only reset FPCR if it's wrong
4524     set_fpcr(tmp1);

4540   // A null weak handle resolves to null.
4541   cbz(result, resolved);
4542 
4543   // Only 64 bit platforms support GCs that require a tmp register
4544   // WeakHandle::resolve is an indirection like jweak.
4545   access_load_at(T_OBJECT, IN_NATIVE | ON_PHANTOM_OOP_REF,
4546                  result, Address(result), tmp1, tmp2);
4547   bind(resolved);
4548 }
4549 
4550 void MacroAssembler::load_mirror(Register dst, Register method, Register tmp1, Register tmp2) {
4551   const int mirror_offset = in_bytes(Klass::java_mirror_offset());
4552   ldr(dst, Address(rmethod, Method::const_offset()));
4553   ldr(dst, Address(dst, ConstMethod::constants_offset()));
4554   ldr(dst, Address(dst, ConstantPool::pool_holder_offset()));
4555   ldr(dst, Address(dst, mirror_offset));
4556   resolve_oop_handle(dst, tmp1, tmp2);
4557 }
4558 
4559 void MacroAssembler::cmp_klass(Register oop, Register trial_klass, Register tmp) {
4560   assert_different_registers(oop, trial_klass, tmp);
4561   if (UseCompressedClassPointers) {
4562     if (UseCompactObjectHeaders) {
4563       load_nklass(tmp, oop);
4564     } else {
4565       ldrw(tmp, Address(oop, oopDesc::klass_offset_in_bytes()));
4566     }
4567     if (CompressedKlassPointers::base() == nullptr) {
4568       cmp(trial_klass, tmp, LSL, CompressedKlassPointers::shift());
4569       return;
4570     } else if (((uint64_t)CompressedKlassPointers::base() & 0xffffffff) == 0
4571                && CompressedKlassPointers::shift() == 0) {
4572       // Only the bottom 32 bits matter
4573       cmpw(trial_klass, tmp);
4574       return;
4575     }
4576     decode_klass_not_null(tmp);
4577   } else {
4578     ldr(tmp, Address(oop, oopDesc::klass_offset_in_bytes()));
4579   }
4580   cmp(trial_klass, tmp);
4581 }
4582 
4583 void MacroAssembler::cmp_klass(Register src, Register dst, Register tmp1, Register tmp2) {
4584   if (UseCompactObjectHeaders) {
4585     load_nklass(tmp1, src);
4586     load_nklass(tmp2, dst);
4587     cmpw(tmp1, tmp2);
4588   } else if (UseCompressedClassPointers) {
4589     ldrw(tmp1, Address(src, oopDesc::klass_offset_in_bytes()));
4590     ldrw(tmp2, Address(dst, oopDesc::klass_offset_in_bytes()));
4591     cmpw(tmp1, tmp2);
4592   } else {
4593     ldr(tmp1, Address(src, oopDesc::klass_offset_in_bytes()));
4594     ldr(tmp2, Address(dst, oopDesc::klass_offset_in_bytes()));
4595     cmp(tmp1, tmp2);
4596   }
4597 }
4598 
4599 void MacroAssembler::store_klass(Register dst, Register src) {
4600   // FIXME: Should this be a store release?  concurrent gcs assumes
4601   // klass length is valid if klass field is not null.
4602   assert(!UseCompactObjectHeaders, "not with compact headers");
4603   if (UseCompressedClassPointers) {
4604     encode_klass_not_null(src);
4605     strw(src, Address(dst, oopDesc::klass_offset_in_bytes()));
4606   } else {
4607     str(src, Address(dst, oopDesc::klass_offset_in_bytes()));
4608   }
4609 }
4610 
4611 void MacroAssembler::store_klass_gap(Register dst, Register src) {
4612   assert(!UseCompactObjectHeaders, "not with compact headers");
4613   if (UseCompressedClassPointers) {
4614     // Store to klass gap in destination
4615     strw(src, Address(dst, oopDesc::klass_gap_offset_in_bytes()));
4616   }
4617 }
4618 
4619 // Algorithm must match CompressedOops::encode.
4620 void MacroAssembler::encode_heap_oop(Register d, Register s) {
4621 #ifdef ASSERT
4622   verify_heapbase("MacroAssembler::encode_heap_oop: heap base corrupted?");
4623 #endif
4624   verify_oop_msg(s, "broken oop in encode_heap_oop");
4625   if (CompressedOops::base() == nullptr) {
4626     if (CompressedOops::shift() != 0) {
4627       assert (LogMinObjAlignmentInBytes == CompressedOops::shift(), "decode alg wrong");
4628       lsr(d, s, LogMinObjAlignmentInBytes);
4629     } else {
4630       mov(d, s);
4631     }
4632   } else {
< prev index next >