Closed Bug 486325 Opened 15 years ago Closed 15 years ago

TraceMonkey: Fixes for patched branches on ARM.

Categories

(Core :: JavaScript Engine, defect)

ARM
All
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: jbramley, Assigned: jbramley)

Details

(Whiteboard: fixed-in-tracemonkey)

Attachments

(1 file, 1 obsolete file)

* For conditional branches where _nSlot and _nIns are not on the same page, a branch is emitted to jump over a literal in the instruction stream. However, the generated branch jumped to the wrong address as the PC on ARM is 8 bytes ahead of the current instruction address.
  - I don't think this code is ever run, but I don't yet understand the code well enough to be sure. If it is run, it will only occur on corner cases, so it will be hard to trigger.

* A check ensured that _nIns and _nSlot are on the same page, but _nIns is pre-decremented before being written to so it will start off on a different page. I have corrected this check.
  - Note that there is some code elsewhere that deliberately wastes a word at the top of the page because something is checking or writing to _nIns before decrementing it. That could be this check, though I haven't yet investigated it and there may be others.

* The branch generation code in B_cond_chk confused me as it isn't clear what the generated instructions were from the source. I added a comment to explain the different types of branch that it can emit, and it makes sense to leave it in the code for others to benefit from, so that is also in my patch.

* If the branch target is passed as 0, the real target is unknown. If _nIns is within 32MB of 0, B_cond_chk would attempt to insert a simple B instruction, and this would fail later when the branch was patched. This doesn't happen for me on Linux, but it is quite possible that it could happen on other platforms.

* I've also added a couple of asserts in case an unsupported (conditional) patching request is made.
Assignee: general → Jacob.Bramley
Attachment #370427 - Attachment filename: yyy → patch
Attachment #370427 - Flags: review?(vladimir)
Status: NEW → ASSIGNED
Attachment #370427 - Attachment is obsolete: true
Attachment #384612 - Flags: review?(vladimir)
Attachment #370427 - Flags: review?(vladimir)
Whiteboard: fixed-in-tracemonkey
http://hg.mozilla.org/mozilla-central/rev/1788ec6fdc1f
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: