src/cpu/x86/vm/c1_Runtime1_x86.cpp

Print this page
rev 5363 : imported patch filtering.diff


  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");
  50   assert(args_size >= 0, "illegal args_size");
  51   bool align_stack = false;
  52 #ifdef _LP64
  53   // At a method handle call, the stack may not be properly aligned
  54   // when returning with an exception.
  55   align_stack = (stub_id() == Runtime1::handle_exception_from_callee_id);
  56 #endif
  57 
  58 #ifdef _LP64
  59   mov(c_rarg0, thread);
  60   set_num_rt_args(0); // Nothing on stack


1736         ExternalAddress cardtable((address)ct->byte_map_base);
1737         assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code");
1738 
1739         const Register card_addr = rcx;
1740 #ifdef _LP64
1741         const Register tmp = rscratch1;
1742         f.load_argument(0, card_addr);
1743         __ shrq(card_addr, CardTableModRefBS::card_shift);
1744         __ lea(tmp, cardtable);
1745         // get the address of the card
1746         __ addq(card_addr, tmp);
1747 #else
1748         const Register card_index = rcx;
1749         f.load_argument(0, card_index);
1750         __ shrl(card_index, CardTableModRefBS::card_shift);
1751 
1752         Address index(noreg, card_index, Address::times_1);
1753         __ leal(card_addr, __ as_Address(ArrayAddress(cardtable, index)));
1754 #endif
1755 
1756         __ cmpb(Address(card_addr, 0), 0);




1757         __ jcc(Assembler::equal, done);
1758 
1759         // storing region crossing non-NULL, card is clean.
1760         // dirty card and log.
1761 
1762         __ movb(Address(card_addr, 0), 0);
1763 
1764         __ cmpl(queue_index, 0);
1765         __ jcc(Assembler::equal, runtime);
1766         __ subl(queue_index, wordSize);
1767 
1768         const Register buffer_addr = rbx;
1769         __ push(rbx);
1770 
1771         __ movptr(buffer_addr, buffer);
1772 
1773 #ifdef _LP64
1774         __ movslq(rscratch1, queue_index);
1775         __ addptr(buffer_addr, rscratch1);
1776 #else
1777         __ addptr(buffer_addr, queue_index);
1778 #endif
1779         __ movptr(Address(buffer_addr, 0), card_addr);
1780 
1781         __ pop(rbx);
1782         __ jmp(done);




  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 #if INCLUDE_ALL_GCS
  42 #include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp"
  43 #endif
  44 
  45 
  46 // Implementation of StubAssembler
  47 
  48 int StubAssembler::call_RT(Register oop_result1, Register metadata_result, address entry, int args_size) {
  49   // setup registers
  50   const Register thread = NOT_LP64(rdi) LP64_ONLY(r15_thread); // is callee-saved register (Visual C++ calling conventions)
  51   assert(!(oop_result1->is_valid() || metadata_result->is_valid()) || oop_result1 != metadata_result, "registers must be different");
  52   assert(oop_result1 != thread && metadata_result != thread, "registers must be different");
  53   assert(args_size >= 0, "illegal args_size");
  54   bool align_stack = false;
  55 #ifdef _LP64
  56   // At a method handle call, the stack may not be properly aligned
  57   // when returning with an exception.
  58   align_stack = (stub_id() == Runtime1::handle_exception_from_callee_id);
  59 #endif
  60 
  61 #ifdef _LP64
  62   mov(c_rarg0, thread);
  63   set_num_rt_args(0); // Nothing on stack


1739         ExternalAddress cardtable((address)ct->byte_map_base);
1740         assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code");
1741 
1742         const Register card_addr = rcx;
1743 #ifdef _LP64
1744         const Register tmp = rscratch1;
1745         f.load_argument(0, card_addr);
1746         __ shrq(card_addr, CardTableModRefBS::card_shift);
1747         __ lea(tmp, cardtable);
1748         // get the address of the card
1749         __ addq(card_addr, tmp);
1750 #else
1751         const Register card_index = rcx;
1752         f.load_argument(0, card_index);
1753         __ shrl(card_index, CardTableModRefBS::card_shift);
1754 
1755         Address index(noreg, card_index, Address::times_1);
1756         __ leal(card_addr, __ as_Address(ArrayAddress(cardtable, index)));
1757 #endif
1758 
1759         __ cmpb(Address(card_addr, 0), (int)G1SATBCardTableModRefBS::g1_young_card_val());
1760         __ jcc(Assembler::equal, done);
1761 
1762         __ membar(Assembler::Membar_mask_bits(Assembler::StoreLoad));
1763         __ cmpb(Address(card_addr, 0), (int)CardTableModRefBS::dirty_card_val());
1764         __ jcc(Assembler::equal, done);
1765 
1766         // storing region crossing non-NULL, card is clean.
1767         // dirty card and log.
1768 
1769         __ movb(Address(card_addr, 0), (int)CardTableModRefBS::dirty_card_val());
1770 
1771         __ cmpl(queue_index, 0);
1772         __ jcc(Assembler::equal, runtime);
1773         __ subl(queue_index, wordSize);
1774 
1775         const Register buffer_addr = rbx;
1776         __ push(rbx);
1777 
1778         __ movptr(buffer_addr, buffer);
1779 
1780 #ifdef _LP64
1781         __ movslq(rscratch1, queue_index);
1782         __ addptr(buffer_addr, rscratch1);
1783 #else
1784         __ addptr(buffer_addr, queue_index);
1785 #endif
1786         __ movptr(Address(buffer_addr, 0), card_addr);
1787 
1788         __ pop(rbx);
1789         __ jmp(done);