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)

x86
macOS
defect
Not set
normal

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)

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.
Attachment #420153 - Attachment is patch: true
Attachment #420153 - Attachment mime type: application/octet-stream → text/plain
I take it the "0 &&" in Assembler.cpp is just an accidental inclusion?
(In reply to comment #1) > I take it the "0 &&" in Assembler.cpp is just an accidental inclusion? correct.
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
Attached patch Patch v3, further cleanup (obsolete) — Splinter Review
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)
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?
(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.
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+
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-
(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?
Attachment #420385 - Flags: review?(graydon)
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 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 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 on attachment 420385 [details] [diff] [review] Modify nanojit::live, expose ReverseLister, add some options to VerboseWriter http://hg.mozilla.org/tamarin-redux/rev/86bef836634d
Whiteboard: fixed-in-nanojit
Attachment #420589 - Flags: review?(edwsmith) → review+
Whiteboard: fixed-in-nanojit → fixed-in-nanojit, fixed-in-tamarin
Depends on: 538635
Whiteboard: fixed-in-nanojit, fixed-in-tamarin → fixed-in-nanojit, fixed-in-tamarin, fixed-in-tracemonkey
Flags: flashplayer-qrb+
Target Milestone: --- → flash10.1
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Engineering work item. Marking verified fixed.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: