< prev index next >

src/cpu/x86/vm/assembler_x86.hpp

Print this page

        

@@ -2223,8 +2223,46 @@
   // Set embedded opmask register specifier.
   void set_embedded_opmask_register_specifier(KRegister mask) {
     _embedded_opmask_register_specifier = (*mask).encoding() & 0x7;
   }
 
+// This is shared between the interpreter and C1, and needs to be in multiple
+// places for each.  The code to invoke the actual sampling methods needs
+// to be provided by the user; thus, a macro.
+#define HEAP_MONITORING(ma, thread, var_size_in_bytes, con_size_in_bytes, object, t1, t2, sample_invocation) \
+do {                                                                \
+  {                                                                 \
+    SkipIfEqual skip_if(ma, HeapMonitoring::initialized_address() , 0);  \
+    Label skip_sample;                                              \
+    Register thr = thread;                                          \
+    if (!thr->is_valid()) {                                         \
+      NOT_LP64(assert(t1 != noreg,                                  \
+                      "Need temporary register for constants"));    \
+      thr = NOT_LP64(t1) LP64_ONLY(r15_thread);                     \
+      NOT_LP64(ma -> get_thread(thr);)                              \
+    }                                                               \
+    /* Trigger heap monitoring event */                             \
+    Address bus(thr,                                                \
+                JavaThread::bytes_until_sample_offset());           \
+                                                                    \
+    if (var_size_in_bytes->is_valid()) {                            \
+      ma -> NOT_LP64(subl) LP64_ONLY(subq)(bus, var_size_in_bytes); \
+    } else {                                                        \
+      int csib = (con_size_in_bytes);                               \
+      assert(t2 != noreg,                                           \
+             "Need temporary register for constants");              \
+      ma -> NOT_LP64(movl) LP64_ONLY(mov64)(t2, csib);              \
+      ma -> NOT_LP64(subl) LP64_ONLY(subq)(bus, t2);                \
+    }                                                               \
+                                                                    \
+    ma -> jcc(Assembler::positive, skip_sample);                    \
+                                                                    \
+    {                                                               \
+      sample_invocation                                             \
+    }                                                               \
+    ma -> bind(skip_sample);                                        \
+  }                                                                 \
+} while(0)
+
 };
 
 #endif // CPU_X86_VM_ASSEMBLER_X86_HPP
< prev index next >