hotspot/src/share/vm/services/memPtr.hpp
author zgu
Thu, 28 Jun 2012 17:03:16 -0400
changeset 13195 be27e1b6a4b9
child 13478 85fe611440e5
permissions -rw-r--r--
6995781: Native Memory Tracking (Phase 1) 7151532: DCmd for hotspot native memory tracking Summary: Implementation of native memory tracking phase 1, which tracks VM native memory usage, and related DCmd Reviewed-by: acorn, coleenp, fparain
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13195
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
     1
/*
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
     2
 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
     4
 *
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
     7
 * published by the Free Software Foundation.
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
     8
 *
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    13
 * accompanied this code).
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    14
 *
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    18
 *
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    21
 * questions.
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    22
 *
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    23
 */
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    24
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    25
#ifndef SHARE_VM_SERVICES_MEM_PTR_HPP
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    26
#define SHARE_VM_SERVICES_MEM_PTR_HPP
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    27
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    28
#include "memory/allocation.hpp"
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    29
#include "runtime/atomic.hpp"
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    30
#include "runtime/os.hpp"
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    31
#include "runtime/safepoint.hpp"
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    32
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    33
/*
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    34
 * global sequence generator that generates sequence numbers to serialize
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    35
 * memory records.
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    36
 */
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    37
class SequenceGenerator : AllStatic {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    38
 public:
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    39
  static jint next();
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    40
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    41
  // peek last sequence number
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    42
  static jint peek() {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    43
    return _seq_number;
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    44
  }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    45
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    46
  // reset sequence number
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    47
  static void reset() {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    48
    assert(SafepointSynchronize::is_at_safepoint(), "Safepoint required");
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    49
    _seq_number = 1;
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    50
    DEBUG_ONLY(_generation ++;)
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    51
  };
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    52
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    53
  DEBUG_ONLY(static unsigned long current_generation() { return (unsigned long)_generation; })
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    54
  DEBUG_ONLY(static jint max_seq_num() { return _max_seq_number; })
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    55
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    56
 private:
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    57
  static volatile jint _seq_number;
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    58
  DEBUG_ONLY(static jint _max_seq_number; )
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    59
  DEBUG_ONLY(static volatile unsigned long _generation; )
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    60
};
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    61
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    62
/*
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    63
 * followings are the classes that are used to hold memory activity records in different stages.
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    64
 *   MemPointer
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    65
 *     |--------MemPointerRecord
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    66
 *                     |
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    67
 *                     |----MemPointerRecordEx
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    68
 *                     |           |
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    69
 *                     |           |-------SeqMemPointerRecordEx
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    70
 *                     |
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    71
 *                     |----SeqMemPointerRecord
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    72
 *                     |
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    73
 *                     |----VMMemRegion
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    74
 *                               |
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    75
 *                               |-----VMMemRegionEx
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    76
 *
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    77
 *
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    78
 *  prefix 'Seq' - sequenced, the record contains a sequence number
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    79
 *  surfix 'Ex'  - extension, the record contains a caller's pc
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    80
 *
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    81
 *  per-thread recorder : SeqMemPointerRecord(Ex)
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    82
 *  snapshot staging    : SeqMemPointerRecord(Ex)
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    83
 *  snapshot            : MemPointerRecord(Ex) and VMMemRegion(Ex)
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    84
 *
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    85
 */
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    86
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    87
/*
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    88
 * class that wraps an address to a memory block,
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    89
 * the memory pointer either points to a malloc'd
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    90
 * memory block, or a mmap'd memory block
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    91
 */
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    92
class MemPointer : public _ValueObj {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    93
 public:
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    94
  MemPointer(): _addr(0) { }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    95
  MemPointer(address addr): _addr(addr) { }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    96
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    97
  MemPointer(const MemPointer& copy_from) {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    98
    _addr = copy_from.addr();
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
    99
  }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   100
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   101
  inline address addr() const {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   102
    return _addr;
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   103
  }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   104
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   105
  inline operator address() const {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   106
    return addr();
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   107
  }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   108
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   109
  inline bool operator == (const MemPointer& other) const {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   110
    return addr() == other.addr();
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   111
  }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   112
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   113
  inline MemPointer& operator = (const MemPointer& other) {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   114
    _addr = other.addr();
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   115
    return *this;
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   116
  }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   117
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   118
 protected:
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   119
  inline void set_addr(address addr) { _addr = addr; }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   120
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   121
 protected:
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   122
  // memory address
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   123
  address    _addr;
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   124
};
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   125
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   126
/* MemPointerRecord records an activityand associated
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   127
 * attributes on a memory block.
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   128
 */
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   129
class MemPointerRecord : public MemPointer {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   130
 private:
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   131
  MEMFLAGS       _flags;
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   132
  size_t         _size;
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   133
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   134
public:
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   135
  /* extension of MemoryType enum
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   136
   * see share/vm/memory/allocation.hpp for details.
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   137
   *
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   138
   * The tag values are associated to sorting orders, so be
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   139
   * careful if changes are needed.
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   140
   * The allocation records should be sorted ahead of tagging
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   141
   * records, which in turn ahead of deallocation records
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   142
   */
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   143
  enum MemPointerTags {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   144
    tag_alloc            = 0x0001, // malloc or reserve record
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   145
    tag_commit           = 0x0002, // commit record
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   146
    tag_type             = 0x0003, // tag virtual memory to a memory type
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   147
    tag_uncommit         = 0x0004, // uncommit record
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   148
    tag_release          = 0x0005, // free or release record
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   149
    tag_size             = 0x0006, // arena size
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   150
    tag_masks            = 0x0007, // all tag bits
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   151
    vmBit                = 0x0008
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   152
  };
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   153
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   154
  /* helper functions to interpret the tagging flags */
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   155
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   156
  inline static bool is_allocation_record(MEMFLAGS flags) {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   157
    return (flags & tag_masks) == tag_alloc;
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   158
  }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   159
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   160
  inline static bool is_deallocation_record(MEMFLAGS flags) {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   161
    return (flags & tag_masks) == tag_release;
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   162
  }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   163
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   164
  inline static bool is_arena_record(MEMFLAGS flags) {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   165
    return (flags & (otArena | tag_size)) == otArena;
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   166
  }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   167
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   168
  inline static bool is_arena_size_record(MEMFLAGS flags) {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   169
    return (flags & (otArena | tag_size)) == (otArena | tag_size);
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   170
  }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   171
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   172
  inline static bool is_virtual_memory_record(MEMFLAGS flags) {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   173
    return (flags & vmBit) != 0;
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   174
  }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   175
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   176
  inline static bool is_virtual_memory_reserve_record(MEMFLAGS flags) {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   177
    return (flags & 0x0F) == (tag_alloc | vmBit);
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   178
  }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   179
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   180
  inline static bool is_virtual_memory_commit_record(MEMFLAGS flags) {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   181
    return (flags & 0x0F) == (tag_commit | vmBit);
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   182
  }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   183
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   184
  inline static bool is_virtual_memory_uncommit_record(MEMFLAGS flags) {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   185
    return (flags & 0x0F) == (tag_uncommit | vmBit);
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   186
  }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   187
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   188
  inline static bool is_virtual_memory_release_record(MEMFLAGS flags) {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   189
    return (flags & 0x0F) == (tag_release | vmBit);
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   190
  }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   191
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   192
  inline static bool is_virtual_memory_type_record(MEMFLAGS flags) {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   193
    return (flags & 0x0F) == (tag_type | vmBit);
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   194
  }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   195
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   196
  /* tagging flags */
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   197
  inline static MEMFLAGS malloc_tag()                 { return tag_alloc;   }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   198
  inline static MEMFLAGS free_tag()                   { return tag_release; }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   199
  inline static MEMFLAGS arena_size_tag()             { return tag_size | otArena; }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   200
  inline static MEMFLAGS virtual_memory_tag()         { return vmBit; }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   201
  inline static MEMFLAGS virtual_memory_reserve_tag() { return (tag_alloc | vmBit); }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   202
  inline static MEMFLAGS virtual_memory_commit_tag()  { return (tag_commit | vmBit); }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   203
  inline static MEMFLAGS virtual_memory_uncommit_tag(){ return (tag_uncommit | vmBit); }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   204
  inline static MEMFLAGS virtual_memory_release_tag() { return (tag_release | vmBit); }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   205
  inline static MEMFLAGS virtual_memory_type_tag()    { return (tag_type | vmBit); }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   206
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   207
 public:
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   208
  MemPointerRecord(): _size(0), _flags(mtNone) { }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   209
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   210
  MemPointerRecord(address addr, MEMFLAGS memflags, size_t size = 0):
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   211
      MemPointer(addr), _flags(memflags), _size(size) { }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   212
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   213
  MemPointerRecord(const MemPointerRecord& copy_from):
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   214
    MemPointer(copy_from), _flags(copy_from.flags()),
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   215
    _size(copy_from.size()) {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   216
  }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   217
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   218
  /* MemPointerRecord is not sequenced, it always return
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   219
   * 0 to indicate non-sequenced
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   220
   */
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   221
  virtual jint seq() const               { return 0; }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   222
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   223
  inline size_t   size()  const          { return _size; }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   224
  inline void set_size(size_t size)      { _size = size; }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   225
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   226
  inline MEMFLAGS flags() const          { return _flags; }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   227
  inline void set_flags(MEMFLAGS flags)  { _flags = flags; }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   228
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   229
  MemPointerRecord& operator= (const MemPointerRecord& ptr) {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   230
    MemPointer::operator=(ptr);
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   231
    _flags = ptr.flags();
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   232
#ifdef ASSERT
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   233
    if (IS_ARENA_OBJ(_flags)) {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   234
      assert(!is_vm_pointer(), "wrong flags");
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   235
      assert((_flags & ot_masks) == otArena, "wrong flags");
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   236
    }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   237
#endif
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   238
    _size = ptr.size();
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   239
    return *this;
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   240
  }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   241
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   242
  // if the pointer represents a malloc-ed memory address
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   243
  inline bool is_malloced_pointer() const {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   244
    return !is_vm_pointer();
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   245
  }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   246
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   247
  // if the pointer represents a virtual memory address
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   248
  inline bool is_vm_pointer() const {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   249
    return is_virtual_memory_record(_flags);
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   250
  }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   251
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   252
  // if this record records a 'malloc' or virtual memory
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   253
  // 'reserve' call
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   254
  inline bool is_allocation_record() const {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   255
    return is_allocation_record(_flags);
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   256
  }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   257
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   258
  // if this record records a size information of an arena
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   259
  inline bool is_arena_size_record() const {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   260
    return is_arena_size_record(_flags);
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   261
  }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   262
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   263
  // if this pointer represents an address to an arena object
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   264
  inline bool is_arena_record() const {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   265
    return is_arena_record(_flags);
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   266
  }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   267
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   268
  // if this record represents a size information of specific arena
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   269
  inline bool is_size_record_of_arena(const MemPointerRecord* arena_rc) {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   270
    assert(is_arena_size_record(), "not size record");
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   271
    assert(arena_rc->is_arena_record(), "not arena record");
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   272
    return (arena_rc->addr() + sizeof(void*)) == addr();
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   273
  }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   274
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   275
  // if this record records a 'free' or virtual memory 'free' call
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   276
  inline bool is_deallocation_record() const {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   277
    return is_deallocation_record(_flags);
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   278
  }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   279
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   280
  // if this record records a virtual memory 'commit' call
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   281
  inline bool is_commit_record() const {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   282
    return is_virtual_memory_commit_record(_flags);
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   283
  }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   284
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   285
  // if this record records a virtual memory 'uncommit' call
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   286
  inline bool is_uncommit_record() const {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   287
    return is_virtual_memory_uncommit_record(_flags);
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   288
  }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   289
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   290
  // if this record is a tagging record of a virtual memory block
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   291
  inline bool is_type_tagging_record() const {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   292
    return is_virtual_memory_type_record(_flags);
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   293
  }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   294
};
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   295
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   296
// MemPointerRecordEx also records callsite pc, from where
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   297
// the memory block is allocated
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   298
class MemPointerRecordEx : public MemPointerRecord {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   299
 private:
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   300
  address      _pc;  // callsite pc
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   301
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   302
 public:
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   303
  MemPointerRecordEx(): _pc(0) { }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   304
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   305
  MemPointerRecordEx(address addr, MEMFLAGS memflags, size_t size = 0, address pc = 0):
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   306
    MemPointerRecord(addr, memflags, size), _pc(pc) {}
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   307
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   308
  MemPointerRecordEx(const MemPointerRecordEx& copy_from):
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   309
    MemPointerRecord(copy_from), _pc(copy_from.pc()) {}
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   310
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   311
  inline address pc() const { return _pc; }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   312
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   313
  void init(const MemPointerRecordEx* mpe) {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   314
    MemPointerRecord::operator=(*mpe);
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   315
    _pc = mpe->pc();
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   316
  }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   317
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   318
  void init(const MemPointerRecord* mp) {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   319
    MemPointerRecord::operator=(*mp);
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   320
    _pc = 0;
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   321
  }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   322
};
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   323
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   324
// a virtual memory region
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   325
class VMMemRegion : public MemPointerRecord {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   326
 private:
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   327
  // committed size
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   328
  size_t       _committed_size;
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   329
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   330
public:
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   331
  VMMemRegion(): _committed_size(0) { }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   332
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   333
  void init(const MemPointerRecord* mp) {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   334
    assert(mp->is_vm_pointer(), "not virtual memory pointer");
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   335
    _addr = mp->addr();
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   336
    if (mp->is_commit_record() || mp->is_uncommit_record()) {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   337
      _committed_size = mp->size();
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   338
      set_size(_committed_size);
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   339
    } else {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   340
      set_size(mp->size());
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   341
      _committed_size = 0;
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   342
    }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   343
    set_flags(mp->flags());
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   344
  }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   345
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   346
  VMMemRegion& operator=(const VMMemRegion& other) {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   347
    MemPointerRecord::operator=(other);
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   348
    _committed_size = other.committed_size();
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   349
    return *this;
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   350
  }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   351
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   352
  inline bool is_reserve_record() const {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   353
    return is_virtual_memory_reserve_record(flags());
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   354
  }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   355
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   356
  inline bool is_release_record() const {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   357
    return is_virtual_memory_release_record(flags());
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   358
  }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   359
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   360
  // resize reserved VM range
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   361
  inline void set_reserved_size(size_t new_size) {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   362
    assert(new_size >= committed_size(), "resize");
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   363
    set_size(new_size);
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   364
  }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   365
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   366
  inline void commit(size_t size) {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   367
    _committed_size += size;
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   368
  }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   369
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   370
  inline void uncommit(size_t size) {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   371
    if (_committed_size >= size) {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   372
      _committed_size -= size;
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   373
    } else {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   374
      _committed_size = 0;
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   375
    }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   376
  }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   377
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   378
  /*
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   379
   * if this virtual memory range covers whole range of
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   380
   * the other VMMemRegion
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   381
   */
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   382
  bool contains(const VMMemRegion* mr) const;
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   383
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   384
  /* base address of this virtual memory range */
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   385
  inline address base() const {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   386
    return addr();
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   387
  }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   388
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   389
  /* tag this virtual memory range to the specified memory type */
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   390
  inline void tag(MEMFLAGS f) {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   391
    set_flags(flags() | (f & mt_masks));
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   392
  }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   393
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   394
  // release part of memory range
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   395
  inline void partial_release(address add, size_t sz) {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   396
    assert(add >= addr() && add < addr() + size(), "not valid address");
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   397
    // for now, it can partially release from the both ends,
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   398
    // but not in the middle
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   399
    assert(add == addr() || (add + sz) == (addr() + size()),
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   400
      "release in the middle");
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   401
    if (add == addr()) {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   402
      set_addr(add + sz);
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   403
      set_size(size() - sz);
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   404
    } else {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   405
      set_size(size() - sz);
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   406
    }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   407
  }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   408
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   409
  // the committed size of the virtual memory block
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   410
  inline size_t committed_size() const {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   411
    return _committed_size;
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   412
  }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   413
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   414
  // the reserved size of the virtual memory block
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   415
  inline size_t reserved_size() const {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   416
    return size();
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   417
  }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   418
};
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   419
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   420
class VMMemRegionEx : public VMMemRegion {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   421
 private:
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   422
  jint   _seq;  // sequence number
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   423
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   424
 public:
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   425
  VMMemRegionEx(): _pc(0) { }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   426
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   427
  void init(const MemPointerRecordEx* mpe) {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   428
    VMMemRegion::init(mpe);
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   429
    _pc = mpe->pc();
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   430
  }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   431
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   432
  void init(const MemPointerRecord* mpe) {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   433
    VMMemRegion::init(mpe);
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   434
    _pc = 0;
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   435
  }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   436
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   437
  VMMemRegionEx& operator=(const VMMemRegionEx& other) {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   438
    VMMemRegion::operator=(other);
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   439
    _pc = other.pc();
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   440
    return *this;
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   441
  }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   442
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   443
  inline address pc() const { return _pc; }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   444
 private:
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   445
  address   _pc;
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   446
};
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   447
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   448
/*
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   449
 * Sequenced memory record
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   450
 */
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   451
class SeqMemPointerRecord : public MemPointerRecord {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   452
 private:
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   453
   jint _seq;  // sequence number
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   454
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   455
 public:
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   456
  SeqMemPointerRecord(): _seq(0){ }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   457
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   458
  SeqMemPointerRecord(address addr, MEMFLAGS flags, size_t size)
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   459
    : MemPointerRecord(addr, flags, size) {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   460
    _seq = SequenceGenerator::next();
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   461
  }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   462
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   463
  SeqMemPointerRecord(const SeqMemPointerRecord& copy_from)
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   464
    : MemPointerRecord(copy_from) {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   465
    _seq = copy_from.seq();
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   466
  }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   467
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   468
  SeqMemPointerRecord& operator= (const SeqMemPointerRecord& ptr) {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   469
    MemPointerRecord::operator=(ptr);
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   470
    _seq = ptr.seq();
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   471
    return *this;
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   472
  }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   473
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   474
  inline jint seq() const {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   475
    return _seq;
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   476
  }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   477
};
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   478
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   479
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   480
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   481
class SeqMemPointerRecordEx : public MemPointerRecordEx {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   482
 private:
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   483
  jint    _seq;  // sequence number
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   484
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   485
 public:
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   486
  SeqMemPointerRecordEx(): _seq(0) { }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   487
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   488
  SeqMemPointerRecordEx(address addr, MEMFLAGS flags, size_t size,
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   489
    address pc): MemPointerRecordEx(addr, flags, size, pc) {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   490
    _seq = SequenceGenerator::next();
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   491
  }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   492
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   493
  SeqMemPointerRecordEx(const SeqMemPointerRecordEx& copy_from)
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   494
    : MemPointerRecordEx(copy_from) {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   495
    _seq = copy_from.seq();
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   496
  }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   497
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   498
  SeqMemPointerRecordEx& operator= (const SeqMemPointerRecordEx& ptr) {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   499
    MemPointerRecordEx::operator=(ptr);
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   500
    _seq = ptr.seq();
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   501
    return *this;
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   502
  }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   503
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   504
  inline jint seq() const {
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   505
    return _seq;
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   506
  }
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   507
};
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   508
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents:
diff changeset
   509
#endif // SHARE_VM_SERVICES_MEM_PTR_HPP