MCPcopy Create free account
hub / github.com/ReadyTalk/avian / postCollect

Function postCollect

src/machine.cpp:666–702  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

664}
665
666void postCollect(Thread* t)
667{
668#ifdef VM_STRESS
669 t->m->heap->free(t->defaultHeap, ThreadHeapSizeInBytes);
670 t->defaultHeap
671 = static_cast<uintptr_t*>(t->m->heap->allocate(ThreadHeapSizeInBytes));
672 memset(t->defaultHeap, 0, ThreadHeapSizeInBytes);
673#endif
674
675 if (t->heap == t->defaultHeap) {
676 memset(t->defaultHeap, 0, t->heapIndex * BytesPerWord);
677 } else {
678 memset(t->defaultHeap, 0, ThreadHeapSizeInBytes);
679 t->heap = t->defaultHeap;
680 }
681
682 t->heapOffset = 0;
683
684 if (t->m->heap->limitExceeded()) {
685 // if we're out of memory, pretend the thread-local heap is
686 // already full so we don't make things worse:
687 t->heapIndex = ThreadHeapSizeInWords;
688 } else {
689 t->heapIndex = 0;
690 }
691
692 if (t->getFlags() & Thread::UseBackupHeapFlag) {
693 memset(t->backupHeap, 0, ThreadBackupHeapSizeInBytes);
694
695 t->clearFlag(Thread::UseBackupHeapFlag);
696 t->backupHeapIndex = 0;
697 }
698
699 for (Thread* c = t->child; c; c = c->peer) {
700 postCollect(c);
701 }
702}
703
704uint64_t invoke(Thread* t, uintptr_t* arguments)
705{

Callers 1

doCollectFunction · 0.85

Calls 5

limitExceededMethod · 0.80
getFlagsMethod · 0.80
clearFlagMethod · 0.80
allocateMethod · 0.65
freeMethod · 0.45

Tested by

no test coverage detected