31 32 // MacroAssembler extends Assembler by frequently used macros. 33 // 34 // Instructions for which a 'better' code sequence exists depending 35 // on arguments should also go in here. 36 37 class MacroAssembler: public Assembler { 38 friend class LIR_Assembler; 39 friend class Runtime1; // as_Address() 40 41 protected: 42 43 Address as_Address(AddressLiteral adr); 44 Address as_Address(ArrayAddress adr); 45 46 // Support for VM calls 47 // 48 // This is the base routine called by the different versions of call_VM_leaf. The interpreter 49 // may customize this version by overriding it for its purposes (e.g., to save/restore 50 // additional registers when doing a VM call). 51 #ifdef CC_INTERP 52 // c++ interpreter never wants to use interp_masm version of call_VM 53 #define VIRTUAL 54 #else 55 #define VIRTUAL virtual 56 #endif 57 58 #define COMMA , 59 60 VIRTUAL void call_VM_leaf_base( 61 address entry_point, // the entry point 62 int number_of_arguments // the number of arguments to pop after the call 63 ); 64 65 // This is the base routine called by the different versions of call_VM. The interpreter 66 // may customize this version by overriding it for its purposes (e.g., to save/restore 67 // additional registers when doing a VM call). 68 // 69 // If no java_thread register is specified (noreg) than rdi will be used instead. call_VM_base 70 // returns the register which contains the thread upon return. If a thread register has been 71 // specified, the return value will correspond to that register. If no last_java_sp is specified 72 // (noreg) than rsp will be used instead. 73 VIRTUAL void call_VM_base( // returns the register containing the thread upon return 74 Register oop_result, // where an oop-result ends up if any; use noreg otherwise 75 Register java_thread, // the thread if computed before ; use noreg otherwise 76 Register last_java_sp, // to set up last_Java_frame in stubs; use noreg otherwise 77 address entry_point, // the entry point 78 int number_of_arguments, // the number of arguments (w/o thread) to pop after the call 79 bool check_exceptions // whether to check for pending exceptions after return 80 ); 81 82 // These routines should emit JVMTI PopFrame and ForceEarlyReturn handling code. 83 // The implementation is only non-empty for the InterpreterMacroAssembler, 84 // as only the interpreter handles PopFrame and ForceEarlyReturn requests. 85 virtual void check_and_handle_popframe(Register java_thread); 86 virtual void check_and_handle_earlyret(Register java_thread); 87 88 void call_VM_helper(Register oop_result, address entry_point, int number_of_arguments, bool check_exceptions = true); 89 90 // helpers for FPU flag access 91 // tmp is a temporary register, if none is available use noreg 92 void save_rax (Register tmp); 93 void restore_rax(Register tmp); 1404 void crc32c_ipl_alg2_alt2(Register in_out, Register in1, Register in2, 1405 Register tmp1, Register tmp2, Register tmp3, 1406 Register tmp4, Register tmp5, Register tmp6, 1407 XMMRegister w_xtmp1, XMMRegister w_xtmp2, XMMRegister w_xtmp3, 1408 bool is_pclmulqdq_supported); 1409 // Fold 128-bit data chunk 1410 void fold_128bit_crc32(XMMRegister xcrc, XMMRegister xK, XMMRegister xtmp, Register buf, int offset); 1411 void fold_128bit_crc32(XMMRegister xcrc, XMMRegister xK, XMMRegister xtmp, XMMRegister xbuf); 1412 // Fold 8-bit data 1413 void fold_8bit_crc32(Register crc, Register table, Register tmp); 1414 void fold_8bit_crc32(XMMRegister crc, Register table, XMMRegister xtmp, Register tmp); 1415 1416 // Compress char[] array to byte[]. 1417 void char_array_compress(Register src, Register dst, Register len, 1418 XMMRegister tmp1, XMMRegister tmp2, XMMRegister tmp3, 1419 XMMRegister tmp4, Register tmp5, Register result); 1420 1421 // Inflate byte[] array to char[]. 1422 void byte_array_inflate(Register src, Register dst, Register len, 1423 XMMRegister tmp1, Register tmp2); 1424 1425 #undef VIRTUAL 1426 1427 }; 1428 1429 /** 1430 * class SkipIfEqual: 1431 * 1432 * Instantiating this class will result in assembly code being output that will 1433 * jump around any code emitted between the creation of the instance and it's 1434 * automatic destruction at the end of a scope block, depending on the value of 1435 * the flag passed to the constructor, which will be checked at run-time. 1436 */ 1437 class SkipIfEqual { 1438 private: 1439 MacroAssembler* _masm; 1440 Label _label; 1441 1442 public: 1443 SkipIfEqual(MacroAssembler*, const bool* flag_addr, bool value); 1444 ~SkipIfEqual(); 1445 }; | 31 32 // MacroAssembler extends Assembler by frequently used macros. 33 // 34 // Instructions for which a 'better' code sequence exists depending 35 // on arguments should also go in here. 36 37 class MacroAssembler: public Assembler { 38 friend class LIR_Assembler; 39 friend class Runtime1; // as_Address() 40 41 protected: 42 43 Address as_Address(AddressLiteral adr); 44 Address as_Address(ArrayAddress adr); 45 46 // Support for VM calls 47 // 48 // This is the base routine called by the different versions of call_VM_leaf. The interpreter 49 // may customize this version by overriding it for its purposes (e.g., to save/restore 50 // additional registers when doing a VM call). 51 #define COMMA , 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 ); 57 58 // This is the base routine called by the different versions of call_VM. The interpreter 59 // may customize this version by overriding it for its purposes (e.g., to save/restore 60 // additional registers when doing a VM call). 61 // 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 // These routines should emit JVMTI PopFrame and ForceEarlyReturn handling code. 76 // The implementation is only non-empty for the InterpreterMacroAssembler, 77 // as only the interpreter handles PopFrame and ForceEarlyReturn requests. 78 virtual void check_and_handle_popframe(Register java_thread); 79 virtual void check_and_handle_earlyret(Register java_thread); 80 81 void call_VM_helper(Register oop_result, address entry_point, int number_of_arguments, bool check_exceptions = true); 82 83 // helpers for FPU flag access 84 // tmp is a temporary register, if none is available use noreg 85 void save_rax (Register tmp); 86 void restore_rax(Register tmp); 1397 void crc32c_ipl_alg2_alt2(Register in_out, Register in1, Register in2, 1398 Register tmp1, Register tmp2, Register tmp3, 1399 Register tmp4, Register tmp5, Register tmp6, 1400 XMMRegister w_xtmp1, XMMRegister w_xtmp2, XMMRegister w_xtmp3, 1401 bool is_pclmulqdq_supported); 1402 // Fold 128-bit data chunk 1403 void fold_128bit_crc32(XMMRegister xcrc, XMMRegister xK, XMMRegister xtmp, Register buf, int offset); 1404 void fold_128bit_crc32(XMMRegister xcrc, XMMRegister xK, XMMRegister xtmp, XMMRegister xbuf); 1405 // Fold 8-bit data 1406 void fold_8bit_crc32(Register crc, Register table, Register tmp); 1407 void fold_8bit_crc32(XMMRegister crc, Register table, XMMRegister xtmp, Register tmp); 1408 1409 // Compress char[] array to byte[]. 1410 void char_array_compress(Register src, Register dst, Register len, 1411 XMMRegister tmp1, XMMRegister tmp2, XMMRegister tmp3, 1412 XMMRegister tmp4, Register tmp5, Register result); 1413 1414 // Inflate byte[] array to char[]. 1415 void byte_array_inflate(Register src, Register dst, Register len, 1416 XMMRegister tmp1, Register tmp2); 1417 1418 }; 1419 1420 /** 1421 * class SkipIfEqual: 1422 * 1423 * Instantiating this class will result in assembly code being output that will 1424 * jump around any code emitted between the creation of the instance and it's 1425 * automatic destruction at the end of a scope block, depending on the value of 1426 * the flag passed to the constructor, which will be checked at run-time. 1427 */ 1428 class SkipIfEqual { 1429 private: 1430 MacroAssembler* _masm; 1431 Label _label; 1432 1433 public: 1434 SkipIfEqual(MacroAssembler*, const bool* flag_addr, bool value); 1435 ~SkipIfEqual(); 1436 }; |