3758 __ z_tmll(Rsize, mask); |
3757 __ z_tmll(Rsize, mask); |
3759 __ z_btrue(slow_case); |
3758 __ z_btrue(slow_case); |
3760 |
3759 |
3761 // Allocate the instance |
3760 // Allocate the instance |
3762 // 1) Try to allocate in the TLAB. |
3761 // 1) Try to allocate in the TLAB. |
3763 // 2) If fail and the object is large allocate in the shared Eden. |
3762 // 2) If the above fails (or is not applicable), go to a slow case |
3764 // 3) If the above fails (or is not applicable), go to a slow case |
|
3765 // (creates a new TLAB, etc.). |
3763 // (creates a new TLAB, etc.). |
3766 |
3764 // Note: compared to other architectures, s390's implementation always goes |
3767 // Always go the slow path. See comment above this template. |
3765 // to the slow path if TLAB is used and fails. |
3768 const bool allow_shared_alloc = false; |
|
3769 |
|
3770 if (UseTLAB) { |
3766 if (UseTLAB) { |
3771 Register RoldTopValue = RallocatedObject; |
3767 Register RoldTopValue = RallocatedObject; |
3772 Register RnewTopValue = tmp; |
3768 Register RnewTopValue = tmp; |
3773 __ z_lg(RoldTopValue, Address(Z_thread, JavaThread::tlab_top_offset())); |
3769 __ z_lg(RoldTopValue, Address(Z_thread, JavaThread::tlab_top_offset())); |
3774 __ load_address(RnewTopValue, Address(RoldTopValue, Rsize)); |
3770 __ load_address(RnewTopValue, Address(RoldTopValue, Rsize)); |
3775 __ z_cg(RnewTopValue, Address(Z_thread, JavaThread::tlab_end_offset())); |
3771 __ z_cg(RnewTopValue, Address(Z_thread, JavaThread::tlab_end_offset())); |
3776 __ z_brh(allow_shared_alloc ? allocate_shared : slow_case); |
3772 __ z_brh(slow_case); |
3777 __ z_stg(RnewTopValue, Address(Z_thread, JavaThread::tlab_top_offset())); |
3773 __ z_stg(RnewTopValue, Address(Z_thread, JavaThread::tlab_top_offset())); |
3778 if (ZeroTLAB) { |
3774 |
3779 // The fields have been already cleared. |
|
3780 __ z_bru(initialize_header); |
|
3781 } else { |
|
3782 // Initialize both the header and fields. |
|
3783 if (allow_shared_alloc) { |
|
3784 __ z_bru(initialize_object); |
|
3785 } else { |
|
3786 // Fallthrough to initialize_object, but assert that it is on fall through path. |
|
3787 prev_instr_address = __ pc(); |
|
3788 } |
|
3789 } |
|
3790 } |
|
3791 |
|
3792 if (allow_shared_alloc) { |
|
3793 // Allocation in shared Eden not implemented, because sapjvm allocation trace does not allow it. |
|
3794 Unimplemented(); |
|
3795 } |
|
3796 |
|
3797 if (UseTLAB) { |
|
3798 Register RobjectFields = tmp; |
3775 Register RobjectFields = tmp; |
3799 Register Rzero = Z_R1_scratch; |
3776 Register Rzero = Z_R1_scratch; |
3800 |
|
3801 assert(ZeroTLAB || prev_instr_address == __ pc(), |
|
3802 "must not omit jump to initialize_object above, as it is not on the fall through path"); |
|
3803 __ clear_reg(Rzero, true /*whole reg*/, false); // Load 0L into Rzero. Don't set CC. |
3777 __ clear_reg(Rzero, true /*whole reg*/, false); // Load 0L into Rzero. Don't set CC. |
3804 |
3778 |
3805 // The object is initialized before the header. If the object size is |
3779 if (!ZeroTLAB) { |
3806 // zero, go directly to the header initialization. |
3780 // The object is initialized before the header. If the object size is |
3807 __ bind(initialize_object); |
3781 // zero, go directly to the header initialization. |
3808 __ z_aghi(Rsize, (int)-sizeof(oopDesc)); // Subtract header size, set CC. |
3782 __ z_aghi(Rsize, (int)-sizeof(oopDesc)); // Subtract header size, set CC. |
3809 __ z_bre(initialize_header); // Jump if size of fields is zero. |
3783 __ z_bre(initialize_header); // Jump if size of fields is zero. |
3810 |
3784 |
3811 // Initialize object fields. |
3785 // Initialize object fields. |
3812 // See documentation for MVCLE instruction!!! |
3786 // See documentation for MVCLE instruction!!! |
3813 assert(RobjectFields->encoding() % 2 == 0, "RobjectFields must be an even register"); |
3787 assert(RobjectFields->encoding() % 2 == 0, "RobjectFields must be an even register"); |
3814 assert(Rsize->encoding() == (RobjectFields->encoding()+1), |
3788 assert(Rsize->encoding() == (RobjectFields->encoding()+1), |
3815 "RobjectFields and Rsize must be a register pair"); |
3789 "RobjectFields and Rsize must be a register pair"); |
3816 assert(Rzero->encoding() % 2 == 1, "Rzero must be an odd register"); |
3790 assert(Rzero->encoding() % 2 == 1, "Rzero must be an odd register"); |
3817 |
3791 |
3818 // Set Rzero to 0 and use it as src length, then mvcle will copy nothing |
3792 // Set Rzero to 0 and use it as src length, then mvcle will copy nothing |
3819 // and fill the object with the padding value 0. |
3793 // and fill the object with the padding value 0. |
3820 __ add2reg(RobjectFields, sizeof(oopDesc), RallocatedObject); |
3794 __ add2reg(RobjectFields, sizeof(oopDesc), RallocatedObject); |
3821 __ move_long_ext(RobjectFields, as_Register(Rzero->encoding() - 1), 0); |
3795 __ move_long_ext(RobjectFields, as_Register(Rzero->encoding() - 1), 0); |
|
3796 } |
3822 |
3797 |
3823 // Initialize object header only. |
3798 // Initialize object header only. |
3824 __ bind(initialize_header); |
3799 __ bind(initialize_header); |
3825 if (UseBiasedLocking) { |
3800 if (UseBiasedLocking) { |
3826 Register prototype = RobjectFields; |
3801 Register prototype = RobjectFields; |