diff options
author | Lars Knoll <lars.knoll@qt.io> | 2017-03-09 10:36:16 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2017-04-07 06:06:17 +0000 |
commit | 589f8a90fa8c158ec97f32d4a9539b47ba8486a2 (patch) | |
tree | a379d6cc9d85b6565d712943d0fcf763466403e0 /src/qml/memory/qv4mmdefs_p.h | |
parent | 1e63f7c4833c19f760f4af0b7650311819d0f2b2 (diff) |
Separate the stack used for GC from the regular JS stack
This is required to be able to implement concurrent or
incremental garbage collection.
Change-Id: Ib3c5eee3779ca2ee08a57cd3961dbcb0537bbb54
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/memory/qv4mmdefs_p.h')
-rw-r--r-- | src/qml/memory/qv4mmdefs_p.h | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/qml/memory/qv4mmdefs_p.h b/src/qml/memory/qv4mmdefs_p.h index 1fc7b6a527..9512722782 100644 --- a/src/qml/memory/qv4mmdefs_p.h +++ b/src/qml/memory/qv4mmdefs_p.h @@ -59,6 +59,8 @@ QT_BEGIN_NAMESPACE namespace QV4 { +struct MarkStack; + /* * Chunks are the basic structure containing GC managed objects. * @@ -185,7 +187,7 @@ struct Chunk { void sweep(); void freeAll(); void resetBlackBits(); - void collectGrayItems(ExecutionEngine *engine); + void collectGrayItems(QV4::MarkStack *markStack); void sortIntoBins(HeapItem **bins, uint nBins); }; @@ -265,6 +267,24 @@ Q_STATIC_ASSERT(sizeof(HeapItem) == Chunk::SlotSize); Q_STATIC_ASSERT(QT_POINTER_SIZE*8 == Chunk::Bits); Q_STATIC_ASSERT((1 << Chunk::BitShift) == Chunk::Bits); +struct MarkStack {\ + MarkStack(ExecutionEngine *engine); + Heap::Base **top = 0; + Heap::Base **base = 0; + Heap::Base **limit = 0; + ExecutionEngine *engine; + void push(Heap::Base *m) { + *top = m; + ++top; + } + Heap::Base *pop() { + --top; + return *top; + } + void drain(); + +}; + // Base class for the execution engine #if defined(Q_CC_MSVC) || defined(Q_CC_GNU) |