479 |
479 |
480 JvmtiDeferredEvent() : _type(TYPE_NONE) {} |
480 JvmtiDeferredEvent() : _type(TYPE_NONE) {} |
481 |
481 |
482 // Factory methods |
482 // Factory methods |
483 static JvmtiDeferredEvent compiled_method_load_event(nmethod* nm) |
483 static JvmtiDeferredEvent compiled_method_load_event(nmethod* nm) |
484 KERNEL_RETURN_(JvmtiDeferredEvent()); |
484 NOT_JVMTI_RETURN_(JvmtiDeferredEvent()); |
485 static JvmtiDeferredEvent compiled_method_unload_event(nmethod* nm, |
485 static JvmtiDeferredEvent compiled_method_unload_event(nmethod* nm, |
486 jmethodID id, const void* code) KERNEL_RETURN_(JvmtiDeferredEvent()); |
486 jmethodID id, const void* code) NOT_JVMTI_RETURN_(JvmtiDeferredEvent()); |
487 static JvmtiDeferredEvent dynamic_code_generated_event( |
487 static JvmtiDeferredEvent dynamic_code_generated_event( |
488 const char* name, const void* begin, const void* end) |
488 const char* name, const void* begin, const void* end) |
489 KERNEL_RETURN_(JvmtiDeferredEvent()); |
489 NOT_JVMTI_RETURN_(JvmtiDeferredEvent()); |
490 |
490 |
491 // Actually posts the event. |
491 // Actually posts the event. |
492 void post() KERNEL_RETURN; |
492 void post() NOT_JVMTI_RETURN; |
493 }; |
493 }; |
494 |
494 |
495 /** |
495 /** |
496 * Events enqueued on this queue wake up the Service thread which dequeues |
496 * Events enqueued on this queue wake up the Service thread which dequeues |
497 * and posts the events. The Service_lock is required to be held |
497 * and posts the events. The Service_lock is required to be held |
518 static QueueNode* _queue_head; // Hold Service_lock to access |
518 static QueueNode* _queue_head; // Hold Service_lock to access |
519 static QueueNode* _queue_tail; // Hold Service_lock to access |
519 static QueueNode* _queue_tail; // Hold Service_lock to access |
520 static volatile QueueNode* _pending_list; // Uses CAS for read/update |
520 static volatile QueueNode* _pending_list; // Uses CAS for read/update |
521 |
521 |
522 // Transfers events from the _pending_list to the _queue. |
522 // Transfers events from the _pending_list to the _queue. |
523 static void process_pending_events() KERNEL_RETURN; |
523 static void process_pending_events() NOT_JVMTI_RETURN; |
524 |
524 |
525 public: |
525 public: |
526 // Must be holding Service_lock when calling these |
526 // Must be holding Service_lock when calling these |
527 static bool has_events() KERNEL_RETURN_(false); |
527 static bool has_events() NOT_JVMTI_RETURN_(false); |
528 static void enqueue(const JvmtiDeferredEvent& event) KERNEL_RETURN; |
528 static void enqueue(const JvmtiDeferredEvent& event) NOT_JVMTI_RETURN; |
529 static JvmtiDeferredEvent dequeue() KERNEL_RETURN_(JvmtiDeferredEvent()); |
529 static JvmtiDeferredEvent dequeue() NOT_JVMTI_RETURN_(JvmtiDeferredEvent()); |
530 |
530 |
531 // Used to enqueue events without using a lock, for times (such as during |
531 // Used to enqueue events without using a lock, for times (such as during |
532 // safepoint) when we can't or don't want to lock the Service_lock. |
532 // safepoint) when we can't or don't want to lock the Service_lock. |
533 // |
533 // |
534 // Events will be held off to the side until there's a call to |
534 // Events will be held off to the side until there's a call to |
535 // dequeue(), enqueue(), or process_pending_events() (all of which require |
535 // dequeue(), enqueue(), or process_pending_events() (all of which require |
536 // the holding of the Service_lock), and will be enqueued at that time. |
536 // the holding of the Service_lock), and will be enqueued at that time. |
537 static void add_pending_event(const JvmtiDeferredEvent&) KERNEL_RETURN; |
537 static void add_pending_event(const JvmtiDeferredEvent&) NOT_JVMTI_RETURN; |
538 }; |
538 }; |
539 |
539 |
540 // Utility macro that checks for NULL pointers: |
540 // Utility macro that checks for NULL pointers: |
541 #define NULL_CHECK(X, Y) if ((X) == NULL) { return (Y); } |
541 #define NULL_CHECK(X, Y) if ((X) == NULL) { return (Y); } |
542 |
542 |