Closed Bug 536098 Opened 15 years ago Closed 15 years ago

nanojit: speed up intersectRegisterState()

Categories

(Core Graveyard :: Nanojit, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

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

References

Details

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

Attachments

(1 file)

Attached patch patchSplinter Review
This patch tweaks intersectRegisterState() and (less importantly)
unionRegisterState():

- Instead of looping over all registers once and then again, it loops over
  them all once and then only the necessary ones the second time around.  It
  does this by recording them in an array (previously we recorded the ones
  to skip in a bitmask).  This reduces the number of iterations in the
  second loop and also avoids some unpredictable branches.

- In intersectRegisterState() it replaces calls to findSpecificRegFor() with
  the faster findSpecificRegForUnallocated().  (This wasn't applicable in
  unionRegisterState().)  To do this required inlining assignSaved().

- It avoids printing extraneous whitespace for the union case when dumping
  assembly code.

- It clarifies their top-level comments slightly and improves their formatting.

This reduces by almost 1% the number of instructions executed in SunSpider
on X64, and I'm seeing a 6--8ms SunSpider speedup on X64 and about 3ms on i386.
Attachment #418579 - Flags: review?(edwsmith)
Comment on attachment 418579 [details] [diff] [review]
patch

I was trying to unify union and intersect using a template function and traits. Never really looked pretty though.
Attachment #418579 - Flags: review?(edwsmith) → review+
http://hg.mozilla.org/projects/nanojit-central/rev/12013e9b8fab

I changed the findSpecificRegForUnallocated() back to findSpecificRegFor()... even though it seemed to work, my prior reasoning on why it was ok was faulty and I couldn't convince myself that it would always be safe.  This negated much of the speedup, unfortunately, but it's still a clean-up.
Whiteboard: fixed-in-nanojit
http://hg.mozilla.org/tracemonkey/rev/3dc6545d0128
Whiteboard: fixed-in-nanojit → fixed-in-nanojit, fixed-in-tracemonkey
http://hg.mozilla.org/mozilla-central/rev/3dc6545d0128
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: