mirror of
https://github.com/VSadov/Satori.git
synced 2025-06-10 18:11:04 +09:00
Dependent Handles
This commit is contained in:
parent
c038becf1b
commit
766e02e43e
2 changed files with 63 additions and 9 deletions
|
@ -96,26 +96,38 @@ void SatoriRecycler::Collect()
|
||||||
// drain queues
|
// drain queues
|
||||||
DrainMarkQueues();
|
DrainMarkQueues();
|
||||||
|
|
||||||
// mark handles to queues
|
// mark handles
|
||||||
MarkHandles();
|
MarkHandles();
|
||||||
|
|
||||||
while (m_workList->Count() > 0)
|
while (m_workList->Count() > 0)
|
||||||
{
|
{
|
||||||
DrainMarkQueues();
|
DrainMarkQueues();
|
||||||
//mark through cards (could be due to overflow)
|
//TODO: VS clean cards (could be due to overflow)
|
||||||
}
|
}
|
||||||
|
|
||||||
// all marked here
|
// all strongly reachable objects are marked here
|
||||||
|
|
||||||
|
DependentHandlesInitialScan();
|
||||||
|
while (m_workList->Count() > 0)
|
||||||
|
{
|
||||||
|
DrainMarkQueues();
|
||||||
|
//TODO: VS clean cards (could be due to overflow)
|
||||||
|
DependentHandlesRescan();
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: VS
|
|
||||||
// DH initial scan (could be a part of loop above?)
|
|
||||||
// sync
|
// sync
|
||||||
WeakPtrScan(/*isShort*/ true);
|
WeakPtrScan(/*isShort*/ true);
|
||||||
// sync
|
// sync
|
||||||
ScanFinalizables();
|
ScanFinalizables();
|
||||||
DrainMarkQueues();
|
|
||||||
|
|
||||||
// scan DH again (why no sync before?)
|
// TODO: VS why no sync before?
|
||||||
|
while (m_workList->Count() > 0)
|
||||||
|
{
|
||||||
|
DrainMarkQueues();
|
||||||
|
//TODO: VS clean cards (could be due to overflow)
|
||||||
|
DependentHandlesRescan();
|
||||||
|
}
|
||||||
|
|
||||||
// sync
|
// sync
|
||||||
WeakPtrScan(/*isShort*/ false);
|
WeakPtrScan(/*isShort*/ false);
|
||||||
WeakPtrScanBySingleThread();
|
WeakPtrScanBySingleThread();
|
||||||
|
@ -424,7 +436,6 @@ void SatoriRecycler::DrainMarkQueues()
|
||||||
|
|
||||||
void SatoriRecycler::MarkHandles()
|
void SatoriRecycler::MarkHandles()
|
||||||
{
|
{
|
||||||
// mark roots for the current stack
|
|
||||||
ScanContext sc;
|
ScanContext sc;
|
||||||
sc.promotion = TRUE;
|
sc.promotion = TRUE;
|
||||||
sc.thread_number = 0;
|
sc.thread_number = 0;
|
||||||
|
@ -444,7 +455,6 @@ void SatoriRecycler::MarkHandles()
|
||||||
|
|
||||||
void SatoriRecycler::WeakPtrScan(bool isShort)
|
void SatoriRecycler::WeakPtrScan(bool isShort)
|
||||||
{
|
{
|
||||||
// mark roots for the current stack
|
|
||||||
ScanContext sc;
|
ScanContext sc;
|
||||||
sc.promotion = TRUE;
|
sc.promotion = TRUE;
|
||||||
sc.thread_number = 0;
|
sc.thread_number = 0;
|
||||||
|
@ -602,3 +612,44 @@ void SatoriRecycler::ScanFinalizables()
|
||||||
m_workList->Push(c.m_markChunk);
|
m_workList->Push(c.m_markChunk);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SatoriRecycler::DependentHandlesInitialScan()
|
||||||
|
{
|
||||||
|
ScanContext sc;
|
||||||
|
sc.promotion = TRUE;
|
||||||
|
sc.thread_number = 0;
|
||||||
|
|
||||||
|
MarkContext c = MarkContext(this);
|
||||||
|
sc._unused1 = &c;
|
||||||
|
|
||||||
|
// concurrent, per thread/heap
|
||||||
|
// relies on thread_number to select handle buckets and specialcases #0
|
||||||
|
GCScan::GcDhInitialScan(MarkFn, 2, 2, &sc);
|
||||||
|
|
||||||
|
if (c.m_markChunk != nullptr)
|
||||||
|
{
|
||||||
|
m_workList->Push(c.m_markChunk);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SatoriRecycler::DependentHandlesRescan()
|
||||||
|
{
|
||||||
|
ScanContext sc;
|
||||||
|
sc.promotion = TRUE;
|
||||||
|
sc.thread_number = 0;
|
||||||
|
|
||||||
|
MarkContext c = MarkContext(this);
|
||||||
|
sc._unused1 = &c;
|
||||||
|
|
||||||
|
// concurrent, per thread/heap
|
||||||
|
// relies on thread_number to select handle buckets and specialcases #0
|
||||||
|
if (GCScan::GcDhUnpromotedHandlesExist(&sc))
|
||||||
|
{
|
||||||
|
GCScan::GcDhReScan(&sc);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (c.m_markChunk != nullptr)
|
||||||
|
{
|
||||||
|
m_workList->Push(c.m_markChunk);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -67,6 +67,9 @@ private:
|
||||||
void WeakPtrScan(bool isShort);
|
void WeakPtrScan(bool isShort);
|
||||||
void WeakPtrScanBySingleThread();
|
void WeakPtrScanBySingleThread();
|
||||||
void ScanFinalizables();
|
void ScanFinalizables();
|
||||||
|
|
||||||
|
void DependentHandlesInitialScan();
|
||||||
|
void DependentHandlesRescan();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue