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/assembler.hpp"
27 #include "c1/c1_Defs.hpp"
28 #include "c1/c1_MacroAssembler.hpp"
29 #include "c1/c1_Runtime1.hpp"
30 #include "interpreter/interpreter.hpp"
31 #include "nativeInst_x86.hpp"
32 #include "oops/compiledICHolder.hpp"
33 #include "oops/oop.inline.hpp"
34 #include "prims/jvmtiExport.hpp"
35 #include "register_x86.hpp"
36 #include "runtime/sharedRuntime.hpp"
37 #include "runtime/signature.hpp"
38 #include "runtime/vframeArray.hpp"
39 #include "utilities/macros.hpp"
40 #include "vmreg_x86.inline.hpp"
41
42
43 // Implementation of StubAssembler
44
45 int StubAssembler::call_RT(Register oop_result1, Register metadata_result, address entry, int args_size) {
46 // setup registers
47 const Register thread = NOT_LP64(rdi) LP64_ONLY(r15_thread); // is callee-saved register (Visual C++ calling conventions)
48 assert(!(oop_result1->is_valid() || metadata_result->is_valid()) || oop_result1 != metadata_result, "registers must be different");
49 assert(oop_result1 != thread && metadata_result != thread, "registers must be different");
1729 ExternalAddress cardtable((address)ct->byte_map_base);
1730 assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code");
1731
1732 const Register card_addr = rcx;
1733 #ifdef _LP64
1734 const Register tmp = rscratch1;
1735 f.load_argument(0, card_addr);
1736 __ shrq(card_addr, CardTableModRefBS::card_shift);
1737 __ lea(tmp, cardtable);
1738 // get the address of the card
1739 __ addq(card_addr, tmp);
1740 #else
1741 const Register card_index = rcx;
1742 f.load_argument(0, card_index);
1743 __ shrl(card_index, CardTableModRefBS::card_shift);
1744
1745 Address index(noreg, card_index, Address::times_1);
1746 __ leal(card_addr, __ as_Address(ArrayAddress(cardtable, index)));
1747 #endif
1748
1749 __ cmpb(Address(card_addr, 0), 0);
1750 __ jcc(Assembler::equal, done);
1751
1752 // storing region crossing non-NULL, card is clean.
1753 // dirty card and log.
1754
1755 __ movb(Address(card_addr, 0), 0);
1756
1757 __ cmpl(queue_index, 0);
1758 __ jcc(Assembler::equal, runtime);
1759 __ subl(queue_index, wordSize);
1760
1761 const Register buffer_addr = rbx;
1762 __ push(rbx);
1763
1764 __ movptr(buffer_addr, buffer);
1765
1766 #ifdef _LP64
1767 __ movslq(rscratch1, queue_index);
1768 __ addptr(buffer_addr, rscratch1);
1769 #else
1770 __ addptr(buffer_addr, queue_index);
1771 #endif
1772 __ movptr(Address(buffer_addr, 0), card_addr);
1773
1774 __ pop(rbx);
1775 __ jmp(done);
|
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/assembler.hpp"
27 #include "c1/c1_Defs.hpp"
28 #include "c1/c1_MacroAssembler.hpp"
29 #include "c1/c1_Runtime1.hpp"
30 #include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp"
31 #include "interpreter/interpreter.hpp"
32 #include "nativeInst_x86.hpp"
33 #include "oops/compiledICHolder.hpp"
34 #include "oops/oop.inline.hpp"
35 #include "prims/jvmtiExport.hpp"
36 #include "register_x86.hpp"
37 #include "runtime/sharedRuntime.hpp"
38 #include "runtime/signature.hpp"
39 #include "runtime/vframeArray.hpp"
40 #include "utilities/macros.hpp"
41 #include "vmreg_x86.inline.hpp"
42
43
44 // Implementation of StubAssembler
45
46 int StubAssembler::call_RT(Register oop_result1, Register metadata_result, address entry, int args_size) {
47 // setup registers
48 const Register thread = NOT_LP64(rdi) LP64_ONLY(r15_thread); // is callee-saved register (Visual C++ calling conventions)
49 assert(!(oop_result1->is_valid() || metadata_result->is_valid()) || oop_result1 != metadata_result, "registers must be different");
50 assert(oop_result1 != thread && metadata_result != thread, "registers must be different");
1730 ExternalAddress cardtable((address)ct->byte_map_base);
1731 assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code");
1732
1733 const Register card_addr = rcx;
1734 #ifdef _LP64
1735 const Register tmp = rscratch1;
1736 f.load_argument(0, card_addr);
1737 __ shrq(card_addr, CardTableModRefBS::card_shift);
1738 __ lea(tmp, cardtable);
1739 // get the address of the card
1740 __ addq(card_addr, tmp);
1741 #else
1742 const Register card_index = rcx;
1743 f.load_argument(0, card_index);
1744 __ shrl(card_index, CardTableModRefBS::card_shift);
1745
1746 Address index(noreg, card_index, Address::times_1);
1747 __ leal(card_addr, __ as_Address(ArrayAddress(cardtable, index)));
1748 #endif
1749
1750 __ cmpb(Address(card_addr, 0), (int)CardTableModRefBS::g1_young_card_val());
1751 __ jcc(Assembler::equal, done);
1752
1753 __ membar(Assembler::Membar_mask_bits(Assembler::StoreLoad));
1754 __ cmpb(Address(card_addr, 0), (int)CardTableModRefBS::dirty_card_val());
1755 __ jcc(Assembler::equal, done);
1756
1757 // storing region crossing non-NULL, card is clean.
1758 // dirty card and log.
1759
1760 __ movb(Address(card_addr, 0), (int)CardTableModRefBS::dirty_card_val());
1761
1762 __ cmpl(queue_index, 0);
1763 __ jcc(Assembler::equal, runtime);
1764 __ subl(queue_index, wordSize);
1765
1766 const Register buffer_addr = rbx;
1767 __ push(rbx);
1768
1769 __ movptr(buffer_addr, buffer);
1770
1771 #ifdef _LP64
1772 __ movslq(rscratch1, queue_index);
1773 __ addptr(buffer_addr, rscratch1);
1774 #else
1775 __ addptr(buffer_addr, queue_index);
1776 #endif
1777 __ movptr(Address(buffer_addr, 0), card_addr);
1778
1779 __ pop(rbx);
1780 __ jmp(done);
|