xo-gc: copy/move step for collection phase
This commit is contained in:
parent
b14d43a633
commit
65ee116ff8
4 changed files with 6 additions and 9 deletions
|
|
@ -25,8 +25,7 @@ namespace xo {
|
||||||
IGCObject_DFloat::shallow_copy(const DFloat & src,
|
IGCObject_DFloat::shallow_copy(const DFloat & src,
|
||||||
obj<AAllocator> mm) noexcept
|
obj<AAllocator> mm) noexcept
|
||||||
{
|
{
|
||||||
DFloat * copy = (DFloat *)mm.alloc(typeseq::id<DFloat>(),
|
DFloat * copy = (DFloat *)mm.alloc_copy((std::byte *)&src);
|
||||||
sizeof(DFloat));
|
|
||||||
|
|
||||||
if (copy)
|
if (copy)
|
||||||
*copy = src;
|
*copy = src;
|
||||||
|
|
|
||||||
|
|
@ -23,10 +23,9 @@ namespace xo {
|
||||||
|
|
||||||
DInteger *
|
DInteger *
|
||||||
IGCObject_DInteger::shallow_copy(const DInteger & src,
|
IGCObject_DInteger::shallow_copy(const DInteger & src,
|
||||||
obj<AAllocator> mm) noexcept
|
obj<AAllocator> mm) noexcept
|
||||||
{
|
{
|
||||||
DInteger * copy = (DInteger *)mm.alloc(typeseq::id<DInteger>(),
|
DInteger * copy = (DInteger *)mm.alloc_copy((std::byte *)&src);
|
||||||
sizeof(DInteger));
|
|
||||||
|
|
||||||
if (copy)
|
if (copy)
|
||||||
*copy = src;
|
*copy = src;
|
||||||
|
|
|
||||||
|
|
@ -24,8 +24,7 @@ namespace xo {
|
||||||
IGCObject_DList::shallow_copy(const DList & src,
|
IGCObject_DList::shallow_copy(const DList & src,
|
||||||
obj<AAllocator> mm) noexcept
|
obj<AAllocator> mm) noexcept
|
||||||
{
|
{
|
||||||
/* FIXME: need to supply object age here */
|
DList * copy = (DList *)mm.alloc_copy((std::byte *)&src);
|
||||||
DList * copy = (DList *)mm.alloc(typeseq::id<DList>(), sizeof(DList));
|
|
||||||
|
|
||||||
if (copy)
|
if (copy)
|
||||||
*copy = src;
|
*copy = src;
|
||||||
|
|
|
||||||
|
|
@ -194,14 +194,14 @@ namespace ut {
|
||||||
REQUIRE(info.tseq() == typeseq::id<DList>().seqno());
|
REQUIRE(info.tseq() == typeseq::id<DList>().seqno());
|
||||||
REQUIRE(info.size() >= sizeof(DList));
|
REQUIRE(info.size() >= sizeof(DList));
|
||||||
REQUIRE(info.size() < sizeof(DList) + padding::c_alloc_alignment);
|
REQUIRE(info.size() < sizeof(DList) + padding::c_alloc_alignment);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* no GC roots, so GC is trivial */
|
/* no GC roots, so GC is trivial */
|
||||||
c_o.request_gc(generation{1});
|
c_o.request_gc(generation{1});
|
||||||
|
|
||||||
|
|
||||||
} catch (std::exception & ex) {
|
} catch (std::exception & ex) {
|
||||||
std::cerr << "caught exception: " << ex.what() << std::endl;
|
std::cerr << "caught exception: " << ex.what() << std::endl;
|
||||||
REQUIRE(false);
|
REQUIRE(false);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue