< prev index next >

src/hotspot/cpu/x86/macroAssembler_x86.hpp

Print this page

  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 #ifndef CPU_X86_MACROASSEMBLER_X86_HPP
  26 #define CPU_X86_MACROASSEMBLER_X86_HPP
  27 
  28 #include "asm/assembler.hpp"
  29 #include "asm/register.hpp"
  30 #include "code/vmreg.inline.hpp"
  31 #include "compiler/oopMap.hpp"
  32 #include "utilities/macros.hpp"
  33 #include "runtime/rtmLocking.hpp"

  34 #include "runtime/vm_version.hpp"
  35 #include "utilities/checkedCast.hpp"
  36 


  37 // MacroAssembler extends Assembler by frequently used macros.
  38 //
  39 // Instructions for which a 'better' code sequence exists depending
  40 // on arguments should also go in here.
  41 
  42 class MacroAssembler: public Assembler {
  43   friend class LIR_Assembler;
  44   friend class Runtime1;      // as_Address()
  45 
  46  public:
  47   // Support for VM calls
  48   //
  49   // This is the base routine called by the different versions of call_VM_leaf. The interpreter
  50   // may customize this version by overriding it for its purposes (e.g., to save/restore
  51   // additional registers when doing a VM call).
  52 
  53   virtual void call_VM_leaf_base(
  54     address entry_point,               // the entry point
  55     int     number_of_arguments        // the number of arguments to pop after the call
  56   );

  86  // These routines should emit JVMTI PopFrame and ForceEarlyReturn handling code.
  87  // The implementation is only non-empty for the InterpreterMacroAssembler,
  88  // as only the interpreter handles PopFrame and ForceEarlyReturn requests.
  89  virtual void check_and_handle_popframe(Register java_thread);
  90  virtual void check_and_handle_earlyret(Register java_thread);
  91 
  92   Address as_Address(AddressLiteral adr);
  93   Address as_Address(ArrayAddress adr, Register rscratch);
  94 
  95   // Support for null-checks
  96   //
  97   // Generates code that causes a null OS exception if the content of reg is null.
  98   // If the accessed location is M[reg + offset] and the offset is known, provide the
  99   // offset. No explicit code generation is needed if the offset is within a certain
 100   // range (0 <= offset <= page_size).
 101 
 102   void null_check(Register reg, int offset = -1);
 103   static bool needs_explicit_null_check(intptr_t offset);
 104   static bool uses_implicit_null_check(void* address);
 105 































 106   // Required platform-specific helpers for Label::patch_instructions.
 107   // They _shadow_ the declarations in AbstractAssembler, which are undefined.
 108   void pd_patch_instruction(address branch, address target, const char* file, int line) {
 109     unsigned char op = branch[0];
 110     assert(op == 0xE8 /* call */ ||
 111         op == 0xE9 /* jmp */ ||
 112         op == 0xEB /* short jmp */ ||
 113         (op & 0xF0) == 0x70 /* short jcc */ ||
 114         op == 0x0F && (branch[1] & 0xF0) == 0x80 /* jcc */ ||
 115         op == 0xC7 && branch[1] == 0xF8 /* xbegin */,
 116         "Invalid opcode at patch point");
 117 
 118     if (op == 0xEB || (op & 0xF0) == 0x70) {
 119       // short offset operators (jmp and jcc)
 120       char* disp = (char*) &branch[1];
 121       int imm8 = checked_cast<int>(target - (address) &disp[1]);
 122       guarantee(this->is8bit(imm8), "Short forward jump exceeds 8-bit offset at %s:%d",
 123                 file == nullptr ? "<null>" : file, line);
 124       *disp = (char)imm8;
 125     } else {

 347   void resolve_global_jobject(Register value, Register thread, Register tmp);
 348 
 349   // C 'boolean' to Java boolean: x == 0 ? 0 : 1
 350   void c2bool(Register x);
 351 
 352   // C++ bool manipulation
 353 
 354   void movbool(Register dst, Address src);
 355   void movbool(Address dst, bool boolconst);
 356   void movbool(Address dst, Register src);
 357   void testbool(Register dst);
 358 
 359   void resolve_oop_handle(Register result, Register tmp);
 360   void resolve_weak_handle(Register result, Register tmp);
 361   void load_mirror(Register mirror, Register method, Register tmp);
 362   void load_method_holder_cld(Register rresult, Register rmethod);
 363 
 364   void load_method_holder(Register holder, Register method);
 365 
 366   // oop manipulations

 367   void load_klass(Register dst, Register src, Register tmp);
 368   void store_klass(Register dst, Register src, Register tmp);
 369 
 370   void access_load_at(BasicType type, DecoratorSet decorators, Register dst, Address src,
 371                       Register tmp1, Register thread_tmp);
 372   void access_store_at(BasicType type, DecoratorSet decorators, Address dst, Register val,
 373                        Register tmp1, Register tmp2, Register tmp3);
 374 










 375   void load_heap_oop(Register dst, Address src, Register tmp1 = noreg,
 376                      Register thread_tmp = noreg, DecoratorSet decorators = 0);
 377   void load_heap_oop_not_null(Register dst, Address src, Register tmp1 = noreg,
 378                               Register thread_tmp = noreg, DecoratorSet decorators = 0);
 379   void store_heap_oop(Address dst, Register val, Register tmp1 = noreg,
 380                       Register tmp2 = noreg, Register tmp3 = noreg, DecoratorSet decorators = 0);
 381 
 382   // Used for storing null. All other oop constants should be
 383   // stored using routines that take a jobject.
 384   void store_heap_oop_null(Address dst);
 385 


 386 #ifdef _LP64
 387   void store_klass_gap(Register dst, Register src);
 388 
 389   // This dummy is to prevent a call to store_heap_oop from
 390   // converting a zero (like null) into a Register by giving
 391   // the compiler two choices it can't resolve
 392 
 393   void store_heap_oop(Address dst, void* dummy);
 394 
 395   void encode_heap_oop(Register r);
 396   void decode_heap_oop(Register r);
 397   void encode_heap_oop_not_null(Register r);
 398   void decode_heap_oop_not_null(Register r);
 399   void encode_heap_oop_not_null(Register dst, Register src);
 400   void decode_heap_oop_not_null(Register dst, Register src);
 401 
 402   void set_narrow_oop(Register dst, jobject obj);
 403   void set_narrow_oop(Address dst, jobject obj);
 404   void cmp_narrow_oop(Register dst, jobject obj);
 405   void cmp_narrow_oop(Address dst, jobject obj);

 567 
 568 public:
 569   void push_set(RegSet set, int offset = -1);
 570   void pop_set(RegSet set, int offset = -1);
 571 
 572   // Push and pop everything that might be clobbered by a native
 573   // runtime call.
 574   // Only save the lower 64 bits of each vector register.
 575   // Additional registers can be excluded in a passed RegSet.
 576   void push_call_clobbered_registers_except(RegSet exclude, bool save_fpu = true);
 577   void pop_call_clobbered_registers_except(RegSet exclude, bool restore_fpu = true);
 578 
 579   void push_call_clobbered_registers(bool save_fpu = true) {
 580     push_call_clobbered_registers_except(RegSet(), save_fpu);
 581   }
 582   void pop_call_clobbered_registers(bool restore_fpu = true) {
 583     pop_call_clobbered_registers_except(RegSet(), restore_fpu);
 584   }
 585 
 586   // allocation









 587   void tlab_allocate(
 588     Register thread,                   // Current thread
 589     Register obj,                      // result: pointer to object after successful allocation
 590     Register var_size_in_bytes,        // object size in bytes if unknown at compile time; invalid otherwise
 591     int      con_size_in_bytes,        // object size in bytes if   known at compile time
 592     Register t1,                       // temp register
 593     Register t2,                       // temp register
 594     Label&   slow_case                 // continuation point if fast allocation fails
 595   );
 596   void zero_memory(Register address, Register length_in_bytes, int offset_in_bytes, Register temp);
 597 



 598   // interface method calling
 599   void lookup_interface_method(Register recv_klass,
 600                                Register intf_klass,
 601                                RegisterOrConstant itable_index,
 602                                Register method_result,
 603                                Register scan_temp,
 604                                Label& no_such_interface,
 605                                bool return_method = true);
 606 
 607   void lookup_interface_method_stub(Register recv_klass,
 608                                     Register holder_klass,
 609                                     Register resolved_klass,
 610                                     Register method_result,
 611                                     Register scan_temp,
 612                                     Register temp_reg2,
 613                                     Register receiver,
 614                                     int itable_index,
 615                                     Label& L_no_such_interface);
 616 
 617   // virtual method calling

 738   // Instructions that use AddressLiteral operands. These instruction can handle 32bit/64bit
 739   // operands. In general the names are modified to avoid hiding the instruction in Assembler
 740   // so that we don't need to implement all the varieties in the Assembler with trivial wrappers
 741   // here in MacroAssembler. The major exception to this rule is call
 742 
 743   // Arithmetics
 744 
 745 
 746   void addptr(Address dst, int32_t src) { LP64_ONLY(addq(dst, src)) NOT_LP64(addl(dst, src)) ; }
 747   void addptr(Address dst, Register src);
 748 
 749   void addptr(Register dst, Address src) { LP64_ONLY(addq(dst, src)) NOT_LP64(addl(dst, src)); }
 750   void addptr(Register dst, int32_t src);
 751   void addptr(Register dst, Register src);
 752   void addptr(Register dst, RegisterOrConstant src) {
 753     if (src.is_constant()) addptr(dst, checked_cast<int>(src.as_constant()));
 754     else                   addptr(dst, src.as_register());
 755   }
 756 
 757   void andptr(Register dst, int32_t src);
 758   void andptr(Register src1, Register src2) { LP64_ONLY(andq(src1, src2)) NOT_LP64(andl(src1, src2)) ; }

 759 
 760 #ifdef _LP64
 761   using Assembler::andq;
 762   void andq(Register dst, AddressLiteral src, Register rscratch = noreg);
 763 #endif
 764 
 765   void cmp8(AddressLiteral src1, int imm, Register rscratch = noreg);
 766 
 767   // renamed to drag out the casting of address to int32_t/intptr_t
 768   void cmp32(Register src1, int32_t imm);
 769 
 770   void cmp32(AddressLiteral src1, int32_t imm, Register rscratch = noreg);
 771   // compare reg - mem, or reg - &mem
 772   void cmp32(Register src1, AddressLiteral src2, Register rscratch = noreg);
 773 
 774   void cmp32(Register src1, Address src2);
 775 
 776 #ifndef _LP64
 777   void cmpklass(Address dst, Metadata* obj);
 778   void cmpklass(Register dst, Metadata* obj);

1863   void movdl(XMMRegister dst, AddressLiteral src, Register rscratch = noreg);
1864 
1865   using Assembler::movq;
1866   void movq(XMMRegister dst, AddressLiteral src, Register rscratch = noreg);
1867 
1868   // Can push value or effective address
1869   void pushptr(AddressLiteral src, Register rscratch);
1870 
1871   void pushptr(Address src) { LP64_ONLY(pushq(src)) NOT_LP64(pushl(src)); }
1872   void popptr(Address src) { LP64_ONLY(popq(src)) NOT_LP64(popl(src)); }
1873 
1874   void pushoop(jobject obj, Register rscratch);
1875   void pushklass(Metadata* obj, Register rscratch);
1876 
1877   // sign extend as need a l to ptr sized element
1878   void movl2ptr(Register dst, Address src) { LP64_ONLY(movslq(dst, src)) NOT_LP64(movl(dst, src)); }
1879   void movl2ptr(Register dst, Register src) { LP64_ONLY(movslq(dst, src)) NOT_LP64(if (dst != src) movl(dst, src)); }
1880 
1881 
1882  public:















1883   // clear memory of size 'cnt' qwords, starting at 'base';
1884   // if 'is_large' is set, do not try to produce short loop
1885   void clear_mem(Register base, Register cnt, Register rtmp, XMMRegister xtmp, bool is_large, KRegister mask=knoreg);
1886 
1887   // clear memory initialization sequence for constant size;
1888   void clear_mem(Register base, int cnt, Register rtmp, XMMRegister xtmp, KRegister mask=knoreg);
1889 
1890   // clear memory of size 'cnt' qwords, starting at 'base' using XMM/YMM registers
1891   void xmm_clear_mem(Register base, Register cnt, Register rtmp, XMMRegister xtmp, KRegister mask=knoreg);
1892 
1893   // Fill primitive arrays
1894   void generate_fill(BasicType t, bool aligned,
1895                      Register to, Register value, Register count,
1896                      Register rtmp, XMMRegister xtmp);
1897 
1898   void encode_iso_array(Register src, Register dst, Register len,
1899                         XMMRegister tmp1, XMMRegister tmp2, XMMRegister tmp3,
1900                         XMMRegister tmp4, Register tmp5, Register result, bool ascii);
1901 
1902 #ifdef _LP64
1903   void add2_with_carry(Register dest_hi, Register dest_lo, Register src1, Register src2);
1904   void multiply_64_x_64_loop(Register x, Register xstart, Register x_xstart,
1905                              Register y, Register y_idx, Register z,

  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 #ifndef CPU_X86_MACROASSEMBLER_X86_HPP
  26 #define CPU_X86_MACROASSEMBLER_X86_HPP
  27 
  28 #include "asm/assembler.hpp"
  29 #include "asm/register.hpp"
  30 #include "code/vmreg.inline.hpp"
  31 #include "compiler/oopMap.hpp"
  32 #include "utilities/macros.hpp"
  33 #include "runtime/rtmLocking.hpp"
  34 #include "runtime/signature.hpp"
  35 #include "runtime/vm_version.hpp"
  36 #include "utilities/checkedCast.hpp"
  37 
  38 class ciInlineKlass;
  39 
  40 // MacroAssembler extends Assembler by frequently used macros.
  41 //
  42 // Instructions for which a 'better' code sequence exists depending
  43 // on arguments should also go in here.
  44 
  45 class MacroAssembler: public Assembler {
  46   friend class LIR_Assembler;
  47   friend class Runtime1;      // as_Address()
  48 
  49  public:
  50   // Support for VM calls
  51   //
  52   // This is the base routine called by the different versions of call_VM_leaf. The interpreter
  53   // may customize this version by overriding it for its purposes (e.g., to save/restore
  54   // additional registers when doing a VM call).
  55 
  56   virtual void call_VM_leaf_base(
  57     address entry_point,               // the entry point
  58     int     number_of_arguments        // the number of arguments to pop after the call
  59   );

  89  // These routines should emit JVMTI PopFrame and ForceEarlyReturn handling code.
  90  // The implementation is only non-empty for the InterpreterMacroAssembler,
  91  // as only the interpreter handles PopFrame and ForceEarlyReturn requests.
  92  virtual void check_and_handle_popframe(Register java_thread);
  93  virtual void check_and_handle_earlyret(Register java_thread);
  94 
  95   Address as_Address(AddressLiteral adr);
  96   Address as_Address(ArrayAddress adr, Register rscratch);
  97 
  98   // Support for null-checks
  99   //
 100   // Generates code that causes a null OS exception if the content of reg is null.
 101   // If the accessed location is M[reg + offset] and the offset is known, provide the
 102   // offset. No explicit code generation is needed if the offset is within a certain
 103   // range (0 <= offset <= page_size).
 104 
 105   void null_check(Register reg, int offset = -1);
 106   static bool needs_explicit_null_check(intptr_t offset);
 107   static bool uses_implicit_null_check(void* address);
 108 
 109   // markWord tests, kills markWord reg
 110   void test_markword_is_inline_type(Register markword, Label& is_inline_type);
 111 
 112   // inlineKlass queries, kills temp_reg
 113   void test_klass_is_inline_type(Register klass, Register temp_reg, Label& is_inline_type);
 114   void test_klass_is_empty_inline_type(Register klass, Register temp_reg, Label& is_empty_inline_type);
 115   void test_oop_is_not_inline_type(Register object, Register tmp, Label& not_inline_type);
 116 
 117   // Get the default value oop for the given InlineKlass
 118   void get_default_value_oop(Register inline_klass, Register temp_reg, Register obj);
 119   // The empty value oop, for the given InlineKlass ("empty" as in no instance fields)
 120   // get_default_value_oop with extra assertion for empty inline klass
 121   void get_empty_inline_type_oop(Register inline_klass, Register temp_reg, Register obj);
 122 
 123   void test_field_is_null_free_inline_type(Register flags, Register temp_reg, Label& is_null_free);
 124   void test_field_is_not_null_free_inline_type(Register flags, Register temp_reg, Label& not_null_free);
 125   void test_field_is_flat(Register flags, Register temp_reg, Label& is_flat);
 126 
 127   // Check oops for special arrays, i.e. flat arrays and/or null-free arrays
 128   void test_oop_prototype_bit(Register oop, Register temp_reg, int32_t test_bit, bool jmp_set, Label& jmp_label);
 129   void test_flat_array_oop(Register oop, Register temp_reg, Label& is_flat_array);
 130   void test_non_flat_array_oop(Register oop, Register temp_reg, Label& is_non_flat_array);
 131   void test_null_free_array_oop(Register oop, Register temp_reg, Label& is_null_free_array);
 132   void test_non_null_free_array_oop(Register oop, Register temp_reg, Label& is_non_null_free_array);
 133 
 134   // Check array klass layout helper for flat or null-free arrays...
 135   void test_flat_array_layout(Register lh, Label& is_flat_array);
 136   void test_non_flat_array_layout(Register lh, Label& is_non_flat_array);
 137   void test_null_free_array_layout(Register lh, Label& is_null_free_array);
 138   void test_non_null_free_array_layout(Register lh, Label& is_non_null_free_array);
 139 
 140   // Required platform-specific helpers for Label::patch_instructions.
 141   // They _shadow_ the declarations in AbstractAssembler, which are undefined.
 142   void pd_patch_instruction(address branch, address target, const char* file, int line) {
 143     unsigned char op = branch[0];
 144     assert(op == 0xE8 /* call */ ||
 145         op == 0xE9 /* jmp */ ||
 146         op == 0xEB /* short jmp */ ||
 147         (op & 0xF0) == 0x70 /* short jcc */ ||
 148         op == 0x0F && (branch[1] & 0xF0) == 0x80 /* jcc */ ||
 149         op == 0xC7 && branch[1] == 0xF8 /* xbegin */,
 150         "Invalid opcode at patch point");
 151 
 152     if (op == 0xEB || (op & 0xF0) == 0x70) {
 153       // short offset operators (jmp and jcc)
 154       char* disp = (char*) &branch[1];
 155       int imm8 = checked_cast<int>(target - (address) &disp[1]);
 156       guarantee(this->is8bit(imm8), "Short forward jump exceeds 8-bit offset at %s:%d",
 157                 file == nullptr ? "<null>" : file, line);
 158       *disp = (char)imm8;
 159     } else {

 381   void resolve_global_jobject(Register value, Register thread, Register tmp);
 382 
 383   // C 'boolean' to Java boolean: x == 0 ? 0 : 1
 384   void c2bool(Register x);
 385 
 386   // C++ bool manipulation
 387 
 388   void movbool(Register dst, Address src);
 389   void movbool(Address dst, bool boolconst);
 390   void movbool(Address dst, Register src);
 391   void testbool(Register dst);
 392 
 393   void resolve_oop_handle(Register result, Register tmp);
 394   void resolve_weak_handle(Register result, Register tmp);
 395   void load_mirror(Register mirror, Register method, Register tmp);
 396   void load_method_holder_cld(Register rresult, Register rmethod);
 397 
 398   void load_method_holder(Register holder, Register method);
 399 
 400   // oop manipulations
 401   void load_metadata(Register dst, Register src);
 402   void load_klass(Register dst, Register src, Register tmp);
 403   void store_klass(Register dst, Register src, Register tmp);
 404 
 405   void access_load_at(BasicType type, DecoratorSet decorators, Register dst, Address src,
 406                       Register tmp1, Register thread_tmp);
 407   void access_store_at(BasicType type, DecoratorSet decorators, Address dst, Register val,
 408                        Register tmp1, Register tmp2, Register tmp3);
 409 
 410   void access_value_copy(DecoratorSet decorators, Register src, Register dst, Register inline_klass);
 411 
 412   // inline type data payload offsets...
 413   void first_field_offset(Register inline_klass, Register offset);
 414   void data_for_oop(Register oop, Register data, Register inline_klass);
 415   // get data payload ptr a flat value array at index, kills rcx and index
 416   void data_for_value_array_index(Register array, Register array_klass,
 417                                   Register index, Register data);
 418 
 419 
 420   void load_heap_oop(Register dst, Address src, Register tmp1 = noreg,
 421                      Register thread_tmp = noreg, DecoratorSet decorators = 0);
 422   void load_heap_oop_not_null(Register dst, Address src, Register tmp1 = noreg,
 423                               Register thread_tmp = noreg, DecoratorSet decorators = 0);
 424   void store_heap_oop(Address dst, Register val, Register tmp1 = noreg,
 425                       Register tmp2 = noreg, Register tmp3 = noreg, DecoratorSet decorators = 0);
 426 
 427   // Used for storing null. All other oop constants should be
 428   // stored using routines that take a jobject.
 429   void store_heap_oop_null(Address dst);
 430 
 431   void load_prototype_header(Register dst, Register src, Register tmp);
 432 
 433 #ifdef _LP64
 434   void store_klass_gap(Register dst, Register src);
 435 
 436   // This dummy is to prevent a call to store_heap_oop from
 437   // converting a zero (like null) into a Register by giving
 438   // the compiler two choices it can't resolve
 439 
 440   void store_heap_oop(Address dst, void* dummy);
 441 
 442   void encode_heap_oop(Register r);
 443   void decode_heap_oop(Register r);
 444   void encode_heap_oop_not_null(Register r);
 445   void decode_heap_oop_not_null(Register r);
 446   void encode_heap_oop_not_null(Register dst, Register src);
 447   void decode_heap_oop_not_null(Register dst, Register src);
 448 
 449   void set_narrow_oop(Register dst, jobject obj);
 450   void set_narrow_oop(Address dst, jobject obj);
 451   void cmp_narrow_oop(Register dst, jobject obj);
 452   void cmp_narrow_oop(Address dst, jobject obj);

 614 
 615 public:
 616   void push_set(RegSet set, int offset = -1);
 617   void pop_set(RegSet set, int offset = -1);
 618 
 619   // Push and pop everything that might be clobbered by a native
 620   // runtime call.
 621   // Only save the lower 64 bits of each vector register.
 622   // Additional registers can be excluded in a passed RegSet.
 623   void push_call_clobbered_registers_except(RegSet exclude, bool save_fpu = true);
 624   void pop_call_clobbered_registers_except(RegSet exclude, bool restore_fpu = true);
 625 
 626   void push_call_clobbered_registers(bool save_fpu = true) {
 627     push_call_clobbered_registers_except(RegSet(), save_fpu);
 628   }
 629   void pop_call_clobbered_registers(bool restore_fpu = true) {
 630     pop_call_clobbered_registers_except(RegSet(), restore_fpu);
 631   }
 632 
 633   // allocation
 634 
 635   // Object / value buffer allocation...
 636   // Allocate instance of klass, assumes klass initialized by caller
 637   // new_obj prefers to be rax
 638   // Kills t1 and t2, perserves klass, return allocation in new_obj (rsi on LP64)
 639   void allocate_instance(Register klass, Register new_obj,
 640                          Register t1, Register t2,
 641                          bool clear_fields, Label& alloc_failed);
 642 
 643   void tlab_allocate(
 644     Register thread,                   // Current thread
 645     Register obj,                      // result: pointer to object after successful allocation
 646     Register var_size_in_bytes,        // object size in bytes if unknown at compile time; invalid otherwise
 647     int      con_size_in_bytes,        // object size in bytes if   known at compile time
 648     Register t1,                       // temp register
 649     Register t2,                       // temp register
 650     Label&   slow_case                 // continuation point if fast allocation fails
 651   );
 652   void zero_memory(Register address, Register length_in_bytes, int offset_in_bytes, Register temp);
 653 
 654   // For field "index" within "klass", return inline_klass ...
 655   void get_inline_type_field_klass(Register klass, Register index, Register inline_klass);
 656 
 657   // interface method calling
 658   void lookup_interface_method(Register recv_klass,
 659                                Register intf_klass,
 660                                RegisterOrConstant itable_index,
 661                                Register method_result,
 662                                Register scan_temp,
 663                                Label& no_such_interface,
 664                                bool return_method = true);
 665 
 666   void lookup_interface_method_stub(Register recv_klass,
 667                                     Register holder_klass,
 668                                     Register resolved_klass,
 669                                     Register method_result,
 670                                     Register scan_temp,
 671                                     Register temp_reg2,
 672                                     Register receiver,
 673                                     int itable_index,
 674                                     Label& L_no_such_interface);
 675 
 676   // virtual method calling

 797   // Instructions that use AddressLiteral operands. These instruction can handle 32bit/64bit
 798   // operands. In general the names are modified to avoid hiding the instruction in Assembler
 799   // so that we don't need to implement all the varieties in the Assembler with trivial wrappers
 800   // here in MacroAssembler. The major exception to this rule is call
 801 
 802   // Arithmetics
 803 
 804 
 805   void addptr(Address dst, int32_t src) { LP64_ONLY(addq(dst, src)) NOT_LP64(addl(dst, src)) ; }
 806   void addptr(Address dst, Register src);
 807 
 808   void addptr(Register dst, Address src) { LP64_ONLY(addq(dst, src)) NOT_LP64(addl(dst, src)); }
 809   void addptr(Register dst, int32_t src);
 810   void addptr(Register dst, Register src);
 811   void addptr(Register dst, RegisterOrConstant src) {
 812     if (src.is_constant()) addptr(dst, checked_cast<int>(src.as_constant()));
 813     else                   addptr(dst, src.as_register());
 814   }
 815 
 816   void andptr(Register dst, int32_t src);
 817   void andptr(Register dst, Register src) { LP64_ONLY(andq(dst, src)) NOT_LP64(andl(dst, src)) ; }
 818   void andptr(Register dst, Address src) { LP64_ONLY(andq(dst, src)) NOT_LP64(andl(dst, src)) ; }
 819 
 820 #ifdef _LP64
 821   using Assembler::andq;
 822   void andq(Register dst, AddressLiteral src, Register rscratch = noreg);
 823 #endif
 824 
 825   void cmp8(AddressLiteral src1, int imm, Register rscratch = noreg);
 826 
 827   // renamed to drag out the casting of address to int32_t/intptr_t
 828   void cmp32(Register src1, int32_t imm);
 829 
 830   void cmp32(AddressLiteral src1, int32_t imm, Register rscratch = noreg);
 831   // compare reg - mem, or reg - &mem
 832   void cmp32(Register src1, AddressLiteral src2, Register rscratch = noreg);
 833 
 834   void cmp32(Register src1, Address src2);
 835 
 836 #ifndef _LP64
 837   void cmpklass(Address dst, Metadata* obj);
 838   void cmpklass(Register dst, Metadata* obj);

1923   void movdl(XMMRegister dst, AddressLiteral src, Register rscratch = noreg);
1924 
1925   using Assembler::movq;
1926   void movq(XMMRegister dst, AddressLiteral src, Register rscratch = noreg);
1927 
1928   // Can push value or effective address
1929   void pushptr(AddressLiteral src, Register rscratch);
1930 
1931   void pushptr(Address src) { LP64_ONLY(pushq(src)) NOT_LP64(pushl(src)); }
1932   void popptr(Address src) { LP64_ONLY(popq(src)) NOT_LP64(popl(src)); }
1933 
1934   void pushoop(jobject obj, Register rscratch);
1935   void pushklass(Metadata* obj, Register rscratch);
1936 
1937   // sign extend as need a l to ptr sized element
1938   void movl2ptr(Register dst, Address src) { LP64_ONLY(movslq(dst, src)) NOT_LP64(movl(dst, src)); }
1939   void movl2ptr(Register dst, Register src) { LP64_ONLY(movslq(dst, src)) NOT_LP64(if (dst != src) movl(dst, src)); }
1940 
1941 
1942  public:
1943   // Inline type specific methods
1944   #include "asm/macroAssembler_common.hpp"
1945 
1946   int store_inline_type_fields_to_buf(ciInlineKlass* vk, bool from_interpreter = true);
1947   bool move_helper(VMReg from, VMReg to, BasicType bt, RegState reg_state[]);
1948   bool unpack_inline_helper(const GrowableArray<SigEntry>* sig, int& sig_index,
1949                             VMReg from, int& from_index, VMRegPair* to, int to_count, int& to_index,
1950                             RegState reg_state[]);
1951   bool pack_inline_helper(const GrowableArray<SigEntry>* sig, int& sig_index, int vtarg_index,
1952                           VMRegPair* from, int from_count, int& from_index, VMReg to,
1953                           RegState reg_state[], Register val_array);
1954   int extend_stack_for_inline_args(int args_on_stack);
1955   void remove_frame(int initial_framesize, bool needs_stack_repair);
1956   VMReg spill_reg_for(VMReg reg);
1957 
1958   // clear memory of size 'cnt' qwords, starting at 'base';
1959   // if 'is_large' is set, do not try to produce short loop
1960   void clear_mem(Register base, Register cnt, Register val, XMMRegister xtmp, bool is_large, bool word_copy_only, KRegister mask=knoreg);
1961 
1962   // clear memory initialization sequence for constant size;
1963   void clear_mem(Register base, int cnt, Register rtmp, XMMRegister xtmp, KRegister mask=knoreg);
1964 
1965   // clear memory of size 'cnt' qwords, starting at 'base' using XMM/YMM registers
1966   void xmm_clear_mem(Register base, Register cnt, Register rtmp, XMMRegister xtmp, KRegister mask=knoreg);
1967 
1968   // Fill primitive arrays
1969   void generate_fill(BasicType t, bool aligned,
1970                      Register to, Register value, Register count,
1971                      Register rtmp, XMMRegister xtmp);
1972 
1973   void encode_iso_array(Register src, Register dst, Register len,
1974                         XMMRegister tmp1, XMMRegister tmp2, XMMRegister tmp3,
1975                         XMMRegister tmp4, Register tmp5, Register result, bool ascii);
1976 
1977 #ifdef _LP64
1978   void add2_with_carry(Register dest_hi, Register dest_lo, Register src1, Register src2);
1979   void multiply_64_x_64_loop(Register x, Register xstart, Register x_xstart,
1980                              Register y, Register y_idx, Register z,
< prev index next >