Closed
Bug 723346
Opened 13 years ago
Closed 13 years ago
GC: make sharpObjectMap a modern HashTable
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla13
People
(Reporter: terrence, Assigned: terrence)
References
Details
Attachments
(1 file, 1 obsolete file)
15.96 KB,
patch
|
terrence
:
review+
|
Details | Diff | Splinter Review |
This has the same problem as other places where we have markable, nursery allocable objects as hash table keys: we may need to move them about during GC. We should, at the very least, replace this old table with a new one so that we only have to solve the problems in one place.
Another option here is to rip out the recursive toSource. It's not part of any spec and if it were, it would most likely want to throw on recursion.
Comment 1•13 years ago
|
||
Does sharpObjectMap have anything to do with sharps, which Waldo just removed support for? I looked at the code but am none the wiser.
Comment 2•13 years ago
|
||
Yes, but now it's only used for toSource. (It might as well be renamed at the same time.)
Assignee | ||
Comment 3•13 years ago
|
||
I ended up doing this in as minimal a fashion as possible. It turns out that this code path relies on at least 4 different bools, an int, and a pointer treated as a bool. I printed these out for examples in the test suite and it seems that they all do have different, specific purposes.
AFAICT the relationship looks roughly like:
hasGen = !hasGen && !isSharp
alreadySeen = hasGen || isSharp
ida = map->depth == 0 && !isSharp
isSharp = alreadySeen && ida
++map->depth when !isSharp
--map->depth unconditionally (not sure how this works, but I added asserts)
I'm fairly certain this could be untwisted further, but it's beyond the scope of this bug.
Comment 4•13 years ago
|
||
Comment on attachment 595607 [details] [diff] [review]
V1: minimal
Review of attachment 595607 [details] [diff] [review]:
-----------------------------------------------------------------
I don't have much confidence in my review of this, but it looks like it's the right translation. I think. Keep an eye out for regressions, and sic the fuzzers on this if you can.
::: js/src/jsobj.cpp
@@ +358,5 @@
>
> if (idap)
> *idap = ida;
> + if (isSharp)
> + *isSharp = sharpid.isSharp;
I don't believe it's the case that |isSharp| can ever be NULL -- just do this assignment unconditionally.
@@ +416,5 @@
> * to justify spending efforts.
> */
> + for (JSSharpTable::Range r = map->table.all(); !r.empty(); r.popFront()) {
> + MarkRoot(trc, r.front().key, "sharp table entry");
> + }
Don't brace this single-line body.
@@ +446,5 @@
> JSIdArray *ida;
> bool alreadySeen = false;
> + bool isSharp = false;
> + bool success = js_EnterSharpObject(cx, obj, &ida, &alreadySeen, &isSharp);
> + if (!success)
Eliminate the unnecessary |bool success| temporary here.
@@ +466,5 @@
> + JS_ASSERT(!isSharp);
> + if (alreadySeen) {
> + JSSharpTable::Ptr p = cx->sharpObjectMap.table.lookup(obj);
> + JS_ASSERT(p);
> + JS_ASSERT(p->value.isSharp == isSharp);
Make that |!p->value.isSharp|.
Attachment #595607 -
Flags: review?(jwalden+bmo) → review+
Assignee | ||
Comment 5•13 years ago
|
||
Attachment #595607 -
Attachment is obsolete: true
Attachment #597916 -
Flags: review+
Assignee | ||
Comment 6•13 years ago
|
||
Gary, would it be possible to get some fuzzing on Object.toSource and Array.toSource with this patch applied?
Comment 7•13 years ago
|
||
> Gary, would it be possible to get some fuzzing on Object.toSource and
> Array.toSource with this patch applied?
Sure - Christian might be interested too. :)
Comment 8•13 years ago
|
||
> Gary, would it be possible to get some fuzzing on Object.toSource and
> Array.toSource with this patch applied?
This seems to hold up well after an hour or two's worth of fuzzing, in other words the patch didn't blow up the fuzzer.
Assignee | ||
Comment 9•13 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/8ae2b959b51d
Thanks for the fuzzing!
Comment 10•13 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla13
You need to log in
before you can comment on or make changes to this bug.
Description
•