9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "asm/macroAssembler.inline.hpp"
27 #include "registerSaver_s390.hpp"
28 #include "gc/shared/cardTable.hpp"
29 #include "gc/shared/cardTableModRefBS.hpp"
30 #include "interpreter/interpreter.hpp"
31 #include "interpreter/interp_masm.hpp"
32 #include "nativeInst_s390.hpp"
33 #include "oops/instanceOop.hpp"
34 #include "oops/objArrayKlass.hpp"
35 #include "oops/oop.inline.hpp"
36 #include "prims/methodHandles.hpp"
37 #include "runtime/frame.inline.hpp"
38 #include "runtime/handles.inline.hpp"
39 #include "runtime/sharedRuntime.hpp"
40 #include "runtime/stubCodeGenerator.hpp"
41 #include "runtime/stubRoutines.hpp"
42 #include "runtime/thread.inline.hpp"
43
44 // Declaration and definition of StubGenerator (no .hpp file).
45 // For a more detailed description of the stub routine structure
46 // see the comment in stubRoutines.hpp.
47
48 #ifdef PRODUCT
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "asm/macroAssembler.inline.hpp"
27 #include "registerSaver_s390.hpp"
28 #include "gc/shared/cardTable.hpp"
29 #include "gc/shared/cardTableBarrierSet.hpp"
30 #include "interpreter/interpreter.hpp"
31 #include "interpreter/interp_masm.hpp"
32 #include "nativeInst_s390.hpp"
33 #include "oops/instanceOop.hpp"
34 #include "oops/objArrayKlass.hpp"
35 #include "oops/oop.inline.hpp"
36 #include "prims/methodHandles.hpp"
37 #include "runtime/frame.inline.hpp"
38 #include "runtime/handles.inline.hpp"
39 #include "runtime/sharedRuntime.hpp"
40 #include "runtime/stubCodeGenerator.hpp"
41 #include "runtime/stubRoutines.hpp"
42 #include "runtime/thread.inline.hpp"
43
44 // Declaration and definition of StubGenerator (no .hpp file).
45 // For a more detailed description of the stub routine structure
46 // see the comment in stubRoutines.hpp.
47
48 #ifdef PRODUCT
|
706 Register Rtmp1 = Z_R0_scratch;
707 const int active_offset = in_bytes(JavaThread::satb_mark_queue_offset() +
708 SATBMarkQueue::byte_offset_of_active());
709 if (in_bytes(SATBMarkQueue::byte_width_of_active()) == 4) {
710 __ load_and_test_int(Rtmp1, Address(Z_thread, active_offset));
711 } else {
712 guarantee(in_bytes(SATBMarkQueue::byte_width_of_active()) == 1, "Assumption");
713 __ load_and_test_byte(Rtmp1, Address(Z_thread, active_offset));
714 }
715 __ z_bre(filtered); // Activity indicator is zero, so there is no marking going on currently.
716
717 // __ push_frame_abi160(0); // implicitly done in save_live_registers()
718 (void) RegisterSaver::save_live_registers(_masm, RegisterSaver::arg_registers);
719 __ call_VM_leaf(CAST_FROM_FN_PTR(address, BarrierSet::static_write_ref_array_pre), addr, count);
720 (void) RegisterSaver::restore_live_registers(_masm, RegisterSaver::arg_registers);
721 // __ pop_frame(); // implicitly done in restore_live_registers()
722
723 __ bind(filtered);
724 }
725 break;
726 case BarrierSet::CardTableModRef:
727 case BarrierSet::ModRef:
728 break;
729 default:
730 ShouldNotReachHere();
731 }
732 }
733
734 // Generate post-write barrier for array.
735 //
736 // Input:
737 // addr - register containing starting address
738 // count - register containing element count
739 //
740 // The input registers are overwritten.
741 void gen_write_ref_array_post_barrier(Register addr, Register count, bool branchToEnd) {
742 BarrierSet* const bs = Universe::heap()->barrier_set();
743 switch (bs->kind()) {
744 case BarrierSet::G1BarrierSet:
745 {
746 if (branchToEnd) {
747 assert_different_registers(addr, Z_R0_scratch); // would be destroyed by push_frame()
748 assert_different_registers(count, Z_R0_scratch); // would be destroyed by push_frame()
749 // __ push_frame_abi160(0); // implicitly done in save_live_registers()
750 (void) RegisterSaver::save_live_registers(_masm, RegisterSaver::arg_registers);
751 __ call_VM_leaf(CAST_FROM_FN_PTR(address, BarrierSet::static_write_ref_array_post), addr, count);
752 (void) RegisterSaver::restore_live_registers(_masm, RegisterSaver::arg_registers);
753 // __ pop_frame(); // implicitly done in restore_live_registers()
754 } else {
755 // Tail call: call c and return to stub caller.
756 address entry_point = CAST_FROM_FN_PTR(address, BarrierSet::static_write_ref_array_post);
757 __ lgr_if_needed(Z_ARG1, addr);
758 __ lgr_if_needed(Z_ARG2, count);
759 __ load_const(Z_R1, entry_point);
760 __ z_br(Z_R1); // Branch without linking, callee will return to stub caller.
761 }
762 }
763 break;
764 case BarrierSet::CardTableModRef:
765 // These cases formerly known as
766 // void array_store_check(Register addr, Register count, bool branchToEnd).
767 {
768 NearLabel doXC, done;
769 CardTableModRefBS* ctbs = barrier_set_cast<CardTableModRefBS>(bs);
770 CardTable* ct = ctbs->card_table();
771 assert(sizeof(*ct->byte_map_base()) == sizeof(jbyte), "adjust this code");
772 assert_different_registers(Z_R0, Z_R1, addr, count);
773
774 // Nothing to do if count <= 0.
775 if (branchToEnd) {
776 __ compare64_and_branch(count, (intptr_t) 0, Assembler::bcondNotHigh, done);
777 } else {
778 __ z_ltgr(count, count);
779 __ z_bcr(Assembler::bcondNotPositive, Z_R14);
780 }
781
782 // Note: We can't combine the shifts. We could lose a carry
783 // from calculating the array end address.
784 // count = (count-1)*BytesPerHeapOop + addr
785 // Count holds addr of last oop in array then.
786 __ z_sllg(count, count, LogBytesPerHeapOop);
787 __ add2reg_with_index(count, -BytesPerHeapOop, count, addr);
788
|
706 Register Rtmp1 = Z_R0_scratch;
707 const int active_offset = in_bytes(JavaThread::satb_mark_queue_offset() +
708 SATBMarkQueue::byte_offset_of_active());
709 if (in_bytes(SATBMarkQueue::byte_width_of_active()) == 4) {
710 __ load_and_test_int(Rtmp1, Address(Z_thread, active_offset));
711 } else {
712 guarantee(in_bytes(SATBMarkQueue::byte_width_of_active()) == 1, "Assumption");
713 __ load_and_test_byte(Rtmp1, Address(Z_thread, active_offset));
714 }
715 __ z_bre(filtered); // Activity indicator is zero, so there is no marking going on currently.
716
717 // __ push_frame_abi160(0); // implicitly done in save_live_registers()
718 (void) RegisterSaver::save_live_registers(_masm, RegisterSaver::arg_registers);
719 __ call_VM_leaf(CAST_FROM_FN_PTR(address, BarrierSet::static_write_ref_array_pre), addr, count);
720 (void) RegisterSaver::restore_live_registers(_masm, RegisterSaver::arg_registers);
721 // __ pop_frame(); // implicitly done in restore_live_registers()
722
723 __ bind(filtered);
724 }
725 break;
726 case BarrierSet::CardTableBarrierSet:
727 case BarrierSet::ModRef:
728 break;
729 default:
730 ShouldNotReachHere();
731 }
732 }
733
734 // Generate post-write barrier for array.
735 //
736 // Input:
737 // addr - register containing starting address
738 // count - register containing element count
739 //
740 // The input registers are overwritten.
741 void gen_write_ref_array_post_barrier(Register addr, Register count, bool branchToEnd) {
742 BarrierSet* const bs = Universe::heap()->barrier_set();
743 switch (bs->kind()) {
744 case BarrierSet::G1BarrierSet:
745 {
746 if (branchToEnd) {
747 assert_different_registers(addr, Z_R0_scratch); // would be destroyed by push_frame()
748 assert_different_registers(count, Z_R0_scratch); // would be destroyed by push_frame()
749 // __ push_frame_abi160(0); // implicitly done in save_live_registers()
750 (void) RegisterSaver::save_live_registers(_masm, RegisterSaver::arg_registers);
751 __ call_VM_leaf(CAST_FROM_FN_PTR(address, BarrierSet::static_write_ref_array_post), addr, count);
752 (void) RegisterSaver::restore_live_registers(_masm, RegisterSaver::arg_registers);
753 // __ pop_frame(); // implicitly done in restore_live_registers()
754 } else {
755 // Tail call: call c and return to stub caller.
756 address entry_point = CAST_FROM_FN_PTR(address, BarrierSet::static_write_ref_array_post);
757 __ lgr_if_needed(Z_ARG1, addr);
758 __ lgr_if_needed(Z_ARG2, count);
759 __ load_const(Z_R1, entry_point);
760 __ z_br(Z_R1); // Branch without linking, callee will return to stub caller.
761 }
762 }
763 break;
764 case BarrierSet::CardTableBarrierSet:
765 // These cases formerly known as
766 // void array_store_check(Register addr, Register count, bool branchToEnd).
767 {
768 NearLabel doXC, done;
769 CardTableBarrierSet* ctbs = barrier_set_cast<CardTableBarrierSet>(bs);
770 CardTable* ct = ctbs->card_table();
771 assert(sizeof(*ct->byte_map_base()) == sizeof(jbyte), "adjust this code");
772 assert_different_registers(Z_R0, Z_R1, addr, count);
773
774 // Nothing to do if count <= 0.
775 if (branchToEnd) {
776 __ compare64_and_branch(count, (intptr_t) 0, Assembler::bcondNotHigh, done);
777 } else {
778 __ z_ltgr(count, count);
779 __ z_bcr(Assembler::bcondNotPositive, Z_R14);
780 }
781
782 // Note: We can't combine the shifts. We could lose a carry
783 // from calculating the array end address.
784 // count = (count-1)*BytesPerHeapOop + addr
785 // Count holds addr of last oop in array then.
786 __ z_sllg(count, count, LogBytesPerHeapOop);
787 __ add2reg_with_index(count, -BytesPerHeapOop, count, addr);
788
|