src/share/vm/services/memPtr.hpp

Print this page
rev 3953 : JDK-8005012: Add WB APIs to better support NMT testing
Summary:


  30 #include "runtime/os.hpp"
  31 #include "runtime/safepoint.hpp"
  32 
  33 /*
  34  * global sequence generator that generates sequence numbers to serialize
  35  * memory records.
  36  */
  37 class SequenceGenerator : AllStatic {
  38  public:
  39   static jint next();
  40 
  41   // peek last sequence number
  42   static jint peek() {
  43     return _seq_number;
  44   }
  45 
  46   // reset sequence number
  47   static void reset() {
  48     assert(SafepointSynchronize::is_at_safepoint(), "Safepoint required");
  49     _seq_number = 1;
  50     DEBUG_ONLY(_generation ++;)
  51   };
  52 
  53   DEBUG_ONLY(static unsigned long current_generation() { return (unsigned long)_generation; })
  54   NOT_PRODUCT(static jint max_seq_num() { return _max_seq_number; })
  55 
  56  private:
  57   static volatile jint _seq_number;

  58   NOT_PRODUCT(static jint _max_seq_number; )
  59   DEBUG_ONLY(static volatile unsigned long _generation; )
  60 };
  61 
  62 /*
  63  * followings are the classes that are used to hold memory activity records in different stages.
  64  *   MemPointer
  65  *     |--------MemPointerRecord
  66  *                     |
  67  *                     |----MemPointerRecordEx
  68  *                     |           |
  69  *                     |           |-------SeqMemPointerRecordEx
  70  *                     |
  71  *                     |----SeqMemPointerRecord
  72  *                     |
  73  *                     |----VMMemRegion
  74  *                               |
  75  *                               |-----VMMemRegionEx
  76  *
  77  *
  78  *  prefix 'Seq' - sequenced, the record contains a sequence number
  79  *  surfix 'Ex'  - extension, the record contains a caller's pc




  30 #include "runtime/os.hpp"
  31 #include "runtime/safepoint.hpp"
  32 
  33 /*
  34  * global sequence generator that generates sequence numbers to serialize
  35  * memory records.
  36  */
  37 class SequenceGenerator : AllStatic {
  38  public:
  39   static jint next();
  40 
  41   // peek last sequence number
  42   static jint peek() {
  43     return _seq_number;
  44   }
  45 
  46   // reset sequence number
  47   static void reset() {
  48     assert(SafepointSynchronize::is_at_safepoint(), "Safepoint required");
  49     _seq_number = 1;
  50     _generation ++;
  51   };
  52 
  53   static unsigned long current_generation() { return _generation; }
  54   NOT_PRODUCT(static jint max_seq_num() { return _max_seq_number; })
  55 
  56  private:
  57   static volatile jint             _seq_number;
  58   static volatile unsigned long    _generation;
  59   NOT_PRODUCT(static jint          _max_seq_number; )

  60 };
  61 
  62 /*
  63  * followings are the classes that are used to hold memory activity records in different stages.
  64  *   MemPointer
  65  *     |--------MemPointerRecord
  66  *                     |
  67  *                     |----MemPointerRecordEx
  68  *                     |           |
  69  *                     |           |-------SeqMemPointerRecordEx
  70  *                     |
  71  *                     |----SeqMemPointerRecord
  72  *                     |
  73  *                     |----VMMemRegion
  74  *                               |
  75  *                               |-----VMMemRegionEx
  76  *
  77  *
  78  *  prefix 'Seq' - sequenced, the record contains a sequence number
  79  *  surfix 'Ex'  - extension, the record contains a caller's pc