Bug 392263: using mmap/VirualAlloc for GC arenas. r=brendan

This commit is contained in:
igor@mir2.org 2007-09-15 10:19:32 -07:00
parent 97105f597d
commit 5855f137e7
7 changed files with 825 additions and 524 deletions

View File

@ -2111,6 +2111,6 @@ js_NewArrayObject(JSContext *cx, jsuint length, jsval *vector)
JS_POP_TEMP_ROOT(cx, &tvr);
/* Set/clear newborn root, in case we lost it. */
cx->weakRoots.newborn[GCX_OBJECT] = (JSGCThing *) obj;
cx->weakRoots.newborn[GCX_OBJECT] = obj;
return obj;
}

View File

@ -171,6 +171,7 @@ struct JSRuntime {
JSContextCallback cxCallback;
/* Garbage collector state, used by jsgc.c. */
JSGCChunkInfo *gcChunkList;
JSGCArenaList gcArenaList[GC_NUM_FREELISTS];
JSDHashTable gcRootsHash;
JSDHashTable *gcLocksHash;
@ -202,9 +203,9 @@ struct JSRuntime {
JSGCThingCallback gcThingCallback;
void *gcThingCallbackClosure;
uint32 gcMallocBytes;
JSGCArena *gcUnscannedArenaStackTop;
JSGCArenaInfo *gcUntracedArenaStackTop;
#ifdef DEBUG
size_t gcUnscannedBagSize;
size_t gcTraceLaterCount;
#endif
/*

View File

@ -1173,8 +1173,7 @@ fun_resolve(JSContext *cx, JSObject *obj, jsval id, uintN flags,
* root until then to protect pval in case it is figuratively
* up in the air, with no strong refs protecting it.
*/
cx->weakRoots.newborn[GCX_OBJECT] =
(JSGCThing *)JSVAL_TO_GCTHING(pval);
cx->weakRoots.newborn[GCX_OBJECT] = JSVAL_TO_GCTHING(pval);
parentProto = JSVAL_TO_OBJECT(pval);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -254,10 +254,11 @@ typedef struct JSGCStats {
uint32 maxdepth; /* maximum mark tail recursion depth */
uint32 cdepth; /* mark recursion depth of C functions */
uint32 maxcdepth; /* maximum mark recursion depth of C functions */
uint32 unscanned; /* mark C stack overflows or number of times
GC things were put in unscanned bag */
uint32 untraced; /* number of times tracing of GC thing's children were
delayed due to a low C stack */
#ifdef DEBUG
uint32 maxunscanned; /* maximum size of unscanned bag */
uint32 maxuntraced;/* maximum number of things with children to trace
later */
#endif
uint32 maxlevel; /* maximum GC nesting (indirect recursion) level */
uint32 poke; /* number of potentially useful GC calls */
@ -276,8 +277,9 @@ js_DumpGCStats(JSRuntime *rt, FILE *fp);
#endif /* JS_GCMETER */
typedef struct JSGCArena JSGCArena;
typedef struct JSGCArenaInfo JSGCArenaInfo;
typedef struct JSGCArenaList JSGCArenaList;
typedef struct JSGCChunkInfo JSGCChunkInfo;
#ifdef JS_GCMETER
typedef struct JSGCArenaStats JSGCArenaStats;
@ -298,25 +300,26 @@ struct JSGCArenaStats {
#endif
struct JSGCArenaList {
JSGCArena *last; /* last allocated GC arena */
uint16 lastLimit; /* end offset of allocated so far things in
the last arena */
uint16 thingSize; /* size of things to allocate on this list */
JSGCThing *freeList; /* list of free GC things */
JSGCArenaInfo *last; /* last allocated GC arena */
uint16 lastCount; /* number of allocated things in the last
arena */
uint16 thingSize; /* size of things to allocate on this list
*/
JSGCThing *freeList; /* list of free GC things */
#ifdef JS_GCMETER
JSGCArenaStats stats;
JSGCArenaStats stats;
#endif
};
struct JSWeakRoots {
/* Most recently created things by type, members of the GC's root set. */
JSGCThing *newborn[GCX_NTYPES];
void *newborn[GCX_NTYPES];
/* Atom root for the last-looked-up atom on this context. */
jsval lastAtom;
jsval lastAtom;
/* Root for the result of the most recent js_InternalInvoke call. */
jsval lastInternalResult;
jsval lastInternalResult;
};
JS_STATIC_ASSERT(JSVAL_NULL == 0);

View File

@ -5291,8 +5291,7 @@ interrupt:
JS_ASSERT(sp - fp->spbase >= 1);
lval = FETCH_OPND(-1);
JS_ASSERT(JSVAL_IS_OBJECT(lval));
cx->weakRoots.newborn[GCX_OBJECT] =
(JSGCThing *)JSVAL_TO_GCTHING(lval);
cx->weakRoots.newborn[GCX_OBJECT] = JSVAL_TO_GCTHING(lval);
END_CASE(JSOP_ENDINIT)
BEGIN_CASE(JSOP_INITPROP)

View File

@ -2540,7 +2540,7 @@ js_NewObject(JSContext *cx, JSClass *clasp, JSObject *proto, JSObject *parent)
out:
JS_POP_TEMP_ROOT(cx, &tvr);
cx->weakRoots.newborn[GCX_OBJECT] = (JSGCThing *) obj;
cx->weakRoots.newborn[GCX_OBJECT] = obj;
return obj;
bad:
@ -4405,8 +4405,7 @@ js_GetClassPrototype(JSContext *cx, JSObject *scope, jsid id,
* instance that delegates to this object, or just query the
* prototype for its class.
*/
cx->weakRoots.newborn[GCX_OBJECT] =
(JSGCThing *)JSVAL_TO_GCTHING(v);
cx->weakRoots.newborn[GCX_OBJECT] = JSVAL_TO_GCTHING(v);
}
}
*protop = JSVAL_IS_OBJECT(v) ? JSVAL_TO_OBJECT(v) : NULL;