Closed
Bug 105571
Opened 24 years ago
Closed 24 years ago
gc marking forces heavyweight lock creation
Categories
(Core :: JavaScript Engine, defect, P1)
Core
JavaScript Engine
Tracking
()
VERIFIED
FIXED
mozilla0.9.6
People
(Reporter: jband_mozilla, Assigned: brendan)
Details
(Keywords: js1.5)
Attachments
(1 file, 1 obsolete file)
|
2.42 KB,
patch
|
jst
:
review+
jband_mozilla
:
superreview+
|
Details | Diff | Splinter Review |
fun_mark calls JS_GetPrivate which calls js_GetSlotThreadSafe. Even though we
are safely in singlethreaded gc we treat this like any other access. So, if we
are marking a function created on a JSContext other than the one on which gc
occurs then we force the creation of a heavyweight lock for the function object
(and are stuck with it for the duration).
I'm thinking that fun_mark can avoid all the checks and pretty much go straight
to the slot. We know we are serialized thorugh the current thread (though not
actually locked). And we know this is a native object with a private slot.
Right?
| Assignee | ||
Comment 1•24 years ago
|
||
Right, but other JSClass.mark impls would need to go straight to the slot, via
jsobj.h include, and violate the API boundary.
How about we make the public API's slot-getters (JS_GetPrivate, JS_GetPrototype,
JS_GetParent), #ifdef JS_THREADSAFE, go straight to the slot if (rt->gcRunning
&& rt->gcThread == cx->thread)?
/be
Status: NEW → ASSIGNED
| Reporter | ||
Comment 2•24 years ago
|
||
and OBJ_IS_NATIVE or course.
| Assignee | ||
Comment 3•24 years ago
|
||
| Assignee | ||
Updated•24 years ago
|
| Assignee | ||
Updated•24 years ago
|
Attachment #54163 -
Attachment description: proposed fix → retracted, jband pointed out that OBJ_IS_NATIVE should be tested first
Attachment #54163 -
Attachment is obsolete: true
| Assignee | ||
Comment 4•24 years ago
|
||
| Reporter | ||
Comment 5•24 years ago
|
||
Comment on attachment 54167 [details] [diff] [review]
proposed fix
sr=jband
Looks right to me.
You're skipping the OBJ_CHECK_SLOT. Are we going to just trust that
on one misuses this macro in the future?
I'm doing a Quantify run now. I'll post results.
Attachment #54167 -
Flags: superreview+
| Reporter | ||
Comment 6•24 years ago
|
||
I ran it. Nothing bad happened. I opened the browser, went to one page, closed
the browser.
With and without this patch there are about 60 calls to fun_mark.
Without the patch there are a total of 26k calls to js_GetSlotThreadSafe.
With the patch there are a total of only 255 calls to js_GetSlotThreadSafe.
Total PR_Lock (and PR_Unlock) call count goes down from 126K to 111K.
Very cool.
| Assignee | ||
Comment 7•24 years ago
|
||
Macro is local to jsapi.c -- if you're hacking there, you are trusted. Ok, who
will r= the patch?
/be
Comment 8•24 years ago
|
||
Comment on attachment 54167 [details] [diff] [review]
proposed fix
r=jst, looks right to me.
Attachment #54167 -
Flags: review+
| Assignee | ||
Comment 9•24 years ago
|
||
Fixed, thanks!
/be
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Updated•20 years ago
|
Flags: testcase-
You need to log in
before you can comment on or make changes to this bug.
Description
•