Closed Bug 520590 Opened 16 years ago Closed 16 years ago

TM: RecordLoopEdge mis-aborts on inner tree

Categories

(Core :: JavaScript Engine, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: luke, Assigned: luke)

Details

(Whiteboard: fixed-in-tracemonkey)

Attachments

(1 file, 1 obsolete file)

RecordLoopEdge, which is called when an inner loop edge is encountered, will abort if the inner loop is encountered for the first time, and for the wrong reason: js> for (var i=0; i<10; ++i) { if (i>=1) for (var k=0; k<10; ++k) {} } Abort recording of tree typein:2@15 at typein:2@32: Loop edge does not return to header. (Here, recording starts when i == 1.) The reason is that "getLoop()" is used to lookup an existing fragment, which does not attempt to create a VMFragment at the (pc,global,shape,argc) key if one does not exist). The fix is to use something like "getAnchor()" that creates a Fragment if one does not already exist. With bug 519567, the outer recorder can be suspended and the inner recorder can begin immediately. This reduces aborts and time spent in the interpreter.
Also TODO on this patch: avoid redundant Fragment lookup via getLoop and getAnchor.
On the one hand, I would say "yay!" and encourage this to proceed. Likewise on the further TODO. In fact, the whole fragment-lookup hash is probably worth replacing with a more reasonable dynamic hashtable. On the other hand, Be Careful Here. Or perhaps Be Careful Accepting Anything I Say On The Matter. Talk to dvander. The logic about validity of knitting trees together -- when you can or should start a new tree, when a treecall is valid or not -- is frequently surprising to me. There are details I fail to recall or comprehend.
(In reply to comment #2) Indeed this bug was preceded by a discussion with David :). I should cc him.
Summary: RecordLoopEdge mis-aborts on inner tree → TM: RecordLoopEdge mis-aborts on inner tree
Attached patch fix (obsolete) — Splinter Review
This patch fixes the bug. Neither getLoop nor getAnchor do quite what is needed. Furthermore, getLoop and getAnchor do redundant computation, so I refactored these functions and their callers a bit. This results in simpler code, but no measurable performance difference on SunSpider or v8.
Assignee: general → lw
Status: NEW → ASSIGNED
Attachment #404922 - Flags: review?(dvander)
Attached patch oops, real oneSplinter Review
Oops, that last one was out of date, and I forgot to mention: - with dmandelin's help, I tweaked trace-test.py to print out the current executing test if trace-tests is interrupted - I found a small bug in CheckGlobalObjectShape where 'false' was returned without resetting the JIT. RecordLoopEdge depends on this. Added explanatory comments.
Attachment #404922 - Attachment is obsolete: true
Attachment #404928 - Flags: review?(dvander)
Attachment #404922 - Flags: review?(dvander)
No longer depends on: 519567
Comment on attachment 404928 [details] [diff] [review] oops, real one Can we rename LookupAddLoop to LookupOrAddLoop? r=me with that.
Attachment #404928 - Flags: review?(dvander) → review+
http://hg.mozilla.org/tracemonkey/rev/ca95f2397bc5 and then http://hg.mozilla.org/tracemonkey/rev/c781672ff5cb because I forgot to include dvander's rename and I'd like to pull in a tiny bugfix I found working on something else.
Whiteboard: fixed-in-tracemonkey
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: