Closed Bug 463531 Opened 17 years ago Closed 14 years ago

Need loop header instruction for hoisting

Categories

(Core :: JavaScript Engine, enhancement)

x86
All
enhancement
Not set
normal

Tracking

()

RESOLVED WONTFIX
mozilla1.9.1

People

(Reporter: robarnold, Assigned: gal)

References

Details

Attachments

(3 files, 4 obsolete files)

For future optimizations, it would be nice and efficient to perform or hoist some computations outside of the traced loop. We should generate a LIR_header instruction to mark the beginning of the loop.
Attached patch v1 (obsolete) — — Splinter Review
Assignee: general → gal
Attached patch v2, tested (obsolete) — — Splinter Review
Attachment #346788 - Attachment is obsolete: true
Attachment #346790 - Flags: review?(danderson)
Attachment #346790 - Attachment is patch: true
Attachment #346790 - Attachment mime type: application/octet-stream → text/plain
Attachment #346790 - Flags: review?(danderson) → review+
This doesn't seem to affect the native code generated.
Its not supposed to, except that instructions emitted between LIR_header and LIR_start will be above the loop header (which is LIR_header).
When I hoist state above LIR_header, I get crashes on the 2nd iteration because it doesn't get properly unspilled on the loop edge.
Can you attach a short patch that emits code in between the way you want it emitted? I will debug it a bit.
Attached file Patch queue bundle —
Here's the bundle of my repo
should we introduce a new LIR structure, similar to VMSideExit, for labels? if each label could have its own structure, then they could be distinguished, and we might not need special LIR_header instruction? on the other hand if we have the opcodes, checking ins->opcode() can be easier than peeking into some struct. depends on how/where it's used.
Any progress on this Andreas?
Severity: normal → enhancement
Attached patch refresh (obsolete) — — Splinter Review
Attachment #346790 - Attachment is obsolete: true
Attachment #349316 - Attachment is obsolete: true
Attachment #349318 - Flags: review?(tellrob)
Attachment #349318 - Flags: review?(tellrob) → review+
The problem with the previous patch is that (aside from LIR_header actually doing the same thing as LIR_start), is that stack slots can be re-used across the loop and hoisted spills get clobbered. A _really, really_ hacky fix for this was to look for live spills at the loop header, and if they've been used more than once, to reserve pinned stack space. If there was an easy way to tell whether an LIns* was between LIR_start and LIR_header then this wouldn't be necessary. Possibly something like TM's tracker would work. There is still a problem in that you can't use these hoisted instructions on branch traces. We'd need either tree recompilation or some structure capable of recovering or caching the stack slots. In fact, right now, the mere presence of a branch trace might be able to clobber these pinned stack slots, though trace-tests does not trigger this. The junk added in jstracer.cpp is a silly test case.
Whoops, attached was an interdiff - here's a full patch.
Attachment #350890 - Attachment is obsolete: true
Blocks: 469689
Don't know the status of this but LIR_header and LIR_label seem pretty similar; what are the important differences?
These bugs are all part of a search I made for js bugs that are getting lost in transit: http://tinyurl.com/jsDeadEndBugs They all have a review+'ed, non-obsoleted patch and are not marked fixed-in-tracemonkey or checkin-needed but have not seen any activity in 300 days. Some of these got lost simply because the assignee/patch provider never requested a checkin, or just because they were forgotten about.
Edwin, is this still wanted for Nanojit?
nope, WONTFIX.
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: