xo-interpreter/xo-alloc: GlobalEnv + mm -> shallow_copy()
This commit is contained in:
parent
eec5bc0981
commit
760bb556b2
4 changed files with 7 additions and 4 deletions
|
|
@ -30,7 +30,7 @@ namespace xo {
|
|||
/** required by Object i/face, but never called on Forwarding1 **/
|
||||
virtual std::size_t _shallow_size() const final override;
|
||||
/** required by Object i/face, but never called on Forwarding1 **/
|
||||
virtual Object * _shallow_copy() const final override;
|
||||
virtual Object * _shallow_copy(gc::IAlloc * mm) const final override;
|
||||
/** required by Object i/face, but never called on Forwarding1 **/
|
||||
virtual std::size_t _forward_children() final override;
|
||||
|
||||
|
|
|
|||
|
|
@ -57,6 +57,9 @@ namespace xo {
|
|||
return (u2 <= u1 + sizeof(std::uintptr_t));
|
||||
}
|
||||
|
||||
/** (for consistency's sake) **/
|
||||
T * get() const { return ptr_; }
|
||||
|
||||
T * ptr() const { return ptr_; }
|
||||
T ** ptr_address() { return &ptr_; }
|
||||
|
||||
|
|
@ -204,7 +207,7 @@ namespace xo {
|
|||
*
|
||||
* Require: @ref mm is an instance of @ref gc::GC
|
||||
**/
|
||||
virtual Object * _shallow_copy() const = 0;
|
||||
virtual Object * _shallow_copy(gc::IAlloc * mm) const = 0;
|
||||
|
||||
/** update child pointers that refer to forwarding pointers,
|
||||
* replacing them with the correct destination.
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ namespace xo {
|
|||
|
||||
// LCOV_EXCL_START
|
||||
Object *
|
||||
Forwarding1::_shallow_copy() const {
|
||||
Forwarding1::_shallow_copy(gc::IAlloc *) const {
|
||||
assert(false);
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -170,7 +170,7 @@ namespace xo {
|
|||
*/
|
||||
if (gc->fromspace_contains(src))
|
||||
{
|
||||
Object * dest = src->_shallow_copy();
|
||||
Object * dest = src->_shallow_copy(gc);
|
||||
|
||||
if (dest != src)
|
||||
src->_forward_to(dest);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue