summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
* gh-106701: Move the hand-written Tier 2 uops to bytecodes.c (#106702)Guido van Rossum2023-07-133-40/+66
| | | | | | | This moves EXIT_TRACE, SAVE_IP, JUMP_TO_TOP, and _POP_JUMP_IF_{FALSE,TRUE} from ceval.c to bytecodes.c. They are no less special than before, but this way they are discoverable o the copy-and-patch tooling.
* GH-104909: Split `LOAD_ATTR_INSTANCE_VALUE` into micro-ops (GH-106678)Mark Shannon2023-07-133-24/+72
|
* gh-106529: Split FOR_ITER_RANGE into uops (#106638)Guido van Rossum2023-07-124-25/+118
| | | | For an example of what this does for Tier 1 and Tier 2, see https://github.com/python/cpython/issues/106529#issuecomment-1631649920
* gh-106656: Remove --emit-line-directives from regen-cases (#106657)Guido van Rossum2023-07-122-862/+0
| | | | | | | If you prefer to see `#line` directives in generated_cases.c.h, run ``` make regen-cases CASESFLAG=-l ``` But please don't commit the result.
* GH-104909: Break LOAD_GLOBAL specializations in micro-ops. (GH-106677)Mark Shannon2023-07-123-499/+576
|
* gh-105481: move Python/opcode_metadata.h to ↵Irit Katriel2023-07-126-1325/+8
| | | | Include/internal/pycore_opcode_metadata.h (#106673)
* gh-106521: Remove _PyObject_LookupAttr() function (GH-106642)Serhiy Storchaka2023-07-1211-243/+243
|
* gh-106529: Implement JUMP_FORWARD in uops (with test) (#106651)Guido van Rossum2023-07-111-0/+7
| | | | Note that this may generate two SAVE_IP uops in a row. Removing unneeded SAVE_IP uops is the optimizer's job.
* gh-104584: readability improvements in optimizer.c (#106641)Irit Katriel2023-07-111-18/+19
|
* gh-106307: C API: Add PyMapping_GetOptionalItem() function (GH-106308)Serhiy Storchaka2023-07-114-874/+620
| | | | Also add PyMapping_GetOptionalItemString() function.
* gh-106529: Support JUMP_BACKWARD in Tier 2 (uops) (#106543)Guido van Rossum2023-07-113-28/+48
| | | | | During superblock generation, a JUMP_BACKWARD instruction is translated to either a JUMP_TO_TOP micro-op (when the target of the jump is exactly the beginning of the superblock, closing the loop), or a SAVE_IP + EXIT_TRACE pair, when the jump goes elsewhere. The new JUMP_TO_TOP instruction includes a CHECK_EVAL_BREAKER() call, so a closed loop can still be interrupted.
* gh-106360: remove redundant #ifdef (#106622)Irit Katriel2023-07-111-3/+1
|
* GH-106529: Define POP_JUMP_IF_NONE in terms of POP_JUMP_IF_TRUE (GH-106599)Mark Shannon2023-07-114-235/+281
|
* gh-106572: Convert PyObject_DelAttr() to a function (#106611)Victor Stinner2023-07-114-4/+5
| | | | | | | | * Convert PyObject_DelAttr() and PyObject_DelAttrString() macros to functions. * Add PyObject_DelAttr() and PyObject_DelAttrString() functions to the stable ABI. * Replace PyObject_SetAttr(obj, name, NULL) with PyObject_DelAttr(obj, name).
* gh-106529: Silence compiler warning in jump target patching (#106613)Guido van Rossum2023-07-111-2/+2
| | | (gh-106551 caused a compiler warning about on Windows.)
* gh-106529: Implement POP_JUMP_IF_XXX uops (#106551)Guido van Rossum2023-07-103-52/+133
| | | | | | | | | | | | | | | - Hand-written uops JUMP_IF_{TRUE,FALSE}. These peek at the top of the stack. The jump target (in superblock space) is absolute. - Hand-written translation for POP_JUMP_IF_{TRUE,FALSE}, assuming the jump is unlikely. Once we implement jump-likelihood profiling, we can implement the jump-unlikely case (in another PR). - Tests (including some test cleanup). - Improvements to len(ex) and ex[i] to expose the whole trace.
* GH-100288: regen cases after #105990 (#106589)Kumar Aditya2023-07-101-7/+7
|
* GH-100288: Specialize LOAD_ATTR for simple class attributes. (#105990)Mark Shannon2023-07-106-245/+353
| | | * Add two more specializations of LOAD_ATTR.
* gh-106303: Use _PyObject_LookupAttr() instead of PyObject_GetAttr() (GH-106304)Serhiy Storchaka2023-07-091-10/+6
| | | | It simplifies and speed up the code.
* gh-104584: Replace ENTER_EXECUTOR with the original in trace projection ↵Guido van Rossum2023-07-071-0/+6
| | | | (#106526)
* Delete dead ceval code. (gh-106486)Benjamin Peterson2023-07-071-5/+0
|
* gh-104584: Allow unspecialized instructions in superblocks (#106497)Guido van Rossum2023-07-072-126/+438
| | | | | | | | | | | | | | | | This adds several of unspecialized opcodes to superblocks: TO_BOOL, BINARY_SUBSCR, STORE_SUBSCR, UNPACK_SEQUENCE, LOAD_GLOBAL, LOAD_ATTR, COMPARE_OP, BINARY_OP. While we may not want that eventually, for now this helps finding bugs. There is a rudimentary test checking for UNPACK_SEQUENCE. Once we're ready to undo this, that would be simple: just replace the call to variable_used_unspecialized with a call to variable_used (as shown in a comment). Or add individual opcdes to FORBIDDEN_NAMES_IN_UOPS.
* gh-104584: Move super-instruction special-casing to generator (#106500)Guido van Rossum2023-07-072-37/+25
| | | | | | Instead of special-casing specific instructions, we add a few more special values to the 'size' field of expansions, so in the future we can automatically handle additional super-instructions in the generator.
* GH-106057: Handle recursion errors in inline class calls properly. (GH-106108)Mark Shannon2023-07-073-91/+93
|
* gh-104584: Handle EXTENDED_ARG in superblock creation (#106489)Guido van Rossum2023-07-061-0/+16
| | | With test.
* gh-104584: Clean up and fix uops tests and fix crash (#106492)Guido van Rossum2023-07-061-2/+8
| | | | | | | | | | | | The uops test wasn't testing anything by default, and was failing when run with -Xuops. Made the two executor-related context managers global, so TestUops can use them (notably `with temporary_optimizer(opt)`). Made clear_executor() a little more thorough. Fixed a crash upon finalizing a uop optimizer, by adding a `tp_dealloc` handler.
* gh-104584: Fix error handling from backedge optimization (#106484)Guido van Rossum2023-07-064-11/+15
| | | | | | | | | | | | When `_PyOptimizer_BackEdge` returns `NULL`, we should restore `next_instr` (and `stack_pointer`). To accomplish this we should jump to `resume_with_error` instead of just `error`. The problem this causes is subtle -- the only repro I have is in PR gh-106393, at commit d7df54b139bcc47f5ea094bfaa9824f79bc45adc. But the fix is real (as shown later in that PR). While we're at it, also improve the debug output: the offsets at which traces are identified are now measured in bytes, and always show the start offset. This makes it easier to correlate executor calls with optimizer calls, and either with `dis` output. <!-- gh-issue-number: gh-104584 --> * Issue: gh-104584 <!-- /gh-issue-number -->
* gh-105340: include hidden fast-locals in locals() (#105715)Carl Meyer2023-07-052-34/+66
| | | * gh-105340: include hidden fast-locals in locals()
* gh-106320: Fix specialize.c compilation by including pycore_pylifecycle.h ↵Guido van Rossum2023-07-041-0/+1
| | | | | (#106434) Compilation of Python/specialize.c was broken on macOS for me by gh-106400.
* GH-106360: Support very basic superblock introspection (#106422)Mark Shannon2023-07-042-4/+72
| | | * Add len() and indexing support to uop superblocks.
* GH-106008: Fix refleak when peepholing `None` comparisons (#106367)Brandt Bucher2023-07-041-1/+1
|
* gh-106320: Remove private pylifecycle.h functions (#106400)Victor Stinner2023-07-043-2/+5
| | | | | | | Remove private pylifecycle.h functions: move them to the internal C API ( pycore_atexit.h, pycore_pylifecycle.h and pycore_signal.h). No longer export most of these functions. Move _testcapi.test_atexit() to _testinternalcapi.
* gh-106320: Remove _PyUnicode_TransformDecimalAndSpaceToASCII() (#106398)Victor Stinner2023-07-041-0/+1
| | | | | | | | Remove private _PyUnicode_TransformDecimalAndSpaceToASCII() and other private _PyUnicode C API functions: move them to the internal C API (pycore_unicodeobject.h). No longer most of these functions. Replace _testcapi.unicode_transformdecimalandspacetoascii() with _testinternal._PyUnicode_TransformDecimalAndSpaceToASCII().
* gh-106320: Remove more private _PyUnicode C API functions (#106382)Victor Stinner2023-07-031-0/+1
| | | | | | Remove more private _PyUnicode C API functions: move them to the internal C API (pycore_unicodeobject.h). No longer export most pycore_unicodeobject.h functions.
* GH-104584: Fix ENTER_EXECUTOR (GH-106141)Mark Shannon2023-07-037-269/+270
| | | | | | * Check eval-breaker in ENTER_EXECUTOR. * Make sure that frame->prev_instr is set before entering executor.
* gh-106290: Fix edge cases around uops (#106319)Guido van Rossum2023-07-034-228/+263
| | | | | | | | | | - Tweak uops debugging output - Fix the bug from gh-106290 - Rename `SET_IP` to `SAVE_IP` (per https://github.com/faster-cpython/ideas/issues/558) - Add a `SAVE_IP` uop at the start of the trace (ditto) - Allow `unbound_local_error`; this gives us uops for `LOAD_FAST_CHECK`, `LOAD_CLOSURE`, and `DELETE_FAST` - Longer traces - Support `STORE_FAST_LOAD_FAST`, `STORE_FAST_STORE_FAST` - Add deps on pycore_uops.h to Makefile(.pre.in)
* gh-106320: Remove private _PyErr C API functions (#106356)Victor Stinner2023-07-031-0/+1
| | | | Remove private _PyErr C API functions: move them to the internal C API (pycore_pyerrors.h).
* gh-106320: Create pycore_modsupport.h header file (#106355)Victor Stinner2023-07-033-1/+4
| | | | | | | | | | Remove the following functions from the C API, move them to the internal C API: add a new pycore_modsupport.h internal header file: * PyModule_CreateInitialized() * _PyArg_NoKwnames() * _Py_VaBuildStack() No longer export these functions.
* Document PYTHONSAFEPATH along side -P (#106122)Jeremy Paige2023-07-031-2/+2
|
* gh-106320: Use _PyInterpreterState_GET() (#106336)Victor Stinner2023-07-024-14/+11
| | | | Replace PyInterpreterState_Get() with inlined _PyInterpreterState_GET().
* gh-104922: remove PY_SSIZE_T_CLEAN (#106315)Inada Naoki2023-07-021-2/+0
|
* gh-106320: Remove private _PyInterpreterState functions (#106325)Victor Stinner2023-07-023-4/+6
| | | | | | | | | Remove private _PyThreadState and _PyInterpreterState C API functions: move them to the internal C API (pycore_pystate.h and pycore_interp.h). Don't export most of these functions anymore, but still export functions used by tests. Remove _PyThreadState_Prealloc() and _PyThreadState_Init() from the C API, but keep it in the stable API.
* gh-106320: Remove _PyInterpreterState_Get() alias (#106321)Victor Stinner2023-07-014-13/+13
| | | | Replace calls to the (removed) slow _PyInterpreterState_Get() with fast inlined _PyInterpreterState_GET() function.
* gh-106316: Remove pytime.h header file (#106317)Victor Stinner2023-07-011-0/+1
| | | | | | | | | | | | | | | | | Remove the "cpython/pytime.h" header file: it only contained private functions. Move functions to the internal pycore_time.h header file. Move tests from _testcapi to _testinternalcapi. Rename also test methods to have the same name than tested C functions. No longer export these functions: * _PyTime_Add() * _PyTime_As100Nanoseconds() * _PyTime_FromMicrosecondsClamp() * _PyTime_FromTimespec() * _PyTime_FromTimeval() * _PyTime_GetPerfCounterWithInfo() * _PyTime_MulDiv()
* Fix duplicate word typos in comments (#106225)Md Sadman Chowdhury2023-07-011-1/+1
|
* gh-106149: move unconditional jump direction resolution from optimizer to ↵Irit Katriel2023-07-013-18/+42
| | | | assembler (#106291)
* gh-106145: Make `end_{lineno,col_offset}` required on `type_param` nodes ↵Nikita Sobolev2023-06-301-12/+6
| | | | (#106224)
* gh-106267: Add type cast to generated code (#106289)Kirill Podoprigora2023-06-301-1/+1
|
* gh-106280: Remove unnecessary unreachable code (gh-106285)Dong-hee Na2023-06-301-3/+0
|
* gh-106023: Remove _PyObject_FastCallTstate() function (#106273)Victor Stinner2023-06-301-7/+5
|