Closed Bug 513787 Opened 15 years ago Closed 15 years ago

TM: Don't restore FP twice when exiting a fragment [nanojit]

Categories

(Core :: JavaScript Engine, defect, P2)

x86
macOS
defect

Tracking

()

RESOLVED FIXED
Tracking Status
status1.9.2 --- beta1-fixed

People

(Reporter: gal, Assigned: gal)

References

Details

(Whiteboard: fixed-in-tracemonkey)

Attachments

(1 file, 2 obsolete files)

We currently jump to a fragment exit block when exiting trace, and then on to an epilogue. The epilogue is shared with fret/ret exits from trace. For the latter the epilogue fixes up SP for us. However, since fragment exits can be patched, they also have to fix up SP, even before hitting the epilogue. So we end up restoring SP twice (not destructive, but pointless).

This patch restores SP always before jumping to the epilogue. Also, each fret/ret gets its own epilogue now. The epilogue is so short, its pointless to jump to it (2 bytes epilogue, 2 bytes to jump on i386). It only makes sense to share epilogues for side exits, since there we need the branch anyway so we can patch it later.
Attached patch patch (obsolete) — Splinter Review
Assignee: general → gal
Attached patch patch (obsolete) — Splinter Review
Attachment #397727 - Attachment is obsolete: true
Summary: TM: Don't restore FP twice when exiting a fragment → TM: Don't restore FP twice when exiting a fragment [nanojit]
Attached patch patchSplinter Review
Attachment #397728 - Attachment is obsolete: true
Attachment #397734 - Flags: review?(florian)
Attachment #397734 - Flags: review?(florian) → review?(rreitmai)
Bug 512839 is about a Valgrind error during TMFLAGS=assembly output that is
directly relevant to this bug.  The problem in that bug is that 'outputAddr' is
initialised after genEpilogue() is called.  With this patch, it looks like
'outputAddr' isn't initialised *at all*.  Probably the best thing to do is
initialise 'outputAddr' in Assembler::Assembler().  Andreas, can you add this? 
(Valgrinding with TMFLAGS=assembly to confirm my hypothesis would be helpful,
too.)

I'll mark this as blocking bug 512839, since this patch will likely end up
fixing it.
Blocks: 512839
Blocks: 473494
Attachment #397734 - Flags: review?(rreitmai) → review+
Pushed along with fix for #4 (thanks nick).

http://hg.mozilla.org/tracemonkey/rev/1e2673d4d208
Whiteboard: fixed-in-tracemonkey
Follow-up fix (missing empty function in ARM backend).

http://hg.mozilla.org/tracemonkey/rev/e8a55ae8fb98
http://hg.mozilla.org/mozilla-central/rev/1e2673d4d208
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Priority: -- → P2
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: