Back to index

lightning-sunbird  0.9+nobinonly
Functions | Variables
prgcapi.c File Reference
#include <stdarg.h>
#include <string.h>
#include <stdio.h>
#include "prenv.h"
#include "prmem.h"
#include "prmon.h"
#include "prlog.h"
#include "prthread.h"
#include "private/pprthred.h"
#include "gcint.h"

Go to the source code of this file.

Functions

static PRStatus PR_CALLBACK pr_ScanOneThread (PRThread *t, void **addr, PRUword count, void *closure)
static void PR_CALLBACK ScanThreads (void *arg)
 PR_IMPLEMENT (GCInfo *)
 PR_IMPLEMENT (PRInt32)
 PR_IMPLEMENT (PRStatus)
 PR_IMPLEMENT (void)
void _PR_InitGC (PRWord flags)
void pr_FinalizeOnExit (void)
 PR_ShutdownGC (PRBool finalizeOnExit)

Variables

RootFinder * _pr_rootFinders
CollectorType_pr_collectorTypes
GCInfo _pr_gcData
GCBeginGCHook_pr_beginGCHook
void_pr_beginGCHookArg
GCBeginGCHook_pr_endGCHook
void_pr_endGCHookArg
GCBeginFinalizeHook_pr_beginFinalizeHook
void_pr_beginFinalizeHookArg
GCBeginFinalizeHook_pr_endFinalizeHook
void_pr_endFinalizeHookArg
FILE_pr_dump_file
int _pr_do_a_dump
GCLockHook_pr_GCLockHook
PRLogModuleInfo_pr_msgc_lm

Function Documentation

void _PR_InitGC ( PRWord  flags)

Definition at line 297 of file prgcapi.c.

{
    static char firstTime = 1;

    if (!firstTime) return;
    firstTime = 0;

    _MD_InitGC();

    if (flags == 0) {
       char *ev = PR_GetEnv("GCLOG");
       if (ev && ev[0]) {
           flags = atoi(ev);
       }
    }
    _pr_gcData.flags = flags;

    _pr_gcData.lock = PR_NewMonitor();

    _pr_collectorTypes = (CollectorType*) PR_CALLOC(256 * sizeof(CollectorType));

    PR_RegisterRootFinder(ScanThreads, "scan threads", 0);
    PR_RegisterRootFinder(_PR_ScanFinalQueue, "scan final queue", 0);
}

Here is the call graph for this function:

Definition at line 1472 of file prmsgc.c.

{
#ifdef DEBUG_warren
    OutputDebugString("### Doing finalize-on-exit pass\n");
#endif
    PR_ForceFinalize();
#ifdef DEBUG_warren
    OutputDebugString("### Finalize-on-exit complete. Dumping object left to memory.out\n");
    PR_DumpMemorySummary();
    PR_DumpMemory(PR_TRUE);
#endif
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 106 of file prgcapi.c.

{
    return &_pr_gcData;
}
PR_IMPLEMENT ( PRInt32  long)

Definition at line 112 of file prgcapi.c.

{
    CollectorType *ct, *ect;
    int rv = -1;

    LOCK_GC();
    ct = &_pr_collectorTypes[0];
    ect = &_pr_collectorTypes[FREE_MEMORY_TYPEIX];
    for (; ct < ect; ct++) {
       if (ct->flags == 0) {
           ct->gctype = *t;
           ct->flags = _GC_TYPE_BUSY;
           if (0 != ct->gctype.finalize) {
              ct->flags |= _GC_TYPE_FINAL;
           }
           if (0 != ct->gctype.getWeakLinkOffset) {
              ct->flags |= _GC_TYPE_WEAK;
           }
           rv = ct - &_pr_collectorTypes[0];
           break;
       }
    }
    UNLOCK_GC();
    return rv;
}

Definition at line 138 of file prgcapi.c.

{
    RootFinder *rf = PR_NEWZAP(RootFinder);
    if (rf) {
           rf->func = f;
           rf->name = name;
           rf->arg = arg;

           LOCK_GC();
           rf->next = _pr_rootFinders;
           _pr_rootFinders = rf;
           UNLOCK_GC();
           return PR_SUCCESS;
    }
    return PR_FAILURE;
}

Definition at line 204 of file prgcapi.c.

static PRStatus PR_CALLBACK pr_ScanOneThread ( PRThread t,
void **  addr,
PRUword  count,
void closure 
) [static]

Definition at line 83 of file prgcapi.c.

{
#if defined(XP_MAC)
#pragma unused (t, closure)
#endif

    _pr_gcData.processRootBlock(addr, count);
    return PR_SUCCESS;
}

Here is the caller graph for this function:

PR_ShutdownGC ( PRBool  finalizeOnExit)

Definition at line 331 of file prgcapi.c.

{
    /* first finalize all the objects in the heap */
    if (finalizeOnExit) {
        pr_FinalizeOnExit();
    }

#ifdef DEBUG
#ifdef GC_STATS
    PR_PrintGCAllocStats();
#endif /* GC_STATS */
#endif /* DEBUG */

    /* then the chance for any future allocations */

    /* finally delete the gc heap */

    /* write me */
}

Here is the call graph for this function:

static void PR_CALLBACK ScanThreads ( void arg) [static]

Definition at line 99 of file prgcapi.c.

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Definition at line 69 of file prgcapi.c.

Definition at line 70 of file prgcapi.c.

Definition at line 64 of file prgcapi.c.

Definition at line 65 of file prgcapi.c.

Definition at line 59 of file prgcapi.c.

Definition at line 75 of file prgcapi.c.

Definition at line 74 of file prgcapi.c.

Definition at line 71 of file prgcapi.c.

Definition at line 72 of file prgcapi.c.

Definition at line 66 of file prgcapi.c.

Definition at line 67 of file prgcapi.c.

Definition at line 62 of file prgcapi.c.

Definition at line 76 of file prgcapi.c.

Definition at line 78 of file prmsgc.c.

RootFinder* _pr_rootFinders

Definition at line 57 of file prgcapi.c.