@@ -5340,7 +5340,41 @@ bool MacroAssembler::set_klass_decode_mode(address base, int shift, const size_t
5340
5340
return _klass_decode_mode != KlassDecodeNone;
5341
5341
}
5342
5342
5343
+ static Register pick_different_tmp (Register dst, Register src) {
5344
+ auto tmps = RegSet::of (r0, r1, r2) - RegSet::of (src, dst);
5345
+ return *tmps.begin ();
5346
+ }
5347
+
5348
+ void MacroAssembler::encode_klass_not_null_for_aot (Register dst, Register src) {
5349
+ // we have to load the klass base from the AOT constants area but
5350
+ // not the shift because it is not allowed to change
5351
+ int shift = CompressedKlassPointers::shift ();
5352
+ assert (shift >= 0 && shift <= CompressedKlassPointers::max_shift (), " unexpected compressed klass shift!" );
5353
+ if (dst != src) {
5354
+ // we can load the base into dst, subtract it formthe src and shift down
5355
+ lea (dst, ExternalAddress (CompressedKlassPointers::base_addr ()));
5356
+ ldr (dst, dst);
5357
+ sub (dst, src, dst);
5358
+ lsr (dst, dst, shift);
5359
+ } else {
5360
+ // we need an extra register in order to load the coop base
5361
+ Register tmp = pick_different_tmp (dst, src);
5362
+ RegSet regs = RegSet::of (tmp);
5363
+ push (regs, sp);
5364
+ lea (tmp, ExternalAddress (CompressedKlassPointers::base_addr ()));
5365
+ ldr (tmp, tmp);
5366
+ sub (dst, src, tmp);
5367
+ lsr (dst, dst, shift);
5368
+ pop (regs, sp);
5369
+ }
5370
+ }
5371
+
5343
5372
void MacroAssembler::encode_klass_not_null (Register dst, Register src) {
5373
+ if (AOTCodeCache::is_on_for_dump ()) {
5374
+ encode_klass_not_null_for_aot (dst, src);
5375
+ return ;
5376
+ }
5377
+
5344
5378
switch (klass_decode_mode ()) {
5345
5379
case KlassDecodeZero:
5346
5380
if (CompressedKlassPointers::shift () != 0 ) {
@@ -5377,9 +5411,36 @@ void MacroAssembler::encode_klass_not_null(Register r) {
5377
5411
encode_klass_not_null (r, r);
5378
5412
}
5379
5413
5414
+ void MacroAssembler::decode_klass_not_null_for_aot (Register dst, Register src) {
5415
+ // we have to load the klass base from the AOT constants area but
5416
+ // not the shift because it is not allowed to change
5417
+ int shift = CompressedKlassPointers::shift ();
5418
+ assert (shift >= 0 && shift <= CompressedKlassPointers::max_shift (), " unexpected compressed klass shift!" );
5419
+ if (dst != src) {
5420
+ // we can load the base into dst then add the offset with a suitable shift
5421
+ lea (dst, ExternalAddress (CompressedKlassPointers::base_addr ()));
5422
+ ldr (dst, dst);
5423
+ add (dst, dst, src, LSL, shift);
5424
+ } else {
5425
+ // we need an extra register in order to load the coop base
5426
+ Register tmp = pick_different_tmp (dst, src);
5427
+ RegSet regs = RegSet::of (tmp);
5428
+ push (regs, sp);
5429
+ lea (tmp, ExternalAddress (CompressedKlassPointers::base_addr ()));
5430
+ ldr (tmp, tmp);
5431
+ add (dst, tmp, src, LSL, shift);
5432
+ pop (regs, sp);
5433
+ }
5434
+ }
5435
+
5380
5436
void MacroAssembler::decode_klass_not_null (Register dst, Register src) {
5381
5437
assert (UseCompressedClassPointers, " should only be used for compressed headers" );
5382
5438
5439
+ if (AOTCodeCache::is_on_for_dump ()) {
5440
+ decode_klass_not_null_for_aot (dst, src);
5441
+ return ;
5442
+ }
5443
+
5383
5444
switch (klass_decode_mode ()) {
5384
5445
case KlassDecodeZero:
5385
5446
if (CompressedKlassPointers::shift () != 0 ) {
@@ -6654,7 +6715,7 @@ void MacroAssembler::get_thread(Register dst) {
6654
6715
protect_return_address ();
6655
6716
push (saved_regs, sp);
6656
6717
6657
- mov (lr, CAST_FROM_FN_PTR (address, JavaThread::aarch64_get_thread_helper));
6718
+ mov (lr, ExternalAddress ( CAST_FROM_FN_PTR (address, JavaThread::aarch64_get_thread_helper) ));
6658
6719
blr (lr);
6659
6720
if (dst != c_rarg0) {
6660
6721
mov (dst, c_rarg0);
0 commit comments