Bug 1259927 (CacheIR)

[meta] CacheIR tracking bug

NEW
Unassigned

Status

()

P3
normal
3 years ago
a month ago

People

(Reporter: jandem, Unassigned)

Tracking

(Depends on: 28 bugs, Blocks: 4 bugs, {meta, perf})

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [qf:meta])

User Story

From bug 1255352 comment 0:

Our current IC design has a number of problems, most importantly:

* Baseline and Ion ICs don't share much code. The same or similar logic and code is duplicated (often slightly differently and more than once per JIT).
* Ion ICs can handle cases that Baseline doesn't support, and vice versa.
* Baseline ICs are sometimes not 'flexible' enough: an example of this is the does-not-exist stub: Baseline does not attach a stub if an object on the proto chain has obj->hasUncacheableProto(), because it's really hard to support this case with the current ICs.
* It's hard to do something like: unwrap a (Window)Proxy, CCW, etc. and then optimize as a normal getprop, without duplicating/complicating a lot of code.
* ICs and Baseline stub classes are boilerplate-heavy (there are > 7000 lines of code in BaselineIC.h and SharedIC.h).
* Register allocation in ICs, especially Ion ICs, can be hard to get right.
* Adding ICs is a lot of work. I want to add an Ion IC for JSOP_IN. We also need ICs for the new |super| property accesses for ES6 classes (these are like normal GetProp/SetProp, but have an additional receiver argument).
* For Ion there's no good mechanism to discard or update stubs that are no longer valid, so we sometimes attach similar stubs multiple times.

I've been working on a design that addresses all of those issues. The idea is that we emit a very simple, linear (there are guards but no loops or branches) CacheIR bytecode, and generate Baseline and Ion IC code from it. The IR for a simple read-slot getprop looks like this:

  GuardIsObject 0
  GuardShape 0
  LoadFixedSlotResult 0

The generated CacheIR will be exactly the same for Baseline and Ion, but they will compile each op to different machine code and Ion can skip certain guards (if it knows they will never fail).

This ensures we optimize exactly the same cases in Baseline and Ion. We still need different CacheIR -> IC code generators, but at that point all the high-level decisions and VM bits are taken care of.

The actual shapes and slot offsets will be stored separately from the CacheIR. Ion can bake those directly into the JitCode, but (just like we do now) Baseline code will store them in the ICStub, allowing us to share IC stub code. Sharing Baseline stub code happens transparently with this design: stubs that have the same CacheIR can share JIT code.

We'll no longer need Baseline ICStub classes for each case, as the stubs are allocated dynamically. Stubs have a pointer to their (shared) CacheIR code, that allows Ion to optimize based on Baseline ICs. (Later on we could compile CacheIR we get from Baseline stubs to Ion MIR instructions, allowing us to inline and optimize more cases in IonBuilder without ICs).
(Reporter)

Description

3 years ago
See bug 1255352 comment 0.

Filing a new meta bug to track the remaining work.
(Reporter)

Updated

3 years ago
Depends on: 1258105, 1259925, 1255352
(Reporter)

Updated

3 years ago
Depends on: 1266180
(Reporter)

Updated

3 years ago
Depends on: 1266695
(Reporter)

Updated

3 years ago
Depends on: 1267163
(Reporter)

Updated

3 years ago
Blocks: 816159
(Reporter)

Updated

3 years ago
Blocks: 1307062
Priority: -- → P3
Keywords: perf
(Reporter)

Updated

3 years ago
Depends on: 1310125
(Reporter)

Updated

2 years ago
Depends on: 1313036
(Reporter)

Updated

2 years ago
Depends on: 1317292
(Reporter)

Updated

2 years ago
Depends on: 1317703
(Reporter)

Updated

2 years ago
Depends on: 1318285
(Reporter)

Updated

2 years ago
Depends on: 1319087
(Reporter)

Updated

2 years ago
Depends on: 1319437
(Reporter)

Updated

2 years ago
Depends on: 1320118
(Reporter)

Updated

2 years ago
Depends on: 1320145
(Reporter)

Updated

2 years ago
Depends on: 1320461
(Reporter)

Updated

2 years ago
Depends on: 1320670
(Reporter)

Updated

2 years ago
Depends on: 1322091
(Reporter)

Updated

2 years ago
Depends on: 1322093
(Reporter)

Updated

2 years ago
Depends on: 1322320
User Story: (updated)
(Reporter)

Updated

2 years ago
Depends on: 1322783
Depends on: 1323037
(Reporter)

Updated

2 years ago
Depends on: 1323094
(Reporter)

Updated

2 years ago
Depends on: 1323096
(Reporter)

Updated

2 years ago
Depends on: 1323099
Depends on: 1323190
(Reporter)

Updated

2 years ago
Depends on: 1324561
Depends on: 1324566
(Reporter)

Updated

2 years ago
Depends on: 1325358
(Reporter)

Updated

2 years ago
Blocks: 917030
(Reporter)

Updated

2 years ago
Depends on: 1326067
(Reporter)

Updated

2 years ago
Blocks: 1139750
Depends on: 1326437
Depends on: 1326438
Depends on: 1328076
Depends on: 1328077
Depends on: 965992
(Reporter)

Updated

2 years ago
Depends on: 1328140
(Reporter)

Updated

2 years ago
Depends on: 1328227
Depends on: 1329016
(Reporter)

Updated

2 years ago
Depends on: 1329195
(Reporter)

Updated

2 years ago
Depends on: 1133423
Depends on: 1331034
Depends on: 1331136
(Reporter)

Updated

2 years ago
Depends on: 1332333
(Reporter)

Updated

2 years ago
Depends on: 1332593
Depends on: 1332946
(Reporter)

Updated

2 years ago
Depends on: 1333067
(Reporter)

Updated

2 years ago
Depends on: 1333690
Depends on: 1334187
Depends on: 1334727
(Reporter)

Updated

2 years ago
Depends on: 1335405
Depends on: 1091978
Depends on: 1336579
Depends on: 1336580
Depends on: 1337024
Depends on: 1337763
Depends on: 1337764
(Reporter)

Updated

2 years ago
Depends on: 1337773
(Reporter)

Updated

2 years ago
Depends on: 1337812
Depends on: 1338825
Depends on: 1338828
Depends on: 1339207
(Reporter)

Updated

2 years ago
Depends on: 1340150
(Reporter)

Updated

2 years ago
Depends on: 1340153
(Reporter)

Updated

2 years ago
Depends on: 1340496
(Reporter)

Updated

2 years ago
Depends on: 1341067
(Reporter)

Updated

2 years ago
Depends on: 1341071
Depends on: 1341261
Depends on: 1341782
Depends on: 1341789
(Reporter)

Updated

2 years ago
Blocks: 1241091
(Reporter)

Updated

2 years ago
Depends on: 1342856
(Reporter)

Updated

2 years ago
Depends on: 1344691
(Reporter)

Updated

2 years ago
Depends on: 1346178
(Reporter)

Updated

2 years ago
Depends on: 1346189
(Reporter)

Updated

2 years ago
Depends on: 1348790
(Reporter)

Updated

2 years ago
Depends on: 1348792
(Reporter)

Updated

2 years ago
Depends on: 1348821
(Reporter)

Updated

2 years ago
Depends on: 1348850
(Reporter)

Updated

2 years ago
Depends on: 1348905
Depends on: 1349035
(Reporter)

Updated

2 years ago
Depends on: 1349148
Depends on: 1349179
(Reporter)

Updated

2 years ago
Depends on: 1350263
(Reporter)

Updated

2 years ago
Depends on: 1350896
Depends on: 1351388
Depends on: 1351471
(Reporter)

Updated

2 years ago
Depends on: 1353353
(Reporter)

Updated

2 years ago
Depends on: 1353359
Depends on: 1344469
(Reporter)

Updated

2 years ago
Depends on: 1353384
Depends on: 1353928
(Reporter)

Updated

2 years ago
Depends on: 1355109
Depends on: 1357759
(Reporter)

Updated

2 years ago
Depends on: 1358047
(Reporter)

Updated

2 years ago
Depends on: 1375504
Depends on: 1385278
Depends on: 1419372
(Reporter)

Updated

a year ago
Depends on: 1420910
Depends on: 1398099
Depends on: 1432168
Keywords: meta
Depends on: 1440554
Depends on: 1401927
Depends on: 1490348
Depends on: 1490365
Depends on: 1448039
Depends on: 1490441
Depends on: 1486857
(Reporter)

Updated

6 months ago
Depends on: 1494537
Depends on: 1483345
Depends on: 1501865
(Reporter)

Updated

a month ago
Depends on: 1526425
You need to log in before you can comment on or make changes to this bug.