Closed Bug 525379 Opened 15 years ago Closed 15 years ago

nanojit: make the _nIns/_nExitIns swap hack more consistent

Categories

(Core :: JavaScript Engine, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: n.nethercote, Assigned: n.nethercote)

Details

(Whiteboard: fixed-in-nanojit, fixed-in-tamarin, fixed-in-tracemonkey)

Attachments

(1 file, 1 obsolete file)

Attached video WIP patch, only X64 backend done so far (obsolete) —
We generate native code into two places:  the normal code area, and the
exit area.  We have a hack whereby we swap the _nIns and _nExitIns
pointers when we want to write to the exit area;  this means that the code
responsible for codegen need not be parameterised, it can just use _nIns.
But there are some other related values (codeStart/exitStart,
codeEnd/exitEnd, codeBytes/exitBytes) that we don't swap.  This leads to
odd-looking code like this:

  if (_inExit)
      codeAlloc(exitStart, exitEnd, _nIns verbose_only(, exitBytes)); 
  else
      codeAlloc(codeStart, codeEnd, _nIns verbose_only(, codeBytes));

You might expect to see _nExitIns in the first case rather than _nIns, but
_nIns is right because it's been swapped and so is really _nExitIns.

This patch changes things so that all the relevant values get swapped,
which avoids the need for _inExit tests.  The above code then becomes:

  codeAlloc(codeStart, codeEnd, _nIns verbose_only(, codeBytes));

It's mostly a correctness/simplicity patch, but it should also reduce the
number of instructions because there's one less test in the hot path in
underrunProtect().  I don't see any SS changes, but SS is being particularly
noisy for me today and yesterday.
Attached patch patchSplinter Review
All backends done, tested on x86 and x64.  I'll do the others once it's passed review.
Attachment #409245 - Attachment is obsolete: true
Attachment #413264 - Flags: review?(edwsmith)
Attachment #413264 - Flags: review?(edwsmith) → review+
Passed TR's try server:

http://hg.mozilla.org/projects/nanojit-central/rev/bad939491825
Whiteboard: fixed-in-nanojit
pushed to tamarin http://hg.mozilla.org/tamarin-redux/rev/76ccc148ba1d
Whiteboard: fixed-in-nanojit → fixed-in-nanojit, fixed-in-tamarin
http://hg.mozilla.org/tracemonkey/rev/74504312c860
Whiteboard: fixed-in-nanojit, fixed-in-tamarin → fixed-in-nanojit, fixed-in-tamarin, fixed-in-tracemonkey
http://hg.mozilla.org/mozilla-central/rev/74504312c860
Status: ASSIGNED → RESOLVED
Closed: 15 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: