17#include <private/qv4global_p.h>
18#include <private/qv4runtimeapi_p.h>
19#include <QtCore/qalgorithms.h>
20#include <QtCore/qmath.h>
67#if QT_POINTER_SIZE == 8
173 T *
as() {
return static_cast<T *
>(
reinterpret_cast<Heap::Base *
>(
this)); }
181 std::ptrdiff_t
index =
this -
c->realBase();
186 std::ptrdiff_t
index =
this -
c->realBase();
193 size_t index =
this -
c->realBase();
205 std::ptrdiff_t
index =
this -
c->realBase();
217 return reinterpret_cast<HeapItem *
>(
this);
239 if (m_top < m_softLimit)
245 if (m_drainRecursion * segmentSize <=
quintptr(m_top - m_softLimit)) {
249 }
else if (m_top == m_hardLimit) {
250 qFatal(
"GC mark stack overrun. Either simplify your application or"
251 "increase QV4_GC_MAX_STACK_SIZE");
255 bool isEmpty()
const {
return m_top == m_base; }
259 return m_softLimit - m_top;
270 Heap::Base **m_top =
nullptr;
271 Heap::Base **m_base =
nullptr;
272 Heap::Base **m_softLimit =
nullptr;
273 Heap::Base **m_hardLimit =
nullptr;
275 ExecutionEngine *m_engine =
nullptr;
283#define HEAP_OBJECT_OFFSET_MEMBER_EXPANSION(c, gcType, type, name) \
284 HEAP_OBJECT_OFFSET_MEMBER_EXPANSION_##gcType(c, type, name)
286#define HEAP_OBJECT_OFFSET_MEMBER_EXPANSION_Pointer(c, type, name) Pointer<type, 0> name;
287#define HEAP_OBJECT_OFFSET_MEMBER_EXPANSION_NoMark(c, type, name) type name;
288#define HEAP_OBJECT_OFFSET_MEMBER_EXPANSION_HeapValue(c, type, name) HeapValue<0> name;
289#define HEAP_OBJECT_OFFSET_MEMBER_EXPANSION_ValueArray(c, type, name) type<0> name;
291#define HEAP_OBJECT_MEMBER_EXPANSION(c, gcType, type, name) \
292 HEAP_OBJECT_MEMBER_EXPANSION_##gcType(c, type, name)
294#define HEAP_OBJECT_MEMBER_EXPANSION_Pointer(c, type, name) \
295 Pointer<type, offsetof(c##OffsetStruct, name) + baseOffset> name;
296#define HEAP_OBJECT_MEMBER_EXPANSION_NoMark(c, type, name) \
298#define HEAP_OBJECT_MEMBER_EXPANSION_HeapValue(c, type, name) \
299 HeapValue<offsetof(c##OffsetStruct, name) + baseOffset> name;
300#define HEAP_OBJECT_MEMBER_EXPANSION_ValueArray(c, type, name) \
301 type<offsetof(c##OffsetStruct, name) + baseOffset> name;
303#define HEAP_OBJECT_MARKOBJECTS_EXPANSION(c, gcType, type, name) \
304 HEAP_OBJECT_MARKOBJECTS_EXPANSION_##gcType(c, type, name)
305#define HEAP_OBJECT_MARKOBJECTS_EXPANSION_Pointer(c, type, name) \
306 if (o->name) o->name.heapObject()->mark(stack);
307#define HEAP_OBJECT_MARKOBJECTS_EXPANSION_NoMark(c, type, name)
308#define HEAP_OBJECT_MARKOBJECTS_EXPANSION_HeapValue(c, type, name) \
310#define HEAP_OBJECT_MARKOBJECTS_EXPANSION_ValueArray(c, type, name) \
314#define DECLARE_HEAP_OBJECT_BASE(name, base) \
315 struct name##OffsetStruct { \
316 name##Members(name, HEAP_OBJECT_OFFSET_MEMBER_EXPANSION) \
318 struct name##SizeStruct : base, name##OffsetStruct {}; \
319 struct name##Data { \
320 typedef base SuperClass; \
321 static constexpr size_t baseOffset = sizeof(name##SizeStruct) - sizeof(name##OffsetStruct); \
322 name##Members(name, HEAP_OBJECT_MEMBER_EXPANSION) \
324 Q_STATIC_ASSERT(sizeof(name##SizeStruct) == sizeof(name##Data) + name##Data::baseOffset); \
326#define DECLARE_HEAP_OBJECT(name, base) \
327 DECLARE_HEAP_OBJECT_BASE(name, base) \
328 struct name : base, name##Data
329#define DECLARE_EXPORTED_HEAP_OBJECT(name, base) \
330 DECLARE_HEAP_OBJECT_BASE(name, base) \
331 struct Q_QML_EXPORT name : base, name##Data
333#define DECLARE_MARKOBJECTS(class) \
334 static void markObjects(Heap::Base *b, MarkStack *stack) { \
335 class *o = static_cast<class *>(b); \
336 class##Data::SuperClass::markObjects(o, stack); \
337 class##Members(class, HEAP_OBJECT_MARKOBJECTS_EXPANSION) \
Combined button and popup list for selecting options.
void(* ClassDestroyStatsCallback)(const char *)
constexpr uint qCountTrailingZeroBits(quint32 v) noexcept
Q_DECL_CONST_FUNCTION QT_POPCOUNT_CONSTEXPR uint qPopulationCount(quint32 v) noexcept
#define Q_STATIC_ASSERT(Condition)
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char return DBusMessage return DBusMessage const char return DBusMessage dbus_bool_t return DBusMessage dbus_uint32_t return DBusMessage void
constexpr quint32 qNextPowerOfTwo(quint32 v)
constexpr const T & qMin(const T &a, const T &b)
GLboolean GLboolean GLboolean b
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLint GLint GLint GLint GLint GLint GLint GLbitfield mask
GLsizei GLfixed GLfixed GLfixed GLfixed const GLubyte * bitmap
unsigned long long quint64
QDeadlineTimer deadline(30s)
quintptr objectBitmap[BitmapSize/sizeof(quintptr)]
static void setBit(quintptr *bitmap, size_t index)
char data[ChunkSize - HeaderSize]
static uint lowestNonZeroBit(quintptr *bitmap)
static bool hasNonZeroBit(quintptr *bitmap)
static bool testBit(quintptr *bitmap, size_t index)
static Q_ALWAYS_INLINE quintptr bitForIndex(size_t index)
void freeAll(ExecutionEngine *engine)
quintptr extendsBitmap[BitmapSize/sizeof(quintptr)]
void sortIntoBins(HeapItem **bins, uint nBins)
static Q_ALWAYS_INLINE size_t bitmapIndex(size_t index)
static void setBits(quintptr *bitmap, size_t index, size_t nBits)
quintptr blackBitmap[BitmapSize/sizeof(quintptr)]
static void clearBit(quintptr *bitmap, size_t index)
bool sweep(ClassDestroyStatsCallback classCountPtr)
quint64 payload[Chunk::SlotSize/sizeof(quint64)]
struct QV4::HeapItem::@639::@641 freeData
void setAllocatedSlots(size_t nSlots)
qptrdiff remainingBeforeSoftLimit() const
ExecutionEngine * engine() const