2517 }
2518 }
2519
2520 void MacroAssembler::store_klass_gap(Register dst, Register src) {
2521 if (UseCompressedClassPointers) {
2522 // Store to klass gap in destination
2523 sw(src, Address(dst, oopDesc::klass_gap_offset_in_bytes()));
2524 }
2525 }
2526
2527 void MacroAssembler::decode_klass_not_null(Register r, Register tmp) {
2528 assert_different_registers(r, tmp);
2529 decode_klass_not_null(r, r, tmp);
2530 }
2531
2532 void MacroAssembler::decode_klass_not_null(Register dst, Register src, Register tmp) {
2533 assert(UseCompressedClassPointers, "should only be used for compressed headers");
2534
2535 if (CompressedKlassPointers::base() == nullptr) {
2536 if (CompressedKlassPointers::shift() != 0) {
2537 assert(LogKlassAlignmentInBytes == CompressedKlassPointers::shift(), "decode alg wrong");
2538 slli(dst, src, LogKlassAlignmentInBytes);
2539 } else {
2540 mv(dst, src);
2541 }
2542 return;
2543 }
2544
2545 Register xbase = dst;
2546 if (dst == src) {
2547 xbase = tmp;
2548 }
2549
2550 assert_different_registers(src, xbase);
2551 mv(xbase, (uintptr_t)CompressedKlassPointers::base());
2552
2553 if (CompressedKlassPointers::shift() != 0) {
2554 assert(LogKlassAlignmentInBytes == CompressedKlassPointers::shift(), "decode alg wrong");
2555 assert_different_registers(t0, xbase);
2556 shadd(dst, src, xbase, t0, LogKlassAlignmentInBytes);
2557 } else {
2558 add(dst, xbase, src);
2559 }
2560 }
2561
2562 void MacroAssembler::encode_klass_not_null(Register r, Register tmp) {
2563 assert_different_registers(r, tmp);
2564 encode_klass_not_null(r, r, tmp);
2565 }
2566
2567 void MacroAssembler::encode_klass_not_null(Register dst, Register src, Register tmp) {
2568 assert(UseCompressedClassPointers, "should only be used for compressed headers");
2569
2570 if (CompressedKlassPointers::base() == nullptr) {
2571 if (CompressedKlassPointers::shift() != 0) {
2572 assert(LogKlassAlignmentInBytes == CompressedKlassPointers::shift(), "decode alg wrong");
2573 srli(dst, src, LogKlassAlignmentInBytes);
2574 } else {
2575 mv(dst, src);
2576 }
2577 return;
2578 }
2579
2580 if (((uint64_t)CompressedKlassPointers::base() & 0xffffffff) == 0 &&
2581 CompressedKlassPointers::shift() == 0) {
2582 zero_extend(dst, src, 32);
2583 return;
2584 }
2585
2586 Register xbase = dst;
2587 if (dst == src) {
2588 xbase = tmp;
2589 }
2590
2591 assert_different_registers(src, xbase);
2592 mv(xbase, (uintptr_t)CompressedKlassPointers::base());
2593 sub(dst, src, xbase);
2594 if (CompressedKlassPointers::shift() != 0) {
2595 assert(LogKlassAlignmentInBytes == CompressedKlassPointers::shift(), "decode alg wrong");
2596 srli(dst, dst, LogKlassAlignmentInBytes);
2597 }
2598 }
2599
2600 void MacroAssembler::decode_heap_oop_not_null(Register r) {
2601 decode_heap_oop_not_null(r, r);
2602 }
2603
2604 void MacroAssembler::decode_heap_oop_not_null(Register dst, Register src) {
2605 assert(UseCompressedOops, "should only be used for compressed headers");
2606 assert(Universe::heap() != nullptr, "java heap should be initialized");
2607 // Cannot assert, unverified entry point counts instructions (see .ad file)
2608 // vtableStubs also counts instructions in pd_code_size_limit.
2609 // Also do not verify_oop as this is called by verify_oop.
2610 if (CompressedOops::shift() != 0) {
2611 assert(LogMinObjAlignmentInBytes == CompressedOops::shift(), "decode alg wrong");
2612 slli(dst, src, LogMinObjAlignmentInBytes);
2613 if (CompressedOops::base() != nullptr) {
2614 add(dst, xheapbase, dst);
2615 }
2616 } else {
|
2517 }
2518 }
2519
2520 void MacroAssembler::store_klass_gap(Register dst, Register src) {
2521 if (UseCompressedClassPointers) {
2522 // Store to klass gap in destination
2523 sw(src, Address(dst, oopDesc::klass_gap_offset_in_bytes()));
2524 }
2525 }
2526
2527 void MacroAssembler::decode_klass_not_null(Register r, Register tmp) {
2528 assert_different_registers(r, tmp);
2529 decode_klass_not_null(r, r, tmp);
2530 }
2531
2532 void MacroAssembler::decode_klass_not_null(Register dst, Register src, Register tmp) {
2533 assert(UseCompressedClassPointers, "should only be used for compressed headers");
2534
2535 if (CompressedKlassPointers::base() == nullptr) {
2536 if (CompressedKlassPointers::shift() != 0) {
2537 slli(dst, src, CompressedKlassPointers::shift());
2538 } else {
2539 mv(dst, src);
2540 }
2541 return;
2542 }
2543
2544 Register xbase = dst;
2545 if (dst == src) {
2546 xbase = tmp;
2547 }
2548
2549 assert_different_registers(src, xbase);
2550 mv(xbase, (uintptr_t)CompressedKlassPointers::base());
2551
2552 if (CompressedKlassPointers::shift() != 0) {
2553 assert_different_registers(t0, xbase);
2554 shadd(dst, src, xbase, t0, CompressedKlassPointers::shift());
2555 } else {
2556 add(dst, xbase, src);
2557 }
2558 }
2559
2560 void MacroAssembler::encode_klass_not_null(Register r, Register tmp) {
2561 assert_different_registers(r, tmp);
2562 encode_klass_not_null(r, r, tmp);
2563 }
2564
2565 void MacroAssembler::encode_klass_not_null(Register dst, Register src, Register tmp) {
2566 assert(UseCompressedClassPointers, "should only be used for compressed headers");
2567
2568 if (CompressedKlassPointers::base() == nullptr) {
2569 if (CompressedKlassPointers::shift() != 0) {
2570 srli(dst, src, CompressedKlassPointers::shift());
2571 } else {
2572 mv(dst, src);
2573 }
2574 return;
2575 }
2576
2577 if (((uint64_t)CompressedKlassPointers::base() & 0xffffffff) == 0 &&
2578 CompressedKlassPointers::shift() == 0) {
2579 zero_extend(dst, src, 32);
2580 return;
2581 }
2582
2583 Register xbase = dst;
2584 if (dst == src) {
2585 xbase = tmp;
2586 }
2587
2588 assert_different_registers(src, xbase);
2589 mv(xbase, (uintptr_t)CompressedKlassPointers::base());
2590 sub(dst, src, xbase);
2591 if (CompressedKlassPointers::shift() != 0) {
2592 srli(dst, dst, CompressedKlassPointers::shift());
2593 }
2594 }
2595
2596 void MacroAssembler::decode_heap_oop_not_null(Register r) {
2597 decode_heap_oop_not_null(r, r);
2598 }
2599
2600 void MacroAssembler::decode_heap_oop_not_null(Register dst, Register src) {
2601 assert(UseCompressedOops, "should only be used for compressed headers");
2602 assert(Universe::heap() != nullptr, "java heap should be initialized");
2603 // Cannot assert, unverified entry point counts instructions (see .ad file)
2604 // vtableStubs also counts instructions in pd_code_size_limit.
2605 // Also do not verify_oop as this is called by verify_oop.
2606 if (CompressedOops::shift() != 0) {
2607 assert(LogMinObjAlignmentInBytes == CompressedOops::shift(), "decode alg wrong");
2608 slli(dst, src, LogMinObjAlignmentInBytes);
2609 if (CompressedOops::base() != nullptr) {
2610 add(dst, xheapbase, dst);
2611 }
2612 } else {
|