< 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);
  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);

 323   void resolve_jobject(Register value, Register thread, Register tmp);
 324 
 325   // C 'boolean' to Java boolean: x == 0 ? 0 : 1
 326   void c2bool(Register x);
 327 
 328   // C++ bool manipulation
 329 
 330   void movbool(Register dst, Address src);
 331   void movbool(Address dst, bool boolconst);
 332   void movbool(Address dst, Register src);
 333   void testbool(Register dst);
 334 
 335   void resolve_oop_handle(Register result, Register tmp = rscratch2);
 336   void resolve_weak_handle(Register result, Register tmp);
 337   void load_mirror(Register mirror, Register method, Register tmp = rscratch2);
 338   void load_method_holder_cld(Register rresult, Register rmethod);
 339 
 340   void load_method_holder(Register holder, Register method);
 341 
 342   // oop manipulations
 343   void load_klass(Register dst, Register src, Register tmp);
 344   void store_klass(Register dst, Register src, Register tmp);




 345 
 346   void access_load_at(BasicType type, DecoratorSet decorators, Register dst, Address src,
 347                       Register tmp1, Register thread_tmp);
 348   void access_store_at(BasicType type, DecoratorSet decorators, Address dst, Register src,
 349                        Register tmp1, Register tmp2, Register tmp3);
 350 
 351   void load_heap_oop(Register dst, Address src, Register tmp1 = noreg,
 352                      Register thread_tmp = noreg, DecoratorSet decorators = 0);
 353   void load_heap_oop_not_null(Register dst, Address src, Register tmp1 = noreg,
 354                               Register thread_tmp = noreg, DecoratorSet decorators = 0);
 355   void store_heap_oop(Address dst, Register src, Register tmp1 = noreg,
 356                       Register tmp2 = noreg, Register tmp3 = noreg, DecoratorSet decorators = 0);
 357 
 358   // Used for storing NULL. All other oop constants should be
 359   // stored using routines that take a jobject.
 360   void store_heap_oop_null(Address dst);
 361 
 362 #ifdef _LP64
 363   void store_klass_gap(Register dst, Register src);
 364 
 365   // This dummy is to prevent a call to store_heap_oop from
 366   // converting a zero (like NULL) into a Register by giving
 367   // the compiler two choices it can't resolve
 368 
 369   void store_heap_oop(Address dst, void* dummy);
 370 
 371   void encode_heap_oop(Register r);
 372   void decode_heap_oop(Register r);
 373   void encode_heap_oop_not_null(Register r);
 374   void decode_heap_oop_not_null(Register r);
 375   void encode_heap_oop_not_null(Register dst, Register src);
 376   void decode_heap_oop_not_null(Register dst, Register src);
 377 
 378   void set_narrow_oop(Register dst, jobject obj);
 379   void set_narrow_oop(Address dst, jobject obj);
 380   void cmp_narrow_oop(Register dst, jobject obj);
 381   void cmp_narrow_oop(Address dst, jobject obj);
 382 
 383   void encode_klass_not_null(Register r, Register tmp);
 384   void decode_klass_not_null(Register r, Register tmp);

  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 
 103   static KlassDecodeMode _klass_decode_mode;
 104 
 105  public:
 106   MacroAssembler(CodeBuffer* code) : Assembler(code) {}
 107 
 108  // These routines should emit JVMTI PopFrame and ForceEarlyReturn handling code.
 109  // The implementation is only non-empty for the InterpreterMacroAssembler,
 110  // as only the interpreter handles PopFrame and ForceEarlyReturn requests.
 111  virtual void check_and_handle_popframe(Register java_thread);
 112  virtual void check_and_handle_earlyret(Register java_thread);
 113 
 114   Address as_Address(AddressLiteral adr);
 115   Address as_Address(ArrayAddress adr);
 116 
 117   // Support for NULL-checks
 118   //
 119   // Generates code that causes a NULL OS exception if the content of reg is NULL.
 120   // If the accessed location is M[reg + offset] and the offset is known, provide the
 121   // offset. No explicit code generation is needed if the offset is within a certain
 122   // range (0 <= offset <= page_size).
 123 
 124   void null_check(Register reg, int offset = -1);

 346   void resolve_jobject(Register value, Register thread, Register tmp);
 347 
 348   // C 'boolean' to Java boolean: x == 0 ? 0 : 1
 349   void c2bool(Register x);
 350 
 351   // C++ bool manipulation
 352 
 353   void movbool(Register dst, Address src);
 354   void movbool(Address dst, bool boolconst);
 355   void movbool(Address dst, Register src);
 356   void testbool(Register dst);
 357 
 358   void resolve_oop_handle(Register result, Register tmp = rscratch2);
 359   void resolve_weak_handle(Register result, Register tmp);
 360   void load_mirror(Register mirror, Register method, Register tmp = rscratch2);
 361   void load_method_holder_cld(Register rresult, Register rmethod);
 362 
 363   void load_method_holder(Register holder, Register method);
 364 
 365   // oop manipulations
 366   void load_klass(Register dst, Register src, Register tmp, bool null_check_src = false);
 367 #ifdef _LP64
 368   void load_nklass(Register dst, Register src);
 369 #else
 370   void store_klass(Register dst, Register src);
 371 #endif
 372 
 373   void access_load_at(BasicType type, DecoratorSet decorators, Register dst, Address src,
 374                       Register tmp1, Register thread_tmp);
 375   void access_store_at(BasicType type, DecoratorSet decorators, Address dst, Register src,
 376                        Register tmp1, Register tmp2, Register tmp3);
 377 
 378   void load_heap_oop(Register dst, Address src, Register tmp1 = noreg,
 379                      Register thread_tmp = noreg, DecoratorSet decorators = 0);
 380   void load_heap_oop_not_null(Register dst, Address src, Register tmp1 = noreg,
 381                               Register thread_tmp = noreg, DecoratorSet decorators = 0);
 382   void store_heap_oop(Address dst, Register src, Register tmp1 = noreg,
 383                       Register tmp2 = noreg, Register tmp3 = noreg, DecoratorSet decorators = 0);
 384 
 385   // Used for storing NULL. All other oop constants should be
 386   // stored using routines that take a jobject.
 387   void store_heap_oop_null(Address dst);
 388 
 389 #ifdef _LP64


 390   // This dummy is to prevent a call to store_heap_oop from
 391   // converting a zero (like NULL) into a Register by giving
 392   // the compiler two choices it can't resolve
 393 
 394   void store_heap_oop(Address dst, void* dummy);
 395 
 396   void encode_heap_oop(Register r);
 397   void decode_heap_oop(Register r);
 398   void encode_heap_oop_not_null(Register r);
 399   void decode_heap_oop_not_null(Register r);
 400   void encode_heap_oop_not_null(Register dst, Register src);
 401   void decode_heap_oop_not_null(Register dst, Register src);
 402 
 403   void set_narrow_oop(Register dst, jobject obj);
 404   void set_narrow_oop(Address dst, jobject obj);
 405   void cmp_narrow_oop(Register dst, jobject obj);
 406   void cmp_narrow_oop(Address dst, jobject obj);
 407 
 408   void encode_klass_not_null(Register r, Register tmp);
 409   void decode_klass_not_null(Register r, Register tmp);
< prev index next >