3675
3676 __ cmpdi(CCR1, Rscratch, InstanceKlass::fully_initialized);
3677 // Make sure klass does not have has_finalizer, or is abstract, or interface or java/lang/Class.
3678 __ andi_(R0, Rinstance_size, Klass::_lh_instance_slow_path_bit); // slow path bit equals 0?
3679
3680 __ crnand(CCR0, Assembler::equal, CCR1, Assembler::equal); // slow path bit set or not fully initialized?
3681 __ beq(CCR0, Lslow_case);
3682
3683 // --------------------------------------------------------------------------
3684 // Fast case:
3685 // Allocate the instance.
3686 // 1) Try to allocate in the TLAB.
3687 // 2) If the above fails (or is not applicable), go to a slow case (creates a new TLAB, etc.).
3688
3689 Register RoldTopValue = RallocatedObject; // Object will be allocated here if it fits.
3690 Register RnewTopValue = R6_ARG4;
3691 Register RendValue = R7_ARG5;
3692
3693 // Check if we can allocate in the TLAB.
3694 __ ld(RoldTopValue, in_bytes(JavaThread::tlab_top_offset()), R16_thread);
3695 __ ld(RendValue, in_bytes(JavaThread::tlab_end_offset()), R16_thread);
3696
3697 __ add(RnewTopValue, Rinstance_size, RoldTopValue);
3698
3699 // If there is enough space, we do not CAS and do not clear.
3700 __ cmpld(CCR0, RnewTopValue, RendValue);
3701 __ bgt(CCR0, Lslow_case);
3702
3703 __ std(RnewTopValue, in_bytes(JavaThread::tlab_top_offset()), R16_thread);
3704
3705 if (!ZeroTLAB) {
3706 // --------------------------------------------------------------------------
3707 // Init1: Zero out newly allocated memory.
3708 // Initialize remaining object fields.
3709 Register Rbase = Rtags;
3710 __ addi(Rinstance_size, Rinstance_size, 7 - (int)sizeof(oopDesc));
3711 __ addi(Rbase, RallocatedObject, sizeof(oopDesc));
3712 __ srdi(Rinstance_size, Rinstance_size, 3);
3713
3714 // Clear out object skipping header. Takes also care of the zero length case.
3715 __ clear_memory_doubleword(Rbase, Rinstance_size);
|
3675
3676 __ cmpdi(CCR1, Rscratch, InstanceKlass::fully_initialized);
3677 // Make sure klass does not have has_finalizer, or is abstract, or interface or java/lang/Class.
3678 __ andi_(R0, Rinstance_size, Klass::_lh_instance_slow_path_bit); // slow path bit equals 0?
3679
3680 __ crnand(CCR0, Assembler::equal, CCR1, Assembler::equal); // slow path bit set or not fully initialized?
3681 __ beq(CCR0, Lslow_case);
3682
3683 // --------------------------------------------------------------------------
3684 // Fast case:
3685 // Allocate the instance.
3686 // 1) Try to allocate in the TLAB.
3687 // 2) If the above fails (or is not applicable), go to a slow case (creates a new TLAB, etc.).
3688
3689 Register RoldTopValue = RallocatedObject; // Object will be allocated here if it fits.
3690 Register RnewTopValue = R6_ARG4;
3691 Register RendValue = R7_ARG5;
3692
3693 // Check if we can allocate in the TLAB.
3694 __ ld(RoldTopValue, in_bytes(JavaThread::tlab_top_offset()), R16_thread);
3695 __ ld(RendValue, in_bytes(JavaThread::tlab_current_end_offset()), R16_thread);
3696
3697 __ add(RnewTopValue, Rinstance_size, RoldTopValue);
3698
3699 // If there is enough space, we do not CAS and do not clear.
3700 __ cmpld(CCR0, RnewTopValue, RendValue);
3701 __ bgt(CCR0, Lslow_case);
3702
3703 __ std(RnewTopValue, in_bytes(JavaThread::tlab_top_offset()), R16_thread);
3704
3705 if (!ZeroTLAB) {
3706 // --------------------------------------------------------------------------
3707 // Init1: Zero out newly allocated memory.
3708 // Initialize remaining object fields.
3709 Register Rbase = Rtags;
3710 __ addi(Rinstance_size, Rinstance_size, 7 - (int)sizeof(oopDesc));
3711 __ addi(Rbase, RallocatedObject, sizeof(oopDesc));
3712 __ srdi(Rinstance_size, Rinstance_size, 3);
3713
3714 // Clear out object skipping header. Takes also care of the zero length case.
3715 __ clear_memory_doubleword(Rbase, Rinstance_size);
|