< prev index next >

src/hotspot/cpu/x86/macroAssembler_x86.cpp

Print this page

        

@@ -51,10 +51,12 @@
 #include "crc32c.h"
 #ifdef COMPILER2
 #include "opto/intrinsicnode.hpp"
 #endif
 
+#include "runtime/continuation.hpp" // TODO LOOM remove after testing CONT_DOUBLE_NOP
+
 #ifdef PRODUCT
 #define BLOCK_COMMENT(str) /* nothing */
 #define STOP(error) stop(error)
 #else
 #define BLOCK_COMMENT(str) block_comment(str)

@@ -548,17 +550,19 @@
   jcc(Assembler::zero, L);
 
   subq(rsp, 8);
   {
     call(RuntimeAddress(entry_point));
+    oopmap_metadata(-1);
   }
   addq(rsp, 8);
   jmp(E);
 
   bind(L);
   {
     call(RuntimeAddress(entry_point));
+    oopmap_metadata(-1);
   }
 
   bind(E);
 
 #ifdef _WIN64

@@ -763,20 +767,21 @@
     pushq(Address(rscratch1, 0));
   }
 }
 
 void MacroAssembler::reset_last_Java_frame(bool clear_fp) {
+  mov64(rscratch1, NULL_WORD);
   // we must set sp to zero to clear frame
-  movptr(Address(r15_thread, JavaThread::last_Java_sp_offset()), NULL_WORD);
+  movptr(Address(r15_thread, JavaThread::last_Java_sp_offset()), rscratch1);
   // must clear fp, so that compiled frames are not confused; it is
   // possible that we need it only for debugging
   if (clear_fp) {
-    movptr(Address(r15_thread, JavaThread::last_Java_fp_offset()), NULL_WORD);
+    movptr(Address(r15_thread, JavaThread::last_Java_fp_offset()), rscratch1);
   }
 
   // Always clear the pc because it could have been set by make_walkable()
-  movptr(Address(r15_thread, JavaThread::last_Java_pc_offset()), NULL_WORD);
+  movptr(Address(r15_thread, JavaThread::last_Java_pc_offset()), rscratch1);
   vzeroupper();
 }
 
 void MacroAssembler::set_last_Java_frame(Register last_java_sp,
                                          Register last_java_fp,

@@ -953,10 +958,15 @@
 
 #endif // _LP64
 
 // Now versions that are common to 32/64 bit
 
+void MacroAssembler::oopmap_metadata(int index) {
+  // if (index != -1) tty->print_cr("oopmap_metadata %d", index);
+  // mov64(r10, 1234); // TODO: Add a new relocInfo with external semantics. see relocInfo::metadata_type
+}
+
 void MacroAssembler::addptr(Register dst, int32_t imm32) {
   LP64_ONLY(addq(dst, imm32)) NOT_LP64(addl(dst, imm32));
 }
 
 void MacroAssembler::addptr(Register dst, Register src) {

@@ -1002,10 +1012,30 @@
   if (target % modulus != 0) {
     nop(modulus - (target % modulus));
   }
 }
 
+void MacroAssembler::push_f(XMMRegister r) {
+  subptr(rsp, wordSize);
+  movflt(Address(rsp, 0), r);
+}
+
+void MacroAssembler::pop_f(XMMRegister r) {
+  movflt(r, Address(rsp, 0));
+  addptr(rsp, wordSize);
+}
+
+void MacroAssembler::push_d(XMMRegister r) {
+  subptr(rsp, 2 * wordSize);
+  movdbl(Address(rsp, 0), r);
+}
+
+void MacroAssembler::pop_d(XMMRegister r) {
+  movdbl(r, Address(rsp, 0));
+  addptr(rsp, 2 * Interpreter::stackElementSize);
+}
+
 void MacroAssembler::andpd(XMMRegister dst, AddressLiteral src, Register scratch_reg) {
   // Used in sign-masking with aligned address.
   assert((UseAVX > 0) || (((intptr_t)src.target() & 15) == 0), "SSE mode requires address alignment 16 bytes");
   if (reachable(src)) {
     Assembler::andpd(dst, as_Address(src));

@@ -2758,20 +2788,35 @@
 void MacroAssembler::enter() {
   push(rbp);
   mov(rbp, rsp);
 }
 
+void MacroAssembler::post_call_nop() {
+  emit_int8((int8_t)0x0f);
+  emit_int8((int8_t)0x1f);
+  emit_int8((int8_t)0x84);
+  emit_int8((int8_t)0x00);
+  emit_int32(0x00);
+#ifdef CONT_DOUBLE_NOP
+  emit_int8((int8_t)0x0f);
+  emit_int8((int8_t)0x1f);
+  emit_int8((int8_t)0x84);
+  emit_int8((int8_t)0x00);
+  emit_int32(0x00);
+#endif
+}
+
 // A 5 byte nop that is safe for patching (see patch_verified_entry)
 void MacroAssembler::fat_nop() {
   if (UseAddressNop) {
     addr_nop_5();
   } else {
-    emit_int8(0x26); // es:
-    emit_int8(0x2e); // cs:
-    emit_int8(0x64); // fs:
-    emit_int8(0x65); // gs:
-    emit_int8((unsigned char)0x90);
+    emit_int8((int8_t)0x26); // es:
+    emit_int8((int8_t)0x2e); // cs:
+    emit_int8((int8_t)0x64); // fs:
+    emit_int8((int8_t)0x65); // gs:
+    emit_int8((int8_t)0x90);
   }
 }
 
 void MacroAssembler::fcmp(Register tmp) {
   fcmp(tmp, 1, true, true);

@@ -3453,10 +3498,33 @@
   fxrstor(Address(rsp, 0));
 #endif
   addptr(rsp, FPUStateSizeInWords * wordSize);
 }
 
+void MacroAssembler::get_cont_fastpath(Register java_thread, Register dst) {
+  movl(dst, Address(java_thread, JavaThread::cont_fastpath_offset()));
+}
+
+void MacroAssembler::set_cont_fastpath(Register java_thread, int32_t imm) {
+  movl(Address(java_thread, JavaThread::cont_fastpath_offset()), imm);
+}
+
+#ifdef ASSERT
+void MacroAssembler::stop_if_in_cont(Register cont, const char* name) {
+#ifdef _LP64
+  Label no_cont;
+  movptr(cont, Address(r15_thread, in_bytes(JavaThread::continuation_offset())));
+  testl(cont, cont);
+  jcc(Assembler::zero, no_cont);
+  stop(name);
+  bind(no_cont);
+#else
+  Unimplemented();
+#endif
+}
+#endif
+
 void MacroAssembler::pop_IU_state() {
   popa();
   LP64_ONLY(addq(rsp, 8));
   popf();
 }
< prev index next >