Closed Bug 503990 Opened 16 years ago Closed 15 years ago

nanojit: make isStmt() table-driven

Categories

(Core :: JavaScript Engine, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

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

References

Details

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

Attachments

(1 file, 2 obsolete files)

Attached patch patch (obsolete) — Splinter Review
isStmt() is currently a rat's nest of conditionals. This patch makes it table-driven by adding an extra 'isStmt' field to every opcode in LIRopcode.tbl. It also cleans up the formatting in LIRopcode.tbl a little. I'm seeing a 3--5ms speedup for SunSpider on my Mac with this change. In an earlier version I wasn't seeing any speed-up, but I suspect this change interacts well with the change from bug 496693.
Attachment #388378 - Flags: review?(gal)
Nb: for the review, I'd appreciate it if you could check the isStmt field for all the opcodes extra carefully -- I'm pretty confident I preserved the meaning of isStmt(), but it deserves a very close look.
Comment on attachment 388378 [details] [diff] [review] patch Optional nit: The naming is a bit inconsistent (isStmtArray vs repKind vs insSize). 3-5ms speedup is awesome.
Attachment #388378 - Flags: review?(gal) → review+
(In reply to comment #2) > (From update of attachment 388378 [details] [diff] [review]) > Optional nit: The naming is a bit inconsistent (isStmtArray vs repKind vs > insSize). I can't call it isStmt because there's a function of the same name. I'll add a comment to that effect.
Sigh... after updating to r30233, I get a 2--6ms slowdown. I think this is just noise, that really there's no performance effect, but it's worth doing for the code cleanup.
Whiteboard: fixed-in-tracemonkey
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
patch asserts in debug mode -OPDEF64(ldq, LIR_ld, 1, Ld) // 64-bit (quad) load +OPDEF64(ldq, LIR_ld, 2, Ld, 0) // 64-bit (quad) load operand count changed, hitting an assert this was just merged and will burn any debug tinder boxes
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Attached patch patch that should fix breakage (obsolete) — Splinter Review
This should fix the breakage. I'm not seeing the failure in the shell, though, which is really weird. I haven't tested the fix on a browser yet, I will shortly.
Attachment #388412 - Flags: review?(gal)
Ah, I understand now: it's only occurring for ldc/ldcs/ldcb, which don't get used in trace-tests.js. The operand count is also wrong for ld/ldq/ldqc, but the operand count is never used for those ones. (One of the reasons I don't like the operand count much is that it's never used for many of the opcodes and so many of them could be wrong without consequence.)
Comment on attachment 388412 [details] [diff] [review] patch that should fix breakage I was about to upload the same patch, except that my browser keeps GCing. Another patch is bad too.
Attachment #388412 - Flags: review?(gal) → review+
Is it worth it to add testcases to trace-test.js that exercise those opcodes?
had to back this out for the time being, to sort out some regressions. it can probably go back in shortly.
Whiteboard: fixed-in-tracemonkey
(In reply to comment #12) > Is it worth it to add testcases to trace-test.js that exercise those opcodes? Definitely. But I don't know what those test cases are. Looking at the code they seem to be generated in jsregexp.cpp.
This will conflict horribly with bug 504506, and that one is more important, so I'm marking this as dependent.
Depends on: 504506
The patch is overly conservative for calls -- it assumes all calls are stmts, when some of them (the CSEable ones) are not. Hmm.
This can be done (mostly) via the retType field added by the patch in bug 504507 -- all statements have void return types except for some calls. Preliminary tests indicate a small (eg. 3ms) SunSpider speedup with this change. Also removing the dependency on bug 504506, this one could be done first.
Depends on: 504507
No longer depends on: 504506
Attached patch patch v3Splinter Review
This patch changes isStmt() to use retType[] for all cases except calls. Performance changes are in the noise for SunSpider, but it's fewer instructions, fewer branches, and neater code, which adds up to a win in my books. One side-effect of this is that LIR_file and LIR_line are now considered statements, they previously weren't. I think the old behaviour was a bug, because it meant LIR_file/LIR_line never did anything -- I think those opcodes are broken, they only do something if VTUNE is defined anyway.
Attachment #388378 - Attachment is obsolete: true
Attachment #388412 - Attachment is obsolete: true
Attachment #419051 - Flags: review?(rreitmai)
Comment on attachment 419051 [details] [diff] [review] patch v3 Seems fine and yes I think this fixes a LIR_line and LIR_file bug, they should be treated as statements.
Attachment #419051 - Flags: review?(rreitmai) → review+
Whiteboard: fixed-in-nanojit → fixed-in-nanojit, fixed-in-tracemonkey
Status: REOPENED → RESOLVED
Closed: 16 years ago15 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: