Ejemplo n.º 1
0
void dvmHeapFinishMarkStep()
{
    HeapBitmap *markBitmap;
    HeapBitmap objectBitmap;
    GcMarkContext *markContext;

    markContext = &gDvm.gcHeap->markContext;

    /* The sweep step freed every object that appeared in the
     * HeapSource bitmaps that didn't appear in the mark bitmaps.
     * The new state of the HeapSource is exactly the final
     * mark bitmaps, so swap them in.
     *
     * The old bitmaps will be swapped into the context so that
     * we can clean them up.
     */
    dvmHeapSourceReplaceObjectBitmaps(markContext->bitmaps,
            markContext->numBitmaps);

    /* Clean up the old HeapSource bitmaps and anything else associated
     * with the marking process.
     */
    dvmHeapBitmapDeleteList(markContext->bitmaps, markContext->numBitmaps);
    destroyMarkStack(&markContext->stack);

    memset(markContext, 0, sizeof(*markContext));
}
Ejemplo n.º 2
0
/*
 * Initialize the bitmaps in <out> so that they cover the same extent as
 * the corresponding bitmaps in <templates>.
 */
bool
dvmHeapBitmapInitListFromTemplates(HeapBitmap out[], HeapBitmap templates[],
    size_t numBitmaps, const char *name)
{
    size_t i;
    char fullName[PATH_MAX];

    fullName[sizeof(fullName)-1] = '\0';
    for (i = 0; i < numBitmaps; i++) {
        bool ok;

        /* If two ashmem regions have the same name, only one gets
         * the name when looking at the maps.
         */
        snprintf(fullName, sizeof(fullName)-1, "%s/%zd", name, i);
        
        ok = dvmHeapBitmapInitFromTemplate(&out[i], &templates[i], fullName);
        if (!ok) {
            dvmHeapBitmapDeleteList(out, i);
            return false;
        }
    }
    return true;
}