Eagerly avoid compiling try/finally scripts, and inlining try/catch scripts.

RESOLVED DUPLICATE of bug 939614

Status

()

Core
JavaScript Engine: JIT
RESOLVED DUPLICATE of bug 939614
4 years ago
4 years ago

People

(Reporter: djvj, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

4 years ago
Currently, when compiling Ion code, we start compiling the script, and abort if we hit a try/finally.  Likewise, when inlining a script in Ion, we start inlining and abort if we hit a try/catch, since we can't inline try/catch yet.

There are numerous situations where we will start compiling an outer script, and then abort midway through.  This is worse when we start inlining a script, and then abort the entire compilation because we ran into a try/catch in the inlined script.

These cases should be checked eagerly and compilation/inlining disabled.
Bug 939614 part 3 will fix this for the non-inlineable cases, but it would be good to do this for other aborts as well.
(Reporter)

Comment 2

4 years ago
Created attachment 8342626 [details] [diff] [review]
eager-avoid-compiling-try-catch-finally.patch

This was an unexpectedly significant win on octane.  Here are the average octane scores across 20 runs (pre-patch first, post-patch second).

All averaged scores are posted at the end of the comment.  No regressions that I can see, and some improvments.  Here are the improved scores:

Splay: 15614.10
Splay: 16154.00

SplayLatency: 7654.75
SplayLatency: 8543.25

Crypto: 21464.60
Crypto: 21642.25

Gameboy: 30509.85
Gameboy: 30676.35

MandreelLatency: 14208.65
MandreelLatency: 14368.80

PdfJS: 11034.45
PdfJS: 11108.20

Score 13729.75
Score 13895.95

Splay and SplayLatency are the biggest take-homes, with ~500 points gained on Splay and ~900 points gained on SplayLatency.  Overall score improves by about 160 points, or 1.2%.


All averaged scores:

Box2D: 7371.10
Box2D: 7305.70

CodeLoad: 18426.25
CodeLoad: 18405.00

Crypto: 21464.60
Crypto: 21642.25

DeltaBlue: 18182.20
DeltaBlue: 18193.00

EarleyBoyer: 18856.10
EarleyBoyer: 18833.75

Gameboy: 30509.85
Gameboy: 30676.35

Mandreel: 5986.95
Mandreel: 6003.95

MandreelLatency: 14208.65
MandreelLatency: 14368.80

NavierStokes: 25953.40
NavierStokes: 25949.85

PdfJS: 11034.45
PdfJS: 11108.20

RayTrace: 20185.55
RayTrace: 20135.35

RegExp: 1555.55
RegExp: 1572.35

Richards: 21272.20
Richards: 21268.85

Splay: 15614.10
Splay: 16154.00

SplayLatency: 7654.75
SplayLatency: 8543.25

Typescript: 7677.50
Typescript: 7694.05

zlib: 51406.05
zlib: 51437.25

Score 13729.75
Score 13895.95
Attachment #8342626 - Flags: review?(jdemooij)
Comment on attachment 8342626 [details] [diff] [review]
eager-avoid-compiling-try-catch-finally.patch

Review of attachment 8342626 [details] [diff] [review]:
-----------------------------------------------------------------

try-catch and try-finally are two cases that we can't compile or inline, but there are others: Ion also doesn't compile JSOP_ENTERBLOCK for instance and we'll have the same problem there: start a compilation and then find out we have to abort. There's also an abort in jsop_setarg (in some cases) if we are inlining. It'd be nice if we could turn the abort() in IonBuilder::inspectOpcode into a MOZ_ASSUME_UNREACHABLE.

I think the approach in bug 939614 part 3 is simpler: it's trivial for baseline or the bytecode analysis to set script->ion to ION_DISABLED_SCRIPT or script->uninlineable to true, without needing any extra bits/state or checks.
Attachment #8342626 - Flags: review?(jdemooij)
(Reporter)

Comment 4

4 years ago
Fair enough.  Looking forward to that landing.  If these results are any indication, it should have a pretty significant impact on our scores.  I'll mark this bug as a dup.
Status: NEW → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 939614
You need to log in before you can comment on or make changes to this bug.