28 #include "c1/c1_MacroAssembler.hpp"
29 #include "c1/c1_Runtime1.hpp"
30 #include "ci/ciUtilities.hpp"
31 #include "gc/shared/cardTable.hpp"
32 #include "gc/shared/cardTableBarrierSet.hpp"
33 #include "interpreter/interpreter.hpp"
34 #include "nativeInst_s390.hpp"
35 #include "oops/compiledICHolder.hpp"
36 #include "oops/oop.inline.hpp"
37 #include "prims/jvmtiExport.hpp"
38 #include "register_s390.hpp"
39 #include "runtime/sharedRuntime.hpp"
40 #include "runtime/signature.hpp"
41 #include "runtime/vframeArray.hpp"
42 #include "utilities/macros.hpp"
43 #include "vmreg_s390.inline.hpp"
44 #include "registerSaver_s390.hpp"
45 #if INCLUDE_ALL_GCS
46 #include "gc/g1/g1BarrierSet.hpp"
47 #include "gc/g1/g1CardTable.hpp"
48 #endif
49
50 // Implementation of StubAssembler
51
52 int StubAssembler::call_RT(Register oop_result1, Register metadata_result, address entry_point, int number_of_arguments) {
53 set_num_rt_args(0); // Nothing on stack.
54 assert(!(oop_result1->is_valid() || metadata_result->is_valid()) || oop_result1 != metadata_result, "registers must be different");
55
56 // We cannot trust that code generated by the C++ compiler saves R14
57 // to z_abi_160.return_pc, because sometimes it spills R14 using stmg at
58 // z_abi_160.gpr14 (e.g. InterpreterRuntime::_new()).
59 // Therefore we load the PC into Z_R1_scratch and let set_last_Java_frame() save
60 // it into the frame anchor.
61 address pc = get_PC(Z_R1_scratch);
62 int call_offset = (int)(pc - addr_at(0));
63 set_last_Java_frame(Z_SP, Z_R1_scratch);
64
65 // ARG1 must hold thread address.
66 z_lgr(Z_ARG1, Z_thread);
67
763 break;
764 #endif // TODO
765
766 #if INCLUDE_ALL_GCS
767 case g1_pre_barrier_slow_id:
768 { // Z_R1_scratch: previous value of memory
769
770 BarrierSet* bs = Universe::heap()->barrier_set();
771 if (bs->kind() != BarrierSet::G1BarrierSet) {
772 __ should_not_reach_here(FILE_AND_LINE);
773 break;
774 }
775
776 __ set_info("g1_pre_barrier_slow_id", dont_gc_arguments);
777
778 Register pre_val = Z_R1_scratch;
779 Register tmp = Z_R6; // Must be non-volatile because it is used to save pre_val.
780 Register tmp2 = Z_R7;
781
782 Label refill, restart, marking_not_active;
783 int satb_q_active_byte_offset =
784 in_bytes(JavaThread::satb_mark_queue_offset() +
785 SATBMarkQueue::byte_offset_of_active());
786 int satb_q_index_byte_offset =
787 in_bytes(JavaThread::satb_mark_queue_offset() +
788 SATBMarkQueue::byte_offset_of_index());
789 int satb_q_buf_byte_offset =
790 in_bytes(JavaThread::satb_mark_queue_offset() +
791 SATBMarkQueue::byte_offset_of_buf());
792
793 // Save tmp registers (see assertion in G1PreBarrierStub::emit_code()).
794 __ z_stg(tmp, 0*BytesPerWord + FrameMap::first_available_sp_in_frame, Z_SP);
795 __ z_stg(tmp2, 1*BytesPerWord + FrameMap::first_available_sp_in_frame, Z_SP);
796
797 // Is marking still active?
798 if (in_bytes(SATBMarkQueue::byte_width_of_active()) == 4) {
799 __ load_and_test_int(tmp, Address(Z_thread, satb_q_active_byte_offset));
800 } else {
801 assert(in_bytes(SATBMarkQueue::byte_width_of_active()) == 1, "Assumption");
802 __ load_and_test_byte(tmp, Address(Z_thread, satb_q_active_byte_offset));
803 }
804 __ z_bre(marking_not_active); // Activity indicator is zero, so there is no marking going on currently.
805
806 __ bind(restart);
807 // Load the index into the SATB buffer. SATBMarkQueue::_index is a
808 // size_t so ld_ptr is appropriate.
809 __ z_ltg(tmp, satb_q_index_byte_offset, Z_R0, Z_thread);
810
811 // index == 0?
873
874 __ bind(young_card);
875 // We didn't take the branch, so we're already dirty: restore
876 // used registers and return.
877 __ z_lg(r1, 0*BytesPerWord + FrameMap::first_available_sp_in_frame, Z_SP);
878 __ z_br(Z_R14);
879
880 // Not dirty.
881 __ bind(not_already_dirty);
882
883 // First, dirty it: [addr_card] := 0
884 __ z_mvi(0, addr_card, CardTable::dirty_card_val());
885
886 Register idx = cardtable; // Must be non-volatile, because it is used to save addr_card.
887 Register buf = r2;
888 cardtable = noreg; // now dead
889
890 // Save registers used below (see assertion in G1PreBarrierStub::emit_code()).
891 __ z_stg(r2, 1*BytesPerWord + FrameMap::first_available_sp_in_frame, Z_SP);
892
893 ByteSize dirty_card_q_index_byte_offset =
894 JavaThread::dirty_card_queue_offset() + DirtyCardQueue::byte_offset_of_index();
895 ByteSize dirty_card_q_buf_byte_offset =
896 JavaThread::dirty_card_queue_offset() + DirtyCardQueue::byte_offset_of_buf();
897
898 __ bind(restart);
899
900 // Get the index into the update buffer. DirtyCardQueue::_index is
901 // a size_t so z_ltg is appropriate here.
902 __ z_ltg(idx, Address(Z_thread, dirty_card_q_index_byte_offset));
903
904 // index == 0?
905 __ z_brz(refill);
906
907 __ z_lg(buf, Address(Z_thread, dirty_card_q_buf_byte_offset));
908 __ add2reg(idx, -oopSize);
909
910 __ z_stg(addr_card, 0, idx, buf); // [_buf + index] := <address_of_card>
911 __ z_stg(idx, Address(Z_thread, dirty_card_q_index_byte_offset));
912 // Restore killed registers and return.
913 __ z_lg(r1, 0*BytesPerWord + FrameMap::first_available_sp_in_frame, Z_SP);
914 __ z_lg(r2, 1*BytesPerWord + FrameMap::first_available_sp_in_frame, Z_SP);
915 __ z_br(Z_R14);
916
|
28 #include "c1/c1_MacroAssembler.hpp"
29 #include "c1/c1_Runtime1.hpp"
30 #include "ci/ciUtilities.hpp"
31 #include "gc/shared/cardTable.hpp"
32 #include "gc/shared/cardTableBarrierSet.hpp"
33 #include "interpreter/interpreter.hpp"
34 #include "nativeInst_s390.hpp"
35 #include "oops/compiledICHolder.hpp"
36 #include "oops/oop.inline.hpp"
37 #include "prims/jvmtiExport.hpp"
38 #include "register_s390.hpp"
39 #include "runtime/sharedRuntime.hpp"
40 #include "runtime/signature.hpp"
41 #include "runtime/vframeArray.hpp"
42 #include "utilities/macros.hpp"
43 #include "vmreg_s390.inline.hpp"
44 #include "registerSaver_s390.hpp"
45 #if INCLUDE_ALL_GCS
46 #include "gc/g1/g1BarrierSet.hpp"
47 #include "gc/g1/g1CardTable.hpp"
48 #include "gc/g1/g1ThreadLocalData.hpp"
49 #endif
50
51 // Implementation of StubAssembler
52
53 int StubAssembler::call_RT(Register oop_result1, Register metadata_result, address entry_point, int number_of_arguments) {
54 set_num_rt_args(0); // Nothing on stack.
55 assert(!(oop_result1->is_valid() || metadata_result->is_valid()) || oop_result1 != metadata_result, "registers must be different");
56
57 // We cannot trust that code generated by the C++ compiler saves R14
58 // to z_abi_160.return_pc, because sometimes it spills R14 using stmg at
59 // z_abi_160.gpr14 (e.g. InterpreterRuntime::_new()).
60 // Therefore we load the PC into Z_R1_scratch and let set_last_Java_frame() save
61 // it into the frame anchor.
62 address pc = get_PC(Z_R1_scratch);
63 int call_offset = (int)(pc - addr_at(0));
64 set_last_Java_frame(Z_SP, Z_R1_scratch);
65
66 // ARG1 must hold thread address.
67 z_lgr(Z_ARG1, Z_thread);
68
764 break;
765 #endif // TODO
766
767 #if INCLUDE_ALL_GCS
768 case g1_pre_barrier_slow_id:
769 { // Z_R1_scratch: previous value of memory
770
771 BarrierSet* bs = Universe::heap()->barrier_set();
772 if (bs->kind() != BarrierSet::G1BarrierSet) {
773 __ should_not_reach_here(FILE_AND_LINE);
774 break;
775 }
776
777 __ set_info("g1_pre_barrier_slow_id", dont_gc_arguments);
778
779 Register pre_val = Z_R1_scratch;
780 Register tmp = Z_R6; // Must be non-volatile because it is used to save pre_val.
781 Register tmp2 = Z_R7;
782
783 Label refill, restart, marking_not_active;
784 int satb_q_active_byte_offset = in_bytes(G1ThreadLocalData::satb_mark_queue_active_offset());
785 int satb_q_index_byte_offset = in_bytes(G1ThreadLocalData::satb_mark_queue_index_offset());
786 int satb_q_buf_byte_offset = in_bytes(G1ThreadLocalData::satb_mark_queue_buffer_offset());
787
788 // Save tmp registers (see assertion in G1PreBarrierStub::emit_code()).
789 __ z_stg(tmp, 0*BytesPerWord + FrameMap::first_available_sp_in_frame, Z_SP);
790 __ z_stg(tmp2, 1*BytesPerWord + FrameMap::first_available_sp_in_frame, Z_SP);
791
792 // Is marking still active?
793 if (in_bytes(SATBMarkQueue::byte_width_of_active()) == 4) {
794 __ load_and_test_int(tmp, Address(Z_thread, satb_q_active_byte_offset));
795 } else {
796 assert(in_bytes(SATBMarkQueue::byte_width_of_active()) == 1, "Assumption");
797 __ load_and_test_byte(tmp, Address(Z_thread, satb_q_active_byte_offset));
798 }
799 __ z_bre(marking_not_active); // Activity indicator is zero, so there is no marking going on currently.
800
801 __ bind(restart);
802 // Load the index into the SATB buffer. SATBMarkQueue::_index is a
803 // size_t so ld_ptr is appropriate.
804 __ z_ltg(tmp, satb_q_index_byte_offset, Z_R0, Z_thread);
805
806 // index == 0?
868
869 __ bind(young_card);
870 // We didn't take the branch, so we're already dirty: restore
871 // used registers and return.
872 __ z_lg(r1, 0*BytesPerWord + FrameMap::first_available_sp_in_frame, Z_SP);
873 __ z_br(Z_R14);
874
875 // Not dirty.
876 __ bind(not_already_dirty);
877
878 // First, dirty it: [addr_card] := 0
879 __ z_mvi(0, addr_card, CardTable::dirty_card_val());
880
881 Register idx = cardtable; // Must be non-volatile, because it is used to save addr_card.
882 Register buf = r2;
883 cardtable = noreg; // now dead
884
885 // Save registers used below (see assertion in G1PreBarrierStub::emit_code()).
886 __ z_stg(r2, 1*BytesPerWord + FrameMap::first_available_sp_in_frame, Z_SP);
887
888 ByteSize dirty_card_q_index_byte_offset = G1ThreadLocalData::dirty_card_queue_index_offset();
889 ByteSize dirty_card_q_buf_byte_offset = G1ThreadLocalData::dirty_card_queue_buffer_offset();
890
891 __ bind(restart);
892
893 // Get the index into the update buffer. DirtyCardQueue::_index is
894 // a size_t so z_ltg is appropriate here.
895 __ z_ltg(idx, Address(Z_thread, dirty_card_q_index_byte_offset));
896
897 // index == 0?
898 __ z_brz(refill);
899
900 __ z_lg(buf, Address(Z_thread, dirty_card_q_buf_byte_offset));
901 __ add2reg(idx, -oopSize);
902
903 __ z_stg(addr_card, 0, idx, buf); // [_buf + index] := <address_of_card>
904 __ z_stg(idx, Address(Z_thread, dirty_card_q_index_byte_offset));
905 // Restore killed registers and return.
906 __ z_lg(r1, 0*BytesPerWord + FrameMap::first_available_sp_in_frame, Z_SP);
907 __ z_lg(r2, 1*BytesPerWord + FrameMap::first_available_sp_in_frame, Z_SP);
908 __ z_br(Z_R14);
909
|