Closed
Bug 538000
Opened 15 years ago
Closed 15 years ago
Generating prolog and method body into different buffers could enable simple expression hoisting
Categories
(Tamarin Graveyard :: Virtual Machine, defect)
Tracking
(Not tracked)
VERIFIED
FIXED
flash10.1
People
(Reporter: edwsmith, Unassigned)
References
Details
(Whiteboard: fixed-in-nanojit, fixed-in-tamarin, fixed-in-tracemonkey)
Attachments
(2 files, 4 obsolete files)
6.97 KB,
patch
|
edwsmith
:
review+
graydon
:
review+
|
Details | Diff | Splinter Review |
23.26 KB,
patch
|
edwsmith
:
review+
|
Details | Diff | Splinter Review |
currently we generate the whole method in one linear pass, into one buffer, then read that one buffer back to generate code.
We could generate concurrently into two bufers (prolog, body), then sequentially read them back. The pipeline nature of code generation should make this relatively simple.
This enables generating expressions like env->vtable, env->vtable->scope, etc, in the prolog, but only once they're found to be needed while generating the body.
Updated•15 years ago
|
Attachment #420153 -
Attachment is patch: true
Attachment #420153 -
Attachment mime type: application/octet-stream → text/plain
Comment 1•15 years ago
|
||
I take it the "0 &&" in Assembler.cpp is just an accidental inclusion?
Reporter | ||
Comment 2•15 years ago
|
||
(In reply to comment #1)
> I take it the "0 &&" in Assembler.cpp is just an accidental inclusion?
correct.
Reporter | ||
Comment 3•15 years ago
|
||
Remaining cleanup: verbose output from the LIR generation pipeline does not show code being emitted to the prolog while we're emitting code into the body. (but it does show the initial prolog code).
needs general inspection of the verbose output for clarity
needs code review to make sure its obvious what is happening
need to refactor nanojit::ReverseLister so we can reuse it instead of copying it into CodegenLIR.cpp (that's a hack!)
Attachment #420153 -
Attachment is obsolete: true
Reporter | ||
Comment 4•15 years ago
|
||
Comment 5•15 years ago
|
||
Cleaned up a bit further. Prolog code is now output inline with a prefix (but not distinguished in final listing).
Attachment #420364 -
Attachment is obsolete: true
Attachment #420384 -
Flags: review?(edwsmith)
Comment 6•15 years ago
|
||
Attachment #420368 -
Attachment is obsolete: true
Attachment #420385 -
Flags: review?(edwsmith)
Comment 7•15 years ago
|
||
Is this going to be our general approach to handling code movement and more general basic blocks optimization? That is, putting code is different buffers?
If so, them maybe we should look at writing the code in a more general fashion, not specific for prologue. For example, use an array of LirBuffs (in this case we're using 2).
Also, previously our buffers have been self-contained. In this case, we now have references from one buffer to another. Should we have a data structure which represents this fact?
Reporter | ||
Comment 8•15 years ago
|
||
(In reply to comment #7)
> Is this going to be our general approach to handling code movement and more
> general basic blocks optimization? That is, putting code is different
> buffers?
I hope not; LirBuffers are just meant to capture the output of a LirWriter pipline (a linear stream of instructions).
> If so, them maybe we should look at writing the code in a more general fashion,
> not specific for prologue. For example, use an array of LirBuffs (in this case
> we're using 2).
>
> Also, previously our buffers have been self-contained. In this case, we now
> have references from one buffer to another. Should we have a data structure
> which represents this fact?
nanojit has always supported refs from one buffer to another; trace tree branches worked that way. For example, expressions in a branch can point to expressions in the trunk.
Maybe the container-for-multiple-lirbufs is Fragment, but IMO its premature to stuff what we're doing into Fragment. I'm happy with a point solution for now.
Reporter | ||
Comment 9•15 years ago
|
||
Comment on attachment 420385 [details] [diff] [review]
Modify nanojit::live, expose ReverseLister, add some options to VerboseWriter
note the comment on ReverseLister was slightly incorrect before, and now: the listing is printed when finish() is called, not when ReverseLister is destructed.
Attachment #420385 -
Flags: review?(edwsmith) → review+
Reporter | ||
Comment 10•15 years ago
|
||
Comment on attachment 420384 [details] [diff] [review]
Patch v3, further cleanup
generally it's okay but it looks like something has gone haywire with specially assigned expression names. e.g. the LIR_alloc called "vars" is now showing as "ialloc2".
The intention was for all names of all expressions to be attached to frag->lirbuf->names, which is what everyone uses for verbose output. (probably, LirNameMap doesn't belong on LirBuffer, but its harmless that way).
Attachment #420384 -
Flags: review?(edwsmith) → review-
Comment 11•15 years ago
|
||
(In reply to comment #9)
> (From update of attachment 420385 [details] [diff] [review])
> note the comment on ReverseLister was slightly incorrect before, and now: the
> listing is printed when finish() is called, not when ReverseLister is
> destructed.
Solved easily enough. Does this need a Mozilla reviewer or think it's ok to push as-is?
Updated•15 years ago
|
Attachment #420385 -
Flags: review?(graydon)
Comment 12•15 years ago
|
||
Fixes the verbose problems Edwin saw:
-- uses a single LirNameMap for both prolog and body
-- don't use always_flush, instead, explicitly call flush() after writing to prolog out-of-order
-- add names to map for env_scope (etc) for cleaner output
Attachment #420384 -
Attachment is obsolete: true
Attachment #420589 -
Flags: review?(edwsmith)
Comment 13•15 years ago
|
||
Comment on attachment 420385 [details] [diff] [review]
Modify nanojit::live, expose ReverseLister, add some options to VerboseWriter
Doesn't look too scary. The latter patch is a little more so though!
Attachment #420385 -
Flags: review?(graydon) → review+
Comment 14•15 years ago
|
||
Comment on attachment 420385 [details] [diff] [review]
Modify nanojit::live, expose ReverseLister, add some options to VerboseWriter
nj: http://hg.mozilla.org/projects/nanojit-central/rev/e5ef97918b79
Comment 15•15 years ago
|
||
Comment on attachment 420385 [details] [diff] [review]
Modify nanojit::live, expose ReverseLister, add some options to VerboseWriter
http://hg.mozilla.org/tamarin-redux/rev/86bef836634d
Updated•15 years ago
|
Whiteboard: fixed-in-nanojit
Reporter | ||
Updated•15 years ago
|
Attachment #420589 -
Flags: review?(edwsmith) → review+
Comment 16•15 years ago
|
||
Comment on attachment 420589 [details] [diff] [review]
Patch v4, further cleanup
http://hg.mozilla.org/tamarin-redux/rev/2563f2ac8987
Updated•15 years ago
|
Whiteboard: fixed-in-nanojit → fixed-in-nanojit, fixed-in-tamarin
Comment 17•15 years ago
|
||
Whiteboard: fixed-in-nanojit, fixed-in-tamarin → fixed-in-nanojit, fixed-in-tamarin, fixed-in-tracemonkey
Comment 18•15 years ago
|
||
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•