441 * and then enqueued onto the JvmtiDeferredEventQueue, where the Service
442 * thread will pick it up and post it.
443 *
444 * This is currently only used for posting compiled-method-load and unload
445 * events, which we don't want posted from the compiler thread.
446 */
447 class JvmtiDeferredEvent VALUE_OBJ_CLASS_SPEC {
448 friend class JvmtiDeferredEventQueue;
449 private:
450 typedef enum {
451 TYPE_NONE,
452 TYPE_COMPILED_METHOD_LOAD,
453 TYPE_COMPILED_METHOD_UNLOAD,
454 TYPE_DYNAMIC_CODE_GENERATED
455 } Type;
456
457 Type _type;
458 union {
459 nmethod* compiled_method_load;
460 struct {
461 jmethodID method_id;
462 const void* code_begin;
463 } compiled_method_unload;
464 struct {
465 const char* name;
466 const void* code_begin;
467 const void* code_end;
468 } dynamic_code_generated;
469 } _event_data;
470
471 JvmtiDeferredEvent(Type t) : _type(t) {}
472
473 public:
474
475 JvmtiDeferredEvent() : _type(TYPE_NONE) {}
476
477 // Factory methods
478 static JvmtiDeferredEvent compiled_method_load_event(nmethod* nm)
479 KERNEL_RETURN_(JvmtiDeferredEvent());
480 static JvmtiDeferredEvent compiled_method_unload_event(
481 jmethodID id, const void* code) KERNEL_RETURN_(JvmtiDeferredEvent());
482 static JvmtiDeferredEvent dynamic_code_generated_event(
483 const char* name, const void* begin, const void* end)
484 KERNEL_RETURN_(JvmtiDeferredEvent());
485
486 // Actually posts the event.
487 void post() KERNEL_RETURN;
488 };
489
490 /**
491 * Events enqueued on this queue wake up the Service thread which dequeues
492 * and posts the events. The Service_lock is required to be held
493 * when operating on the queue (except for the "pending" events).
494 */
495 class JvmtiDeferredEventQueue : AllStatic {
496 friend class JvmtiDeferredEvent;
497 private:
498 class QueueNode : public CHeapObj {
499 private:
500 JvmtiDeferredEvent _event;
|
441 * and then enqueued onto the JvmtiDeferredEventQueue, where the Service
442 * thread will pick it up and post it.
443 *
444 * This is currently only used for posting compiled-method-load and unload
445 * events, which we don't want posted from the compiler thread.
446 */
447 class JvmtiDeferredEvent VALUE_OBJ_CLASS_SPEC {
448 friend class JvmtiDeferredEventQueue;
449 private:
450 typedef enum {
451 TYPE_NONE,
452 TYPE_COMPILED_METHOD_LOAD,
453 TYPE_COMPILED_METHOD_UNLOAD,
454 TYPE_DYNAMIC_CODE_GENERATED
455 } Type;
456
457 Type _type;
458 union {
459 nmethod* compiled_method_load;
460 struct {
461 nmethod* nm;
462 jmethodID method_id;
463 const void* code_begin;
464 } compiled_method_unload;
465 struct {
466 const char* name;
467 const void* code_begin;
468 const void* code_end;
469 } dynamic_code_generated;
470 } _event_data;
471
472 JvmtiDeferredEvent(Type t) : _type(t) {}
473
474 public:
475
476 JvmtiDeferredEvent() : _type(TYPE_NONE) {}
477
478 // Factory methods
479 static JvmtiDeferredEvent compiled_method_load_event(nmethod* nm)
480 KERNEL_RETURN_(JvmtiDeferredEvent());
481 static JvmtiDeferredEvent compiled_method_unload_event(nmethod* nm,
482 jmethodID id, const void* code) KERNEL_RETURN_(JvmtiDeferredEvent());
483 static JvmtiDeferredEvent dynamic_code_generated_event(
484 const char* name, const void* begin, const void* end)
485 KERNEL_RETURN_(JvmtiDeferredEvent());
486
487 // Actually posts the event.
488 void post() KERNEL_RETURN;
489 };
490
491 /**
492 * Events enqueued on this queue wake up the Service thread which dequeues
493 * and posts the events. The Service_lock is required to be held
494 * when operating on the queue (except for the "pending" events).
495 */
496 class JvmtiDeferredEventQueue : AllStatic {
497 friend class JvmtiDeferredEvent;
498 private:
499 class QueueNode : public CHeapObj {
500 private:
501 JvmtiDeferredEvent _event;
|