2008-11-23 23:58:01 +00:00
|
|
|
/* Copyright (c) 2008, Avian Contributors
|
|
|
|
|
|
|
|
Permission to use, copy, modify, and/or distribute this software
|
|
|
|
for any purpose with or without fee is hereby granted, provided
|
|
|
|
that the above copyright notice and this permission notice appear
|
|
|
|
in all copies.
|
|
|
|
|
|
|
|
There is NO WARRANTY for this software. See license.txt for
|
|
|
|
details. */
|
|
|
|
|
|
|
|
#ifndef HEAPWALK_H
|
|
|
|
#define HEAPWALK_H
|
|
|
|
|
|
|
|
#include "common.h"
|
2008-11-21 23:20:35 +00:00
|
|
|
|
|
|
|
namespace vm {
|
|
|
|
|
2008-11-23 23:58:01 +00:00
|
|
|
class Thread;
|
|
|
|
|
2008-11-21 23:20:35 +00:00
|
|
|
class HeapMap {
|
|
|
|
public:
|
|
|
|
virtual int find(object value) = 0;
|
|
|
|
virtual void dispose() = 0;
|
|
|
|
};
|
|
|
|
|
2008-11-23 23:58:01 +00:00
|
|
|
class HeapVisitor {
|
2008-11-21 23:20:35 +00:00
|
|
|
public:
|
|
|
|
virtual void root() = 0;
|
|
|
|
virtual unsigned visitNew(object value) = 0;
|
|
|
|
virtual void visitOld(object value, unsigned number) = 0;
|
|
|
|
virtual void push(unsigned offset) = 0;
|
|
|
|
virtual void pop() = 0;
|
|
|
|
};
|
|
|
|
|
2008-11-23 23:58:01 +00:00
|
|
|
class HeapWalker {
|
|
|
|
public:
|
|
|
|
virtual unsigned visitRoot(object root) = 0;
|
|
|
|
virtual void visitAllRoots() = 0;
|
|
|
|
virtual HeapMap* map() = 0;
|
|
|
|
virtual void dispose() = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
HeapWalker*
|
|
|
|
makeHeapWalker(Thread* t, HeapVisitor* v);
|
2008-11-21 23:20:35 +00:00
|
|
|
|
|
|
|
} // namespace vm
|
2008-11-23 23:58:01 +00:00
|
|
|
|
|
|
|
#endif//HEAPWALK_H
|