/*
* 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.
*
*/
#include "memory/allocation.hpp"
#include "services/memPtrArray.hpp"
class MemSnapshot;
class MemTracker;
class MemTrackWorker;
// Fixed size memory pointer array implementation
public MemPointerArray {
// This implementation is for memory recorder only
friend class MemRecorder;
private:
int _size;
protected:
_size(0){
if (init_elements) {
}
}
}
// the instance is part of memRecorder, needs to be tagged with 'otNMTRecorder'
// to avoid recursion
}
assert(false, "use nothrow version");
return NULL;
}
void operator delete(void* p) {
}
// instance size
return sizeof(FixedSizeMemPointerArray<E, SIZE>);
}
public:
// implementation of public interface
bool out_of_memory() const { return false; }
void clear() {
_size = 0;
}
if (is_full()) return false;
return true;
}
assert(false, "append only");
return false;
}
assert(false, "not supported");
return false;
}
"parameter check");
}
}
bool shrink() {
return false;
}
};
// This iterator requires pre-sorted MemPointerArray, which is sorted by:
// 1. address
// 2. allocation type
// 3. sequence number
// During the array walking, iterator collapses pointers with the same
// address and allocation type, and only returns the one with highest
// sequence number.
//
// This is read-only iterator, update methods are asserted.
private:
public:
_cur = next_record();
}
_cur = next_record();
}
// return the pointer at current position
return _cur;
};
// return the next pointer and advance current position
_cur = next_record();
return _cur;
}
// return the next pointer without advancing current position
assert(false, "not implemented");
return NULL;
}
// return the previous pointer without changing current position
assert(false, "not implemented");
return NULL;
}
// remove the pointer at current position
virtual void remove() {
assert(false, "read-only iterator");
};
// insert the pointer at current position
assert(false, "read-only iterator");
return false;
}
assert(false, "read-only iterator");
return false;
}
private:
// collapse the 'same kind' of records, and return this 'kind' of
// record with highest sequence number
// Test if the two records are the same kind: the same memory block and allocation
// type.
}
};
friend class MemSnapshot;
friend class MemTracker;
friend class MemTrackWorker;
friend class GenerationData;
protected:
// the array that holds memory records
private:
// used for linked list
// active recorder can only record a certain generation data
unsigned long _generation;
protected:
~MemRecorder();
// record a memory operation
// linked list support
}
return _next;
}
// if the recorder is full
inline bool is_full() const {
return _pointer_records->is_full();
}
// if running out of memory when initializing recorder's internal
// data
inline bool out_of_memory() const {
return (_pointer_records == NULL ||
}
inline void clear() {
}
// return the generation of this recorder which it belongs to
protected:
// number of MemRecorder instance
private:
// sorting function, sort records into following order
// 1. memory address
// 2. allocation type
// 3. sequence number
void set_generation();
};
#endif // SHARE_VM_SERVICES_MEM_RECORDER_HPP