Closed
Bug 379146
Opened 18 years ago
Closed 18 years ago
API to extend the set of roots
Categories
(Core :: JavaScript Engine, enhancement)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
People
(Reporter: igor, Assigned: igor)
References
Details
Attachments
(1 file, 1 obsolete file)
(deleted),
patch
|
brendan
:
review+
|
Details | Diff | Splinter Review |
To fix bug 340212 I suggest to allow for an embedding to define a custom set of roots instead of introducing a new GCCallback code.
This requires to add a single callback to be called from js_TraceRuntime. In the callback the embedding should trace all the roots it stores outside JSRuntime.
Assignee | ||
Comment 1•18 years ago
|
||
The patch just adds a new API,
extern JS_PUBLIC_API(void)
JS_SetExtraRoots(JSRuntime *rt, void *roots, JSTraceDataOp traceOp);
that an embedding can use to register a custom traceable set with the runtime. The API does not return the old value of the callback on the assumption that one does not take alterations to the set of root lightly. If the embedding needs to chain the callbacks, it should do it inside own callback implementation to minimize the chance of errors.
Attachment #263163 -
Flags: review?(brendan)
Comment 2•18 years ago
|
||
Comment on attachment 263163 [details] [diff] [review]
Implementation v1
> JS_PUBLIC_API(void)
>+JS_SetExtraRoots(JSRuntime *rt, void *roots, JSTraceDataOp traceOp)
>+{
>+ rt->extraRoots = roots;
extraRootsData and data for the parameter seem like better names. It's not required that the void * point to an array of jsvals or equivalent.
> /*
>+ * Register externally maintained set of roots. The runtime will invoke
"an" before "externally"
>+ * traceOp passing roots as its data argument and traceOp should call in turn
>+ * JS_CallTracer on each traceable thing in the set.
If the set can be represented arbitrarily, addressed via roots, then s/roots/data/g and adjust the comment accordingly. It does seem that the callback abstracts over storage layout.
>+ void *extraRoots;
>+ JSTraceDataOp extraRootsTraceOp;
Major comment before these two new members? Add at end (excluding trailing #ifdef stuff) just to be nice, or else prefix with gc to match surrounding?
/be
Attachment #263163 -
Flags: review?(brendan) → review+
Assignee | ||
Comment 3•18 years ago
|
||
Here is version to address with better naming and comments to address the nits.
Attachment #263163 -
Attachment is obsolete: true
Attachment #263308 -
Flags: review?(brendan)
Comment 4•18 years ago
|
||
Comment on attachment 263308 [details] [diff] [review]
Implementation v12
Nice, thanks.
/be
Attachment #263308 -
Flags: review?(brendan) → review+
Assignee | ||
Comment 5•18 years ago
|
||
I committed the patch from comment 3 to the trunk:
Waiting for Emacs...Done
Checking in js/src/jsapi.c;
/cvsroot/mozilla/js/src/jsapi.c,v <-- jsapi.c
new revision: 3.318; previous revision: 3.317
done
Checking in js/src/jsapi.h;
/cvsroot/mozilla/js/src/jsapi.h,v <-- jsapi.h
new revision: 3.148; previous revision: 3.147
done
Checking in js/src/jscntxt.h;
/cvsroot/mozilla/js/src/jscntxt.h,v <-- jscntxt.h
new revision: 3.145; previous revision: 3.144
done
Checking in js/src/jsgc.c;
/cvsroot/mozilla/js/src/jsgc.c,v <-- jsgc.c
new revision: 3.216; previous revision: 3.215
done
Checking in js/src/jspubtd.h;
/cvsroot/mozilla/js/src/jspubtd.h,v <-- jspubtd.h
new revision: 3.82; previous revision: 3.81
done
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Updated•18 years ago
|
Flags: in-testsuite-
You need to log in
before you can comment on or make changes to this bug.
Description
•