Compare commits

..

4 Commits

Author SHA1 Message Date
andrew b2ce851d56 Update corpus 2024-06-15 22:16:52 -07:00
andrew e11ee26332 Allow stack to grow in gc
The previous bound was valid in each logical version of the map, but not
for the physical map's structure.
2024-06-15 20:28:43 -07:00
andrew 0af75f5e9c Make gRandom inline
I have no idea why I made it static
2024-06-15 20:18:08 -07:00
andrew 43ba21329b Mark remainder of rightmost page no_access after gc 2024-06-15 18:11:18 -07:00
329 changed files with 19 additions and 10 deletions
+1 -1
View File
@@ -393,7 +393,7 @@ inline Random seededRandom() {
return Random{seed[0], seed[1]}; return Random{seed[0], seed[1]};
} }
static thread_local Random gRandom = seededRandom(); inline thread_local Random gRandom = seededRandom();
// ==================== END RANDOM IMPL ==================== // ==================== END RANDOM IMPL ====================
+14 -4
View File
@@ -285,9 +285,11 @@ struct MemManager {
void gc(const uint32_t *roots, int numRoots, int64_t oldestVersion) { void gc(const uint32_t *roots, int numRoots, int64_t oldestVersion) {
// Calculate reachable set // Calculate reachable set
BitSet reachable{next}; BitSet reachable{next};
// Each node has at most 3 children and nodes along the search path aren't Arena arena;
// in the stack, so we need 2 * kPathLengthUpperBound constexpr int kInitialStackCapacity = 128;
uint32_t stack[2 * kPathLengthUpperBound]; int64_t stackCapacity = kInitialStackCapacity;
uint32_t stackStack[kInitialStackCapacity];
uint32_t *stack = stackStack;
int stackIndex = 0; int stackIndex = 0;
auto tryPush = [&]([[maybe_unused]] uint32_t parent, uint32_t child) { auto tryPush = [&]([[maybe_unused]] uint32_t parent, uint32_t child) {
if (!reachable.set(child)) { if (!reachable.set(child)) {
@@ -296,7 +298,12 @@ struct MemManager {
printf(" GC: reach: %u (parent %u)\n", child, parent); printf(" GC: reach: %u (parent %u)\n", child, parent);
} }
#endif #endif
assert(stackIndex < int(sizeof(stack) / sizeof(stack[0]))); if (stackIndex == stackCapacity) [[unlikely]] {
auto *old = stack;
stackCapacity *= 2;
stack = new (arena) uint32_t[stackCapacity];
memcpy(stack, old, stackIndex * sizeof(stack[0]));
}
stack[stackIndex++] = child; stack[stackIndex++] = child;
} }
}; };
@@ -378,6 +385,9 @@ struct MemManager {
#endif #endif
} }
next = max + 1; next = max + 1;
assert(firstUnaddressable >= next);
VALGRIND_MAKE_MEM_NOACCESS(base + next,
(firstUnaddressable - next) * sizeof(Node));
} }
int64_t getBytes() const { int64_t getBytes() const {
Binary file not shown.
@@ -1,2 +0,0 @@
~0忖
, zzzz zzz zz汉汉€zz zzNz zzzz zzz zzz S堜渲s 5[谠垐垐垐垐垐垐垐垐牋牋牋鞝牋牋牋牋牋垐垐垐垐垐垐垐垐垐垐垐垐垐垐垐垐垐垐垐垐垐垐垐垐垐垐垐垐垐垐垐垐垐垐垐垐垐垐垐
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,2 +0,0 @@
DDDDDDDDDDD
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More