Closed
Bug 706914
Opened 13 years ago
Closed 12 years ago
JM: Compile large scripts in chunks
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
FIXED
mozilla12
People
(Reporter: bhackett1024, Assigned: bhackett1024)
References
(Blocks 1 open bug)
Details
Attachments
(1 file, 6 obsolete files)
233.96 KB,
patch
|
dvander
:
review+
|
Details | Diff | Splinter Review |
There's a longstanding problem with JM+TI (and any engine that combines both whole method compilation and invalidation/recompilation) where too much time is spent compiling large scripts. The amount of time to compile a script is linear in its size (optimistic, but seems to hold in practice) and the number of times a script needs to be recompiled is also expected to be linear in its size, all else being equal. This leads to quadratic behavior which really hurts when dealing with large scripts. This can be helped (not sure if fixed) by not doing whole method compilation, but rather compiling scripts in chunks. Pick an arbitrary partitioning of the script into chunks, only compile one chunk at a time and keep track of cross-chunk edges to fix up after doing a compilation or discarding a chunk due to a recompilation. The attached patch (WIP) does this, still needs more work to not be broken.
Assignee | ||
Comment 1•13 years ago
|
||
Passes jit-tests -mna with a chunk size of 10 ops (for stress testing).
Assignee: general → bhackett1024
Attachment #578331 -
Attachment is obsolete: true
Assignee | ||
Comment 2•13 years ago
|
||
Wrong patch attached earlier.
Attachment #578420 -
Attachment is obsolete: true
Assignee | ||
Comment 3•13 years ago
|
||
Working patch, needs a rebase.
Attachment #578447 -
Attachment is obsolete: true
Assignee | ||
Comment 4•13 years ago
|
||
Patch rebased to tip. The CHUNK_LIMIT environment variable is in place for testing, when this lands it will be hardcoded to something else (like 1000).
Attachment #582350 -
Attachment is obsolete: true
Attachment #582383 -
Flags: review?(dvander)
Assignee | ||
Comment 5•13 years ago
|
||
Decoder, Gary: can you guys fuzz this patch some? It is a significant method JIT change. Beforehand, you should set the CHUNK_LIMIT environment variable to some smallish value, between 5 and 100 say (this controls how scripts are partitioned during compilation). The testing should mainly be done on x86, as this functionality is totally disabled on x64 (for now at least, and possibly for the lifetime of JM). I can also make the chunk limit controllable from the shell with a chunkLimit(N) function if that would make things easier, and will probably take this route anyways when landing the patch.
Assignee | ||
Comment 6•13 years ago
|
||
Rebased, removes CHUNK_LIMIT environment variable and allows the chunk limit to be changed in the shell with mjitChunkLimit(N).
Attachment #582383 -
Attachment is obsolete: true
Attachment #582383 -
Flags: review?(dvander)
Attachment #582860 -
Flags: review?(dvander)
Comment 7•13 years ago
|
||
> least, and possibly for the lifetime of JM). I can also make the chunk
> limit controllable from the shell with a chunkLimit(N) function if that
> would make things easier, and will probably take this route anyways when
> landing the patch.
Adding the chunkLimit(N) function will likely be really useful. :)
Comment 8•13 years ago
|
||
I'm on it, will file bugs blocking this one when I have results.
Assignee | ||
Comment 9•13 years ago
|
||
Updated with fixes for dependent bugs.
Attachment #582860 -
Attachment is obsolete: true
Attachment #582860 -
Flags: review?(dvander)
Attachment #583509 -
Flags: review?(dvander)
Comment 10•13 years ago
|
||
> Created attachment 583509 [details] [diff] [review]
> patch (b121a045b451)
>
> Updated with fixes for dependent bugs.
fwiw, this patch has bitrotted, it would be nice to have a rebase. :)
Comment on attachment 583509 [details] [diff] [review] patch (b121a045b451) Review of attachment 583509 [details] [diff] [review]: ----------------------------------------------------------------- There's not a whole lot I can do to review this patch but I do have one suggestion with regards to IonMonkey compatibility: ::: js/src/jsinfer.h @@ +1125,5 @@ > +struct RecompileInfo > +{ > + JSScript *script; > + bool constructing:1; > + uint32_t chunkIndex:31; It would be much nicer if this structure could be: JSScript *script; jsbytecode *pc; And then have processPendingRecompiles do the work of finding the chunk index in the ctor and non-ctor JITScripts. Currently, IonMonkey doesn't do chunked compilation (and won't in the next few months); doesn't have constructor bifurcation; it might end up having a different chunking approach too. So having a more generic interface would be ideal.
Attachment #583509 -
Flags: review?(dvander) → review+
Assignee | ||
Comment 12•12 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/d0c192e5bd41
Assignee | ||
Comment 13•12 years ago
|
||
Oh, for integrating this into IM, just use constructing == false and chunkIndex == 0. The script/constructing/chunkIndex are just identifiers for a compilation unit, and JM/IM do not track dependencies at such a fine granularity as the pc.
Comment 14•12 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/d0c192e5bd41
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla12
You need to log in
before you can comment on or make changes to this bug.
Description
•