< prev index next >

src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp

Print this page

5043 }
5044 
5045 void MacroAssembler::load_method_holder_cld(Register rresult, Register rmethod) {
5046   load_method_holder(rresult, rmethod);
5047   ldr(rresult, Address(rresult, InstanceKlass::class_loader_data_offset()));
5048 }
5049 
5050 void MacroAssembler::load_method_holder(Register holder, Register method) {
5051   ldr(holder, Address(method, Method::const_offset()));                      // ConstMethod*
5052   ldr(holder, Address(holder, ConstMethod::constants_offset()));             // ConstantPool*
5053   ldr(holder, Address(holder, ConstantPool::pool_holder_offset()));          // InstanceKlass*
5054 }
5055 
5056 // Loads the obj's Klass* into dst.
5057 // Preserves all registers (incl src, rscratch1 and rscratch2).
5058 // Input:
5059 // src - the oop we want to load the klass from.
5060 // dst - output narrow klass.
5061 void MacroAssembler::load_narrow_klass_compact(Register dst, Register src) {
5062   assert(UseCompactObjectHeaders, "expects UseCompactObjectHeaders");
5063   ldr(dst, Address(src, oopDesc::mark_offset_in_bytes()));
5064   lsr(dst, dst, markWord::klass_shift);
5065 }
5066 
5067 void MacroAssembler::load_klass(Register dst, Register src) {
5068   if (UseCompactObjectHeaders) {
5069     load_narrow_klass_compact(dst, src);
5070     decode_klass_not_null(dst);
5071   } else if (UseCompressedClassPointers) {
5072     ldrw(dst, Address(src, oopDesc::klass_offset_in_bytes()));
5073     decode_klass_not_null(dst);
5074   } else {
5075     ldr(dst, Address(src, oopDesc::klass_offset_in_bytes()));
5076   }
5077 }
5078 
5079 void MacroAssembler::restore_cpu_control_state_after_jni(Register tmp1, Register tmp2) {
5080   if (RestoreMXCSROnJNICalls) {
5081     Label OK;
5082     get_fpcr(tmp1);
5083     mov(tmp2, tmp1);
5084     // Set FPCR to the state we need. We do want Round to Nearest. We

5885     b(DONE);
5886 
5887   BIND(SET_RESULT);
5888 
5889     add(len, len, wordSize);
5890     sub(result, result, len);
5891 
5892   BIND(DONE);
5893   postcond(pc() != badAddress);
5894   return pc();
5895 }
5896 
5897 // Clobbers: rscratch1, rscratch2, rflags
5898 // May also clobber v0-v7 when (!UseSimpleArrayEquals && UseSIMDForArrayEquals)
5899 address MacroAssembler::arrays_equals(Register a1, Register a2, Register tmp3,
5900                                       Register tmp4, Register tmp5, Register result,
5901                                       Register cnt1, int elem_size) {
5902   Label DONE, SAME;
5903   Register tmp1 = rscratch1;
5904   Register tmp2 = rscratch2;

5905   int elem_per_word = wordSize/elem_size;
5906   int log_elem_size = exact_log2(elem_size);
5907   int klass_offset  = arrayOopDesc::klass_offset_in_bytes();
5908   int length_offset = arrayOopDesc::length_offset_in_bytes();
5909   int base_offset
5910     = arrayOopDesc::base_offset_in_bytes(elem_size == 2 ? T_CHAR : T_BYTE);
5911   // When the length offset is not aligned to 8 bytes,
5912   // then we align it down. This is valid because the new
5913   // offset will always be the klass which is the same
5914   // for type arrays.
5915   int start_offset = align_down(length_offset, BytesPerWord);


5916   int extra_length = base_offset - start_offset;
5917   assert(start_offset == length_offset || start_offset == klass_offset,
5918          "start offset must be 8-byte-aligned or be the klass offset");
5919   assert(base_offset != start_offset, "must include the length field");




5920   extra_length = extra_length / elem_size; // We count in elements, not bytes.
5921   int stubBytesThreshold = 3 * 64 + (UseSIMDForArrayEquals ? 0 : 16);
5922 
5923   assert(elem_size == 1 || elem_size == 2, "must be char or byte");
5924   assert_different_registers(a1, a2, result, cnt1, rscratch1, rscratch2);
5925 
5926 #ifndef PRODUCT
5927   {
5928     const char kind = (elem_size == 2) ? 'U' : 'L';
5929     char comment[64];
5930     os::snprintf_checked(comment, sizeof comment, "array_equals%c{", kind);
5931     BLOCK_COMMENT(comment);
5932   }
5933 #endif
5934 
5935   // if (a1 == a2)
5936   //     return true;
5937   cmpoop(a1, a2); // May have read barriers for a1 and a2.
5938   br(EQ, SAME);
5939 

5043 }
5044 
5045 void MacroAssembler::load_method_holder_cld(Register rresult, Register rmethod) {
5046   load_method_holder(rresult, rmethod);
5047   ldr(rresult, Address(rresult, InstanceKlass::class_loader_data_offset()));
5048 }
5049 
5050 void MacroAssembler::load_method_holder(Register holder, Register method) {
5051   ldr(holder, Address(method, Method::const_offset()));                      // ConstMethod*
5052   ldr(holder, Address(holder, ConstMethod::constants_offset()));             // ConstantPool*
5053   ldr(holder, Address(holder, ConstantPool::pool_holder_offset()));          // InstanceKlass*
5054 }
5055 
5056 // Loads the obj's Klass* into dst.
5057 // Preserves all registers (incl src, rscratch1 and rscratch2).
5058 // Input:
5059 // src - the oop we want to load the klass from.
5060 // dst - output narrow klass.
5061 void MacroAssembler::load_narrow_klass_compact(Register dst, Register src) {
5062   assert(UseCompactObjectHeaders, "expects UseCompactObjectHeaders");
5063   ldrw(dst, Address(src, oopDesc::mark_offset_in_bytes()));
5064   lsrw(dst, dst, markWord::klass_shift);
5065 }
5066 
5067 void MacroAssembler::load_klass(Register dst, Register src) {
5068   if (UseCompactObjectHeaders) {
5069     load_narrow_klass_compact(dst, src);
5070     decode_klass_not_null(dst);
5071   } else if (UseCompressedClassPointers) {
5072     ldrw(dst, Address(src, oopDesc::klass_offset_in_bytes()));
5073     decode_klass_not_null(dst);
5074   } else {
5075     ldr(dst, Address(src, oopDesc::klass_offset_in_bytes()));
5076   }
5077 }
5078 
5079 void MacroAssembler::restore_cpu_control_state_after_jni(Register tmp1, Register tmp2) {
5080   if (RestoreMXCSROnJNICalls) {
5081     Label OK;
5082     get_fpcr(tmp1);
5083     mov(tmp2, tmp1);
5084     // Set FPCR to the state we need. We do want Round to Nearest. We

5885     b(DONE);
5886 
5887   BIND(SET_RESULT);
5888 
5889     add(len, len, wordSize);
5890     sub(result, result, len);
5891 
5892   BIND(DONE);
5893   postcond(pc() != badAddress);
5894   return pc();
5895 }
5896 
5897 // Clobbers: rscratch1, rscratch2, rflags
5898 // May also clobber v0-v7 when (!UseSimpleArrayEquals && UseSIMDForArrayEquals)
5899 address MacroAssembler::arrays_equals(Register a1, Register a2, Register tmp3,
5900                                       Register tmp4, Register tmp5, Register result,
5901                                       Register cnt1, int elem_size) {
5902   Label DONE, SAME;
5903   Register tmp1 = rscratch1;
5904   Register tmp2 = rscratch2;
5905   Register cnt2 = tmp2;  // cnt2 only used in array length compare
5906   int elem_per_word = wordSize/elem_size;
5907   int log_elem_size = exact_log2(elem_size);
5908   int klass_offset  = arrayOopDesc::klass_offset_in_bytes();
5909   int length_offset = arrayOopDesc::length_offset_in_bytes();
5910   int base_offset
5911     = arrayOopDesc::base_offset_in_bytes(elem_size == 2 ? T_CHAR : T_BYTE);
5912   // When the length offset is not aligned to 8 bytes,
5913   // then we align it down. This is valid because the new
5914   // offset will always be the klass which is the same
5915   // for type arrays.
5916   // With 4-byte headers, we need to start at the base-offset, and check
5917   // the length field explicitly.
5918   int start_offset = UseCompactObjectHeaders ? base_offset : align_down(length_offset, BytesPerWord);
5919   int extra_length = base_offset - start_offset;
5920   if (UseCompactObjectHeaders) {
5921     assert(base_offset == start_offset, "must start at base-offset");
5922   } else {
5923     assert(start_offset == length_offset || start_offset == klass_offset,
5924            "start offset must be 8-byte-aligned or be the klass offset");
5925     assert(base_offset != start_offset, "must include the length field");
5926   }
5927   extra_length = extra_length / elem_size; // We count in elements, not bytes.
5928   int stubBytesThreshold = 3 * 64 + (UseSIMDForArrayEquals ? 0 : 16);
5929 
5930   assert(elem_size == 1 || elem_size == 2, "must be char or byte");
5931   assert_different_registers(a1, a2, result, cnt1, rscratch1, rscratch2);
5932 
5933 #ifndef PRODUCT
5934   {
5935     const char kind = (elem_size == 2) ? 'U' : 'L';
5936     char comment[64];
5937     os::snprintf_checked(comment, sizeof comment, "array_equals%c{", kind);
5938     BLOCK_COMMENT(comment);
5939   }
5940 #endif
5941 
5942   // if (a1 == a2)
5943   //     return true;
5944   cmpoop(a1, a2); // May have read barriers for a1 and a2.
5945   br(EQ, SAME);
5946 
< prev index next >