| 1667 | int gGCAssemblyCount = 0; |
| 1668 | |
| 1669 | static void GCObjFree(void* ptr) |
| 1670 | { |
| 1671 | Span* span = TCGetSpanAt(ptr); |
| 1672 | if (span == NULL) |
| 1673 | { |
| 1674 | BF_DBG_FATAL("Bad"); |
| 1675 | tc_free(ptr); |
| 1676 | return; |
| 1677 | } |
| 1678 | |
| 1679 | if (span->sizeclass == 0) |
| 1680 | { |
| 1681 | // Clear out all memory |
| 1682 | intptr pageSize = (intptr)1 << kPageShift; |
| 1683 | int spanSize = pageSize * span->length; |
| 1684 | void* spanStart = (void*)((intptr)span->start << kPageShift); |
| 1685 | memset(spanStart, 0, spanSize); |
| 1686 | tc_free(ptr); |
| 1687 | return; |
| 1688 | } |
| 1689 | |
| 1690 | int size = Static::sizemap()->class_to_size(span->sizeclass); |
| 1691 | int dataOffset = (int)(sizeof(intptr) * 2); |
| 1692 | memset((uint8*)ptr + dataOffset, 0, size - dataOffset); |
| 1693 | |
| 1694 | if (span->freeingObjectsTail == NULL) |
| 1695 | { |
| 1696 | span->freeingObjectsTail = ptr; |
| 1697 | *((intptr*)span->freeingObjectsTail) = 1; |
| 1698 | } |
| 1699 | else |
| 1700 | { |
| 1701 | // Increment pending size |
| 1702 | (*((intptr*)span->freeingObjectsTail))++; |
| 1703 | *(reinterpret_cast<void**>(ptr)) = span->freeingObjects; |
| 1704 | } |
| 1705 | |
| 1706 | span->freeingObjects = ptr; |
| 1707 | } |
| 1708 | |
| 1709 | void BFGC::DoCollect(bool doingFullGC) |
| 1710 | { |
no test coverage detected