Commit a6dd781
pythongh-115999: Add free-threaded specialization for CONTAINS_OP (pythongh-126450)
- The specialization logic determines the appropriate specialization using only the operand's type, which is safe to read non-atomically (changing it requires stopping the world). We are guaranteed that the type will not change in between when it is checked and when we specialize the bytecode because the types involved are immutable (you cannot assign to `__class__` for exact instances of `dict`, `set`, or `frozenset`). The bytecode is mutated atomically using helpers.
- The specialized instructions rely on the operand type not changing in between the `DEOPT_IF` checks and the calls to the appropriate type-specific helpers (e.g. `_PySet_Contains`). This is a correctness requirement in the default builds and there are no changes to the opcodes in the free-threaded builds that would invalidate this.1 parent 17465e0 commit a6dd781
File tree
4 files changed
+29
-6
lines changed- Lib/test
- Python
4 files changed
+29
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1335 | 1335 | | |
1336 | 1336 | | |
1337 | 1337 | | |
| 1338 | + | |
| 1339 | + | |
| 1340 | + | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + | |
| 1347 | + | |
| 1348 | + | |
| 1349 | + | |
| 1350 | + | |
| 1351 | + | |
| 1352 | + | |
| 1353 | + | |
| 1354 | + | |
| 1355 | + | |
| 1356 | + | |
| 1357 | + | |
| 1358 | + | |
1338 | 1359 | | |
1339 | 1360 | | |
1340 | 1361 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2508 | 2508 | | |
2509 | 2509 | | |
2510 | 2510 | | |
2511 | | - | |
| 2511 | + | |
2512 | 2512 | | |
2513 | 2513 | | |
2514 | 2514 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2747 | 2747 | | |
2748 | 2748 | | |
2749 | 2749 | | |
2750 | | - | |
| 2750 | + | |
2751 | 2751 | | |
| 2752 | + | |
2752 | 2753 | | |
2753 | 2754 | | |
2754 | | - | |
| 2755 | + | |
2755 | 2756 | | |
2756 | 2757 | | |
2757 | 2758 | | |
2758 | | - | |
| 2759 | + | |
2759 | 2760 | | |
2760 | 2761 | | |
2761 | 2762 | | |
2762 | 2763 | | |
2763 | 2764 | | |
2764 | | - | |
| 2765 | + | |
2765 | 2766 | | |
2766 | 2767 | | |
2767 | 2768 | | |
2768 | 2769 | | |
| 2770 | + | |
2769 | 2771 | | |
2770 | 2772 | | |
2771 | 2773 | | |
| |||
0 commit comments