/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#ifndef SHARE_VM_SERVICES_MEM_PTR_HPP
#define SHARE_VM_SERVICES_MEM_PTR_HPP
#include "memory/allocation.hpp"
#include "runtime/atomic.hpp"
#include "runtime/safepoint.hpp"
/*
* global sequence generator that generates sequence numbers to serialize
* memory records.
*/
public:
// peek last sequence number
return _seq_number;
}
// reset sequence number
static void reset() {
_seq_number = 1;
_generation ++;
};
private:
static volatile unsigned long _generation;
};
/*
* followings are the classes that are used to hold memory activity records in different stages.
* MemPointer
* |--------MemPointerRecord
* |
* |----MemPointerRecordEx
* | |
* | |-------SeqMemPointerRecordEx
* |
* |----SeqMemPointerRecord
* |
* |----VMMemRegion
* |
* |-----VMMemRegionEx
*
*
* prefix 'Seq' - sequenced, the record contains a sequence number
* surfix 'Ex' - extension, the record contains a caller's pc
*
* per-thread recorder : SeqMemPointerRecord(Ex)
* snapshot staging : SeqMemPointerRecord(Ex)
* snapshot : MemPointerRecord(Ex) and VMMemRegion(Ex)
*
*/
/*
* class that wraps an address to a memory block,
* the memory pointer either points to a malloc'd
* memory block, or a mmap'd memory block
*/
public:
}
return _addr;
}
inline operator address() const {
return addr();
}
inline bool operator == (const MemPointer& other) const {
}
return *this;
}
protected:
protected:
// memory address
};
/* MemPointerRecord records an activityand associated
* attributes on a memory block.
*/
private:
public:
/* extension of MemoryType enum
* see share/vm/memory/allocation.hpp for details.
*
* The tag values are associated to sorting orders, so be
* careful if changes are needed.
* The allocation records should be sorted ahead of tagging
* records, which in turn ahead of deallocation records
*/
enum MemPointerTags {
};
/* helper functions to interpret the tagging flags */
}
}
}
}
}
}
}
}
}
}
/* tagging flags */
public:
}
/* MemPointerRecord is not sequenced, it always return
* 0 to indicate non-sequenced
*/
MemPointer::operator=(ptr);
#ifdef ASSERT
if (IS_ARENA_OBJ(_flags)) {
}
#endif
return *this;
}
// if the pointer represents a malloc-ed memory address
inline bool is_malloced_pointer() const {
return !is_vm_pointer();
}
// if the pointer represents a virtual memory address
inline bool is_vm_pointer() const {
return is_virtual_memory_record(_flags);
}
// if this record records a 'malloc' or virtual memory
// 'reserve' call
inline bool is_allocation_record() const {
return is_allocation_record(_flags);
}
// if this record records a size information of an arena
inline bool is_arena_memory_record() const {
return is_arena_memory_record(_flags);
}
// if this pointer represents an address to an arena object
inline bool is_arena_record() const {
return is_arena_record(_flags);
}
// if this record represents a size information of specific arena
}
// if this record records a 'free' or virtual memory 'free' call
inline bool is_deallocation_record() const {
return is_deallocation_record(_flags);
}
// if this record records a virtual memory 'commit' call
inline bool is_commit_record() const {
return is_virtual_memory_commit_record(_flags);
}
// if this record records a virtual memory 'uncommit' call
inline bool is_uncommit_record() const {
return is_virtual_memory_uncommit_record(_flags);
}
// if this record is a tagging record of a virtual memory block
inline bool is_type_tagging_record() const {
return is_virtual_memory_type_record(_flags);
}
// if the two memory pointer records actually represent the same
// memory block
}
// if this memory region fully contains another one
}
// if this memory region fully contains specified memory range
}
}
// if this memory region overlaps another region
}
};
// MemPointerRecordEx also records callsite pc, from where
// the memory block is allocated
private:
public:
MemPointerRecord::operator=(*mpe);
}
MemPointerRecord::operator=(*mp);
_pc = 0;
}
};
// a virtual memory region. The region can represent a reserved
// virtual memory region or a committed memory region
public:
VMMemRegion() { }
}
MemPointerRecord::operator=(other);
return *this;
}
inline bool is_reserved_region() const {
return is_allocation_record();
}
inline bool is_committed_region() const {
return is_commit_record();
}
/* base address of this virtual memory range */
return addr();
}
/* tag this virtual memory range to the specified memory type */
}
// expand this region to also cover specified range.
// The range has to be on either end of the memory region.
} else {
}
}
// exclude the specified address range from this region.
// The excluded memory range has to be on either end of this memory
// region.
"exclude in the middle");
} else {
}
}
};
private:
public:
}
_pc = 0;
}
VMMemRegion::operator=(other);
return *this;
}
private:
};
/*
* Sequenced memory record
*/
private:
public:
}
}
MemPointerRecord::operator=(ptr);
return *this;
}
return _seq;
}
};
private:
public:
}
}
MemPointerRecordEx::operator=(ptr);
return *this;
}
return _seq;
}
};
#endif // SHARE_VM_SERVICES_MEM_PTR_HPP