< prev index next >

src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdEpoch.hpp

Print this page

 38 #define EPOCH_1_BIT                          (BIT << EPOCH_1_SHIFT)
 39 #define EPOCH_0_METHOD_BIT                   (METHOD_BIT << EPOCH_0_SHIFT)
 40 #define EPOCH_1_METHOD_BIT                   (METHOD_BIT << EPOCH_1_SHIFT)
 41 #define METHOD_AND_CLASS_BITS                (METHOD_BIT | BIT)
 42 #define EPOCH_0_METHOD_AND_CLASS_BITS        (METHOD_AND_CLASS_BITS << EPOCH_0_SHIFT)
 43 #define EPOCH_1_METHOD_AND_CLASS_BITS        (METHOD_AND_CLASS_BITS << EPOCH_1_SHIFT)
 44 
 45  // Epoch alternation on each rotation allow for concurrent tagging.
 46  // The epoch shift happens only during a safepoint.
 47  //
 48  // _synchronizing is a transition state, the purpose of which is to
 49  // have JavaThreads that run _thread_in_native (i.e. Compiler threads)
 50  // respect the current epoch shift in-progress during the safepoint.
 51  //
 52  // _changed_tag_state == true signals an incremental modification to artifact tagging
 53  // (klasses, methods, CLDs, etc), purpose of which is to trigger collection of artifacts.
 54  //
 55 class JfrTraceIdEpoch : AllStatic {
 56   friend class JfrCheckpointManager;
 57  private:

 58   static JfrSignal _tag_state;
 59   static bool _epoch_state;
 60   static bool _synchronizing;
 61 
 62   static void begin_epoch_shift();
 63   static void end_epoch_shift();
 64 
 65  public:
 66   static bool epoch() {
 67     return _epoch_state;
 68   }
 69 
 70   static address epoch_address() {
 71     return (address)&_epoch_state;
 72   }
 73 
 74   static u1 current() {
 75     return _epoch_state ? (u1)1 : (u1)0;
 76   }
 77 








 78   static u1 previous() {
 79     return _epoch_state ? (u1)0 : (u1)1;
 80   }
 81 
 82   static bool is_synchronizing() {
 83     return Atomic::load_acquire(&_synchronizing);
 84   }
 85 
 86   static traceid this_epoch_bit() {
 87     return _epoch_state ? EPOCH_1_BIT : EPOCH_0_BIT;
 88   }
 89 
 90   static traceid previous_epoch_bit() {
 91     return _epoch_state ? EPOCH_0_BIT : EPOCH_1_BIT;
 92   }
 93 
 94   static traceid this_epoch_method_bit() {
 95     return _epoch_state ? EPOCH_1_METHOD_BIT : EPOCH_0_METHOD_BIT;
 96   }
 97 

 38 #define EPOCH_1_BIT                          (BIT << EPOCH_1_SHIFT)
 39 #define EPOCH_0_METHOD_BIT                   (METHOD_BIT << EPOCH_0_SHIFT)
 40 #define EPOCH_1_METHOD_BIT                   (METHOD_BIT << EPOCH_1_SHIFT)
 41 #define METHOD_AND_CLASS_BITS                (METHOD_BIT | BIT)
 42 #define EPOCH_0_METHOD_AND_CLASS_BITS        (METHOD_AND_CLASS_BITS << EPOCH_0_SHIFT)
 43 #define EPOCH_1_METHOD_AND_CLASS_BITS        (METHOD_AND_CLASS_BITS << EPOCH_1_SHIFT)
 44 
 45  // Epoch alternation on each rotation allow for concurrent tagging.
 46  // The epoch shift happens only during a safepoint.
 47  //
 48  // _synchronizing is a transition state, the purpose of which is to
 49  // have JavaThreads that run _thread_in_native (i.e. Compiler threads)
 50  // respect the current epoch shift in-progress during the safepoint.
 51  //
 52  // _changed_tag_state == true signals an incremental modification to artifact tagging
 53  // (klasses, methods, CLDs, etc), purpose of which is to trigger collection of artifacts.
 54  //
 55 class JfrTraceIdEpoch : AllStatic {
 56   friend class JfrCheckpointManager;
 57  private:
 58   static u2 _generation;
 59   static JfrSignal _tag_state;
 60   static bool _epoch_state;
 61   static bool _synchronizing;
 62 
 63   static void begin_epoch_shift();
 64   static void end_epoch_shift();
 65 
 66  public:
 67   static bool epoch() {
 68     return _epoch_state;
 69   }
 70 
 71   static address epoch_address() {
 72     return (address)&_epoch_state;
 73   }
 74 
 75   static u1 current() {
 76     return _epoch_state ? (u1)1 : (u1)0;
 77   }
 78 
 79   static traceid epoch_generation() {
 80     return _generation;
 81   }
 82 
 83   static bool is_current_epoch_generation(traceid generation) {
 84     return _generation == generation;
 85   }
 86 
 87   static u1 previous() {
 88     return _epoch_state ? (u1)0 : (u1)1;
 89   }
 90 
 91   static bool is_synchronizing() {
 92     return Atomic::load_acquire(&_synchronizing);
 93   }
 94 
 95   static traceid this_epoch_bit() {
 96     return _epoch_state ? EPOCH_1_BIT : EPOCH_0_BIT;
 97   }
 98 
 99   static traceid previous_epoch_bit() {
100     return _epoch_state ? EPOCH_0_BIT : EPOCH_1_BIT;
101   }
102 
103   static traceid this_epoch_method_bit() {
104     return _epoch_state ? EPOCH_1_METHOD_BIT : EPOCH_0_METHOD_BIT;
105   }
106 
< prev index next >