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

git-svn-id: svn://10.0.0.236/trunk@236029 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
igor%mir2.org 2007-09-15 15:11:41 +00:00
parent bb041fb3a1
commit af63c70b07
7 changed files with 819 additions and 524 deletions

View File

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

View File

@ -171,6 +171,7 @@ struct JSRuntime {
JSContextCallback cxCallback; JSContextCallback cxCallback;
/* Garbage collector state, used by jsgc.c. */ /* Garbage collector state, used by jsgc.c. */
JSGCChunkInfo *gcChunkList;
JSGCArenaList gcArenaList[GC_NUM_FREELISTS]; JSGCArenaList gcArenaList[GC_NUM_FREELISTS];
JSDHashTable gcRootsHash; JSDHashTable gcRootsHash;
JSDHashTable *gcLocksHash; JSDHashTable *gcLocksHash;
@ -202,9 +203,9 @@ struct JSRuntime {
JSGCThingCallback gcThingCallback; JSGCThingCallback gcThingCallback;
void *gcThingCallbackClosure; void *gcThingCallbackClosure;
uint32 gcMallocBytes; uint32 gcMallocBytes;
JSGCArena *gcUnscannedArenaStackTop; JSGCArenaInfo *gcUntracedArenaStackTop;
#ifdef DEBUG #ifdef DEBUG
size_t gcUnscannedBagSize; size_t gcTraceLaterCount;
#endif #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 * root until then to protect pval in case it is figuratively
* up in the air, with no strong refs protecting it. * up in the air, with no strong refs protecting it.
*/ */
cx->weakRoots.newborn[GCX_OBJECT] = cx->weakRoots.newborn[GCX_OBJECT] = JSVAL_TO_GCTHING(pval);
(JSGCThing *)JSVAL_TO_GCTHING(pval);
parentProto = JSVAL_TO_OBJECT(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 maxdepth; /* maximum mark tail recursion depth */
uint32 cdepth; /* mark recursion depth of C functions */ uint32 cdepth; /* mark recursion depth of C functions */
uint32 maxcdepth; /* maximum 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 uint32 untraced; /* number of times tracing of GC thing's children were
GC things were put in unscanned bag */ delayed due to a low C stack */
#ifdef DEBUG #ifdef DEBUG
uint32 maxunscanned; /* maximum size of unscanned bag */ uint32 maxuntraced;/* maximum number of things with children to trace
later */
#endif #endif
uint32 maxlevel; /* maximum GC nesting (indirect recursion) level */ uint32 maxlevel; /* maximum GC nesting (indirect recursion) level */
uint32 poke; /* number of potentially useful GC calls */ uint32 poke; /* number of potentially useful GC calls */
@ -276,8 +277,9 @@ js_DumpGCStats(JSRuntime *rt, FILE *fp);
#endif /* JS_GCMETER */ #endif /* JS_GCMETER */
typedef struct JSGCArena JSGCArena; typedef struct JSGCArenaInfo JSGCArenaInfo;
typedef struct JSGCArenaList JSGCArenaList; typedef struct JSGCArenaList JSGCArenaList;
typedef struct JSGCChunkInfo JSGCChunkInfo;
#ifdef JS_GCMETER #ifdef JS_GCMETER
typedef struct JSGCArenaStats JSGCArenaStats; typedef struct JSGCArenaStats JSGCArenaStats;
@ -298,25 +300,26 @@ struct JSGCArenaStats {
#endif #endif
struct JSGCArenaList { struct JSGCArenaList {
JSGCArena *last; /* last allocated GC arena */ JSGCArenaInfo *last; /* last allocated GC arena */
uint16 lastLimit; /* end offset of allocated so far things in uint16 lastCount; /* number of allocated things in the last
the last arena */ arena */
uint16 thingSize; /* size of things to allocate on this list */ uint16 thingSize; /* size of things to allocate on this list
JSGCThing *freeList; /* list of free GC things */ */
JSGCThing *freeList; /* list of free GC things */
#ifdef JS_GCMETER #ifdef JS_GCMETER
JSGCArenaStats stats; JSGCArenaStats stats;
#endif #endif
}; };
struct JSWeakRoots { struct JSWeakRoots {
/* Most recently created things by type, members of the GC's root set. */ /* 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. */ /* 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. */ /* Root for the result of the most recent js_InternalInvoke call. */
jsval lastInternalResult; jsval lastInternalResult;
}; };
JS_STATIC_ASSERT(JSVAL_NULL == 0); JS_STATIC_ASSERT(JSVAL_NULL == 0);

View File

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

View File

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