< prev index next >
src/hotspot/share/runtime/vmThread.hpp
Print this page
rev 52955 : 8181143: Introduce diagnostic flag to abort VM on too long VM operations
Reviewed-by: XXX
@@ -25,10 +25,11 @@
#ifndef SHARE_VM_RUNTIME_VMTHREAD_HPP
#define SHARE_VM_RUNTIME_VMTHREAD_HPP
#include "runtime/perfData.hpp"
#include "runtime/thread.hpp"
+#include "runtime/task.hpp"
#include "runtime/vmOperations.hpp"
//
// Prioritized queue of VM operations.
//
@@ -82,10 +83,30 @@
void verify_queue(int prio) PRODUCT_RETURN;
};
+// VM operation timeout handling: warn or abort the VM when VM operation takes
+// too long. Periodic tasks do not participate in safepoint protocol, and therefore
+// can fire when application threads are stopped.
+
+class VMOperationTimeoutTask : public PeriodicTask {
+private:
+ volatile int _armed;
+ jlong _arm_time;
+
+public:
+ VMOperationTimeoutTask(size_t interval_time) :
+ PeriodicTask(interval_time), _armed(0), _arm_time(0) {}
+
+ virtual void task();
+
+ bool is_armed();
+ void arm();
+ void disarm();
+};
+
//
// A single VMThread (the primordial thread) spawns all other threads
// and is itself used by other threads to offload heavy vm operations
// like scavenge, garbage_collect etc.
//
@@ -99,10 +120,12 @@
static Monitor * _terminate_lock;
static PerfCounter* _perf_accumulated_vm_operation_time;
static const char* _no_op_reason;
+ static VMOperationTimeoutTask* _timeout_task;
+
static bool no_op_safepoint_needed(bool check_time);
void evaluate_operation(VM_Operation* op);
public:
< prev index next >