< prev index next >

src/hotspot/cpu/x86/macroAssembler_x86.hpp

Print this page

  62   // If no java_thread register is specified (noreg) than rdi will be used instead. call_VM_base
  63   // returns the register which contains the thread upon return. If a thread register has been
  64   // specified, the return value will correspond to that register. If no last_java_sp is specified
  65   // (noreg) than rsp will be used instead.
  66   virtual void call_VM_base(           // returns the register containing the thread upon return
  67     Register oop_result,               // where an oop-result ends up if any; use noreg otherwise
  68     Register java_thread,              // the thread if computed before     ; use noreg otherwise
  69     Register last_java_sp,             // to set up last_Java_frame in stubs; use noreg otherwise
  70     address  entry_point,              // the entry point
  71     int      number_of_arguments,      // the number of arguments (w/o thread) to pop after the call
  72     bool     check_exceptions          // whether to check for pending exceptions after return
  73   );
  74 
  75   void call_VM_helper(Register oop_result, address entry_point, int number_of_arguments, bool check_exceptions = true);
  76 
  77   // helpers for FPU flag access
  78   // tmp is a temporary register, if none is available use noreg
  79   void save_rax   (Register tmp);
  80   void restore_rax(Register tmp);
  81 






















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

 331   void resolve_global_jobject(Register value, Register thread, Register tmp);
 332 
 333   // C 'boolean' to Java boolean: x == 0 ? 0 : 1
 334   void c2bool(Register x);
 335 
 336   // C++ bool manipulation
 337 
 338   void movbool(Register dst, Address src);
 339   void movbool(Address dst, bool boolconst);
 340   void movbool(Address dst, Register src);
 341   void testbool(Register dst);
 342 
 343   void resolve_oop_handle(Register result, Register tmp);
 344   void resolve_weak_handle(Register result, Register tmp);
 345   void load_mirror(Register mirror, Register method, Register tmp);
 346   void load_method_holder_cld(Register rresult, Register rmethod);
 347 
 348   void load_method_holder(Register holder, Register method);
 349 
 350   // oop manipulations



 351   void load_klass(Register dst, Register src, Register tmp);
 352   void load_klass_check_null(Register dst, Register src, Register tmp);
 353   void store_klass(Register dst, Register src, Register tmp);
 354 








 355   void access_load_at(BasicType type, DecoratorSet decorators, Register dst, Address src,
 356                       Register tmp1, Register thread_tmp);
 357   void access_store_at(BasicType type, DecoratorSet decorators, Address dst, Register val,
 358                        Register tmp1, Register tmp2, Register tmp3);
 359 
 360   void load_heap_oop(Register dst, Address src, Register tmp1 = noreg,
 361                      Register thread_tmp = noreg, DecoratorSet decorators = 0);
 362   void load_heap_oop_not_null(Register dst, Address src, Register tmp1 = noreg,
 363                               Register thread_tmp = noreg, DecoratorSet decorators = 0);
 364   void store_heap_oop(Address dst, Register val, Register tmp1 = noreg,
 365                       Register tmp2 = noreg, Register tmp3 = noreg, DecoratorSet decorators = 0);
 366 
 367   // Used for storing NULL. All other oop constants should be
 368   // stored using routines that take a jobject.
 369   void store_heap_oop_null(Address dst);
 370 
 371 #ifdef _LP64
 372   void store_klass_gap(Register dst, Register src);
 373 
 374   // This dummy is to prevent a call to store_heap_oop from

1978   void convert_f2i(Register dst, XMMRegister src);
1979   void convert_d2i(Register dst, XMMRegister src);
1980   void convert_f2l(Register dst, XMMRegister src);
1981   void convert_d2l(Register dst, XMMRegister src);
1982   void round_double(Register dst, XMMRegister src, Register rtmp, Register rcx);
1983   void round_float(Register dst, XMMRegister src, Register rtmp, Register rcx);
1984 
1985   void cache_wb(Address line);
1986   void cache_wbsync(bool is_pre);
1987 
1988 #ifdef COMPILER2_OR_JVMCI
1989   void generate_fill_avx3(BasicType type, Register to, Register value,
1990                           Register count, Register rtmp, XMMRegister xtmp);
1991 #endif // COMPILER2_OR_JVMCI
1992 #endif // _LP64
1993 
1994   void vallones(XMMRegister dst, int vector_len);
1995 
1996   void check_stack_alignment(Register sp, const char* msg, unsigned bias = 0, Register tmp = noreg);
1997 


1998 };
1999 
2000 /**
2001  * class SkipIfEqual:
2002  *
2003  * Instantiating this class will result in assembly code being output that will
2004  * jump around any code emitted between the creation of the instance and it's
2005  * automatic destruction at the end of a scope block, depending on the value of
2006  * the flag passed to the constructor, which will be checked at run-time.
2007  */
2008 class SkipIfEqual {
2009  private:
2010   MacroAssembler* _masm;
2011   Label _label;
2012 
2013  public:
2014    SkipIfEqual(MacroAssembler*, const bool* flag_addr, bool value, Register rscratch);
2015    ~SkipIfEqual();
2016 };
2017 

  62   // If no java_thread register is specified (noreg) than rdi will be used instead. call_VM_base
  63   // returns the register which contains the thread upon return. If a thread register has been
  64   // specified, the return value will correspond to that register. If no last_java_sp is specified
  65   // (noreg) than rsp will be used instead.
  66   virtual void call_VM_base(           // returns the register containing the thread upon return
  67     Register oop_result,               // where an oop-result ends up if any; use noreg otherwise
  68     Register java_thread,              // the thread if computed before     ; use noreg otherwise
  69     Register last_java_sp,             // to set up last_Java_frame in stubs; use noreg otherwise
  70     address  entry_point,              // the entry point
  71     int      number_of_arguments,      // the number of arguments (w/o thread) to pop after the call
  72     bool     check_exceptions          // whether to check for pending exceptions after return
  73   );
  74 
  75   void call_VM_helper(Register oop_result, address entry_point, int number_of_arguments, bool check_exceptions = true);
  76 
  77   // helpers for FPU flag access
  78   // tmp is a temporary register, if none is available use noreg
  79   void save_rax   (Register tmp);
  80   void restore_rax(Register tmp);
  81 
  82  public:
  83 
  84   enum KlassDecodeMode {
  85     KlassDecodeNone,
  86     KlassDecodeZero,
  87     KlassDecodeXor,
  88     KlassDecodeAdd
  89   };
  90 
  91   // Return the current narrow Klass pointer decode mode. Initialized on first call.
  92   static KlassDecodeMode klass_decode_mode();
  93 
  94   // Given an arbitrary base address, return the KlassDecodeMode that would be used. Return KlassDecodeNone
  95   // if base address is not valid for encoding.
  96   static KlassDecodeMode klass_decode_mode_for_base(address base);
  97 
  98   // Returns a static string
  99   static const char* describe_klass_decode_mode(KlassDecodeMode mode);
 100 
 101  private:
 102   static KlassDecodeMode _klass_decode_mode;
 103 
 104  public:
 105   MacroAssembler(CodeBuffer* code) : Assembler(code) {}
 106 
 107  // These routines should emit JVMTI PopFrame and ForceEarlyReturn handling code.
 108  // The implementation is only non-empty for the InterpreterMacroAssembler,
 109  // as only the interpreter handles PopFrame and ForceEarlyReturn requests.
 110  virtual void check_and_handle_popframe(Register java_thread);
 111  virtual void check_and_handle_earlyret(Register java_thread);
 112 
 113   Address as_Address(AddressLiteral adr);
 114   Address as_Address(ArrayAddress adr, Register rscratch);
 115 
 116   // Support for NULL-checks
 117   //
 118   // Generates code that causes a NULL OS exception if the content of reg is NULL.
 119   // If the accessed location is M[reg + offset] and the offset is known, provide the
 120   // offset. No explicit code generation is needed if the offset is within a certain
 121   // range (0 <= offset <= page_size).
 122 
 123   void null_check(Register reg, int offset = -1);

 353   void resolve_global_jobject(Register value, Register thread, Register tmp);
 354 
 355   // C 'boolean' to Java boolean: x == 0 ? 0 : 1
 356   void c2bool(Register x);
 357 
 358   // C++ bool manipulation
 359 
 360   void movbool(Register dst, Address src);
 361   void movbool(Address dst, bool boolconst);
 362   void movbool(Address dst, Register src);
 363   void testbool(Register dst);
 364 
 365   void resolve_oop_handle(Register result, Register tmp);
 366   void resolve_weak_handle(Register result, Register tmp);
 367   void load_mirror(Register mirror, Register method, Register tmp);
 368   void load_method_holder_cld(Register rresult, Register rmethod);
 369 
 370   void load_method_holder(Register holder, Register method);
 371 
 372   // oop manipulations
 373 #ifdef _LP64
 374   void load_nklass(Register dst, Register src);
 375 #endif
 376   void load_klass(Register dst, Register src, Register tmp);
 377   void load_klass_check_null(Register dst, Register src, Register tmp);
 378   void store_klass(Register dst, Register src, Register tmp);
 379 
 380   // Compares the Klass pointer of an object to a given Klass (which might be narrow,
 381   // depending on UseCompressedClassPointers).
 382   void cmp_klass(Register klass, Register dst, Register tmp);
 383 
 384   // Compares the Klass pointer of two objects o1 and o2. Result is in the condition flags.
 385   // Uses t1 and t2 as temporary registers.
 386   void cmp_klass(Register src, Register dst, Register tmp1, Register tmp2);
 387 
 388   void access_load_at(BasicType type, DecoratorSet decorators, Register dst, Address src,
 389                       Register tmp1, Register thread_tmp);
 390   void access_store_at(BasicType type, DecoratorSet decorators, Address dst, Register val,
 391                        Register tmp1, Register tmp2, Register tmp3);
 392 
 393   void load_heap_oop(Register dst, Address src, Register tmp1 = noreg,
 394                      Register thread_tmp = noreg, DecoratorSet decorators = 0);
 395   void load_heap_oop_not_null(Register dst, Address src, Register tmp1 = noreg,
 396                               Register thread_tmp = noreg, DecoratorSet decorators = 0);
 397   void store_heap_oop(Address dst, Register val, Register tmp1 = noreg,
 398                       Register tmp2 = noreg, Register tmp3 = noreg, DecoratorSet decorators = 0);
 399 
 400   // Used for storing NULL. All other oop constants should be
 401   // stored using routines that take a jobject.
 402   void store_heap_oop_null(Address dst);
 403 
 404 #ifdef _LP64
 405   void store_klass_gap(Register dst, Register src);
 406 
 407   // This dummy is to prevent a call to store_heap_oop from

2011   void convert_f2i(Register dst, XMMRegister src);
2012   void convert_d2i(Register dst, XMMRegister src);
2013   void convert_f2l(Register dst, XMMRegister src);
2014   void convert_d2l(Register dst, XMMRegister src);
2015   void round_double(Register dst, XMMRegister src, Register rtmp, Register rcx);
2016   void round_float(Register dst, XMMRegister src, Register rtmp, Register rcx);
2017 
2018   void cache_wb(Address line);
2019   void cache_wbsync(bool is_pre);
2020 
2021 #ifdef COMPILER2_OR_JVMCI
2022   void generate_fill_avx3(BasicType type, Register to, Register value,
2023                           Register count, Register rtmp, XMMRegister xtmp);
2024 #endif // COMPILER2_OR_JVMCI
2025 #endif // _LP64
2026 
2027   void vallones(XMMRegister dst, int vector_len);
2028 
2029   void check_stack_alignment(Register sp, const char* msg, unsigned bias = 0, Register tmp = noreg);
2030 
2031   void fast_lock_impl(Register obj, Register hdr, Register thread, Register tmp, Label& slow, bool rt_check_stack = true);
2032   void fast_unlock_impl(Register obj, Register hdr, Register tmp, Label& slow);
2033 };
2034 
2035 /**
2036  * class SkipIfEqual:
2037  *
2038  * Instantiating this class will result in assembly code being output that will
2039  * jump around any code emitted between the creation of the instance and it's
2040  * automatic destruction at the end of a scope block, depending on the value of
2041  * the flag passed to the constructor, which will be checked at run-time.
2042  */
2043 class SkipIfEqual {
2044  private:
2045   MacroAssembler* _masm;
2046   Label _label;
2047 
2048  public:
2049    SkipIfEqual(MacroAssembler*, const bool* flag_addr, bool value, Register rscratch);
2050    ~SkipIfEqual();
2051 };
2052 
< prev index next >