1 /* |
1 /* |
2 * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
22 * |
22 * |
23 */ |
23 */ |
24 |
24 |
25 #include "precompiled.hpp" |
25 #include "precompiled.hpp" |
26 #include "asm/macroAssembler.inline.hpp" |
26 #include "asm/macroAssembler.inline.hpp" |
|
27 #include "gc/shared/cardTable.hpp" |
|
28 #include "gc/shared/cardTableModRefBS.hpp" |
27 #include "interpreter/interpreter.hpp" |
29 #include "interpreter/interpreter.hpp" |
28 #include "nativeInst_sparc.hpp" |
30 #include "nativeInst_sparc.hpp" |
29 #include "oops/instanceOop.hpp" |
31 #include "oops/instanceOop.hpp" |
30 #include "oops/method.hpp" |
32 #include "oops/method.hpp" |
31 #include "oops/objArrayKlass.hpp" |
33 #include "oops/objArrayKlass.hpp" |
835 BarrierSet* bs = Universe::heap()->barrier_set(); |
837 BarrierSet* bs = Universe::heap()->barrier_set(); |
836 switch (bs->kind()) { |
838 switch (bs->kind()) { |
837 case BarrierSet::G1SATBCTLogging: |
839 case BarrierSet::G1SATBCTLogging: |
838 // With G1, don't generate the call if we statically know that the target in uninitialized |
840 // With G1, don't generate the call if we statically know that the target in uninitialized |
839 if (!dest_uninitialized) { |
841 if (!dest_uninitialized) { |
|
842 Register tmp = O5; |
|
843 assert_different_registers(addr, count, tmp); |
|
844 Label filtered; |
|
845 // Is marking active? |
|
846 if (in_bytes(SATBMarkQueue::byte_width_of_active()) == 4) { |
|
847 __ ld(G2, in_bytes(JavaThread::satb_mark_queue_offset() + SATBMarkQueue::byte_offset_of_active()), tmp); |
|
848 } else { |
|
849 guarantee(in_bytes(SATBMarkQueue::byte_width_of_active()) == 1, |
|
850 "Assumption"); |
|
851 __ ldsb(G2, in_bytes(JavaThread::satb_mark_queue_offset() + SATBMarkQueue::byte_offset_of_active()), tmp); |
|
852 } |
|
853 // Is marking active? |
|
854 __ cmp_and_br_short(tmp, G0, Assembler::equal, Assembler::pt, filtered); |
|
855 |
840 __ save_frame(0); |
856 __ save_frame(0); |
841 // Save the necessary global regs... will be used after. |
857 // Save the necessary global regs... will be used after. |
842 if (addr->is_global()) { |
858 if (addr->is_global()) { |
843 __ mov(addr, L0); |
859 __ mov(addr, L0); |
844 } |
860 } |
890 __ call(CAST_FROM_FN_PTR(address, BarrierSet::static_write_ref_array_post)); |
907 __ call(CAST_FROM_FN_PTR(address, BarrierSet::static_write_ref_array_post)); |
891 __ delayed()->mov(count->after_save(), O1); |
908 __ delayed()->mov(count->after_save(), O1); |
892 __ restore(); |
909 __ restore(); |
893 } |
910 } |
894 break; |
911 break; |
895 case BarrierSet::CardTableForRS: |
912 case BarrierSet::CardTableModRef: |
896 case BarrierSet::CardTableExtension: |
|
897 { |
913 { |
898 CardTableModRefBS* ct = barrier_set_cast<CardTableModRefBS>(bs); |
914 CardTableModRefBS* ctbs = barrier_set_cast<CardTableModRefBS>(bs); |
899 assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code"); |
915 CardTable* ct = ctbs->card_table(); |
|
916 assert(sizeof(*ct->byte_map_base()) == sizeof(jbyte), "adjust this code"); |
900 assert_different_registers(addr, count, tmp); |
917 assert_different_registers(addr, count, tmp); |
901 |
918 |
902 Label L_loop, L_done; |
919 Label L_loop, L_done; |
903 |
920 |
904 __ cmp_and_br_short(count, 0, Assembler::equal, Assembler::pt, L_done); // zero count - nothing to do |
921 __ cmp_and_br_short(count, 0, Assembler::equal, Assembler::pt, L_done); // zero count - nothing to do |
905 |
922 |
906 __ sll_ptr(count, LogBytesPerHeapOop, count); |
923 __ sll_ptr(count, LogBytesPerHeapOop, count); |
907 __ sub(count, BytesPerHeapOop, count); |
924 __ sub(count, BytesPerHeapOop, count); |
908 __ add(count, addr, count); |
925 __ add(count, addr, count); |
909 // Use two shifts to clear out those low order two bits! (Cannot opt. into 1.) |
926 // Use two shifts to clear out those low order two bits! (Cannot opt. into 1.) |
910 __ srl_ptr(addr, CardTableModRefBS::card_shift, addr); |
927 __ srl_ptr(addr, CardTable::card_shift, addr); |
911 __ srl_ptr(count, CardTableModRefBS::card_shift, count); |
928 __ srl_ptr(count, CardTable::card_shift, count); |
912 __ sub(count, addr, count); |
929 __ sub(count, addr, count); |
913 AddressLiteral rs(ct->byte_map_base); |
930 AddressLiteral rs(ct->byte_map_base()); |
914 __ set(rs, tmp); |
931 __ set(rs, tmp); |
915 __ BIND(L_loop); |
932 __ BIND(L_loop); |
916 __ stb(G0, tmp, addr); |
933 __ stb(G0, tmp, addr); |
917 __ subcc(count, 1, count); |
934 __ subcc(count, 1, count); |
918 __ brx(Assembler::greaterEqual, false, Assembler::pt, L_loop); |
935 __ brx(Assembler::greaterEqual, false, Assembler::pt, L_loop); |