Commit Graph

103 Commits

Author SHA1 Message Date
Mark Shannon 68b5f08b72
GH-104580: Don't cache eval breaker in interpreter (GH-104581)
Move eval-breaker to the front of the interpreter state.
2023-05-18 10:08:33 +01:00
Brandt Bucher b4a9747923
GH-103906: Remove immortal refcounting in the interpreter (GH-103909) 2023-05-16 14:36:02 -07:00
Carl Meyer f40890b124
gh-103865: add monitoring support to LOAD_SUPER_ATTR (#103866) 2023-05-16 10:29:00 -06:00
Jelle Zijlstra 24d8b88420
gh-103763: Implement PEP 695 (#103764)
This implements PEP 695, Type Parameter Syntax. It adds support for:

- Generic functions (def func[T](): ...)
- Generic classes (class X[T](): ...)
- Type aliases (type X = ...)
- New scoping when the new syntax is used within a class body
- Compiler and interpreter changes to support the new syntax and scoping rules 

Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Co-authored-by: Eric Traut <eric@traut.com>
Co-authored-by: Larry Hastings <larry@hastings.org>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-05-15 20:36:23 -07:00
Brandt Bucher 1eb950ca55
GH-104405: Add missing PEP 523 checks (GH-104406) 2023-05-12 22:23:13 +00:00
Mark Shannon 45f5aa8fc7
GH-103082: Filter LINE events in VM, to simplify tool implementation. (GH-104387)
When monitoring LINE events, instrument all instructions that can have a predecessor on a different line.
Then check that the a new line has been hit in the instrumentation code.
This brings the behavior closer to that of 3.11, simplifying implementation and porting of tools.
2023-05-12 12:21:20 +01:00
Jelle Zijlstra 718b132772
gh-104413: Fix refleak when super attribute throws AttributeError (#104414) 2023-05-12 13:00:14 +05:30
Carl Meyer 77262458fe
gh-87729: improve hit rate of LOAD_SUPER_ATTR specialization (#104270) 2023-05-11 08:08:13 -06:00
Carl Meyer 1670729383
gh-87849: fix SEND specialization family definition (GH-104268) 2023-05-11 12:52:06 +01:00
Carl Meyer c3b595e73e
gh-97933: (PEP 709) inline list/dict/set comprehensions (#101441)
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2023-05-09 11:02:14 -06:00
Ken Jin ed95e8cbd4
gh-98003: Inline call frames for CALL_FUNCTION_EX (GH-98004) 2023-04-30 21:08:26 +08:00
Carl Meyer ef25febcf2
gh-87729: specialize LOAD_SUPER_ATTR_METHOD (#103809) 2023-04-25 17:45:51 +00:00
Carl Meyer 0dc8b50d33
gh-87729: add LOAD_SUPER_ATTR instruction for faster super() (#103497)
This speeds up `super()` (by around 85%, for a simple one-level
`super().meth()` microbenchmark) by avoiding allocation of a new
single-use `super()` object on each use.
2023-04-24 22:22:14 +00:00
Mark Shannon efb8a2553c
GH-103488: Use return-offset, not yield-offset. (GH-103502)
* Use return-offset, not yield-offset, so that instruction pointer is correct when sending to a generator or coroutine.
2023-04-13 16:19:07 +01:00
Mark Shannon 411b169281
GH-103082: Implementation of PEP 669: Low Impact Monitoring for CPython (GH-103083)
* The majority of the monitoring code is in instrumentation.c

* The new instrumentation bytecodes are in bytecodes.c

* legacy_tracing.c adapts the new API to the old sys.setrace and sys.setprofile APIs
2023-04-12 12:04:55 +01:00
Brandt Bucher b4978ff872
GH-88691: Shrink the CALL caches (GH-103230) 2023-04-05 14:15:49 -07:00
Irit Katriel 848bdbe166
gh-102192: use PyErr_SetHandledException instead of the legacy PyErr_SetExcInfo (#103157) 2023-04-01 10:31:48 +05:30
Brett Cannon d97aef8ebf
Add missing variables to `bytecodes.c` (GH-103153)
The code works without this change, but it does cause C tooling to complain less about undeclared variables.
2023-03-31 14:23:55 -07:00
Brandt Bucher 121057aa36
GH-89987: Shrink the BINARY_SUBSCR caches (GH-103022) 2023-03-29 15:53:30 -07:00
Brandt Bucher 0444ae2487
GH-100982: Break up COMPARE_AND_BRANCH (GH-102801) 2023-03-23 15:25:09 -07:00
Irit Katriel 3468c768ce
gh-102859: Remove JUMP_IF_FALSE_OR_POP and JUMP_IF_TRUE_OR_POP (#102870) 2023-03-22 18:10:48 +00:00
Mark Shannon 7559f5fda9
GH-101291: Rearrange the size bits in PyLongObject (GH-102464)
* Eliminate all remaining uses of Py_SIZE and Py_SET_SIZE on PyLongObject, adding asserts.

* Change layout of size/sign bits in longobject to support future addition of immortal ints and tagged medium ints.

* Add functions to hide some internals of long object, and for setting sign and digit count.

* Replace uses of IS_MEDIUM_VALUE macro with _PyLong_IsCompact().
2023-03-22 14:49:51 +00:00
Nikita Sobolev 82eb9469e7
gh-102598: Remove obsolete optimization from `FORMAT_VALUE` opcode (#102599) 2023-03-21 00:47:15 -07:00
Irit Katriel ad77b80b05
gh-102192: Replace PyErr_Fetch/Restore etc by more efficient alternatives (#102816) 2023-03-19 15:17:59 +00:00
Guido van Rossum 392f2ad3cb
gh-98831: Use DECREF_INPUTS() more (#102409) 2023-03-13 15:08:45 -07:00
Mark Shannon 2d370da570
GH-100987: Don't cache references to the names and consts array in `_PyEval_EvalFrameDefault`. (#102640)
* Rename local variables, names and consts, from the interpeter loop. Will allow non-code objects in frames for better introspection of C builtins and extensions.

* Remove unused dummy variables.
2023-03-13 18:35:37 +00:00
Mark Shannon 233e32f936
GH-102300: Reuse objects with refcount == 1 in float specialized binary ops. (GH-102301) 2023-03-13 10:34:54 +00:00
Brandt Bucher 08b67fb34f
GH-90997: Shrink the LOAD_GLOBAL caches (#102569) 2023-03-10 17:01:16 -08:00
Eric Snow b45d14b886
gh-100227: Move dict_state.global_version to PyInterpreterState (gh-102338)
https://github.com/python/cpython/issues/100227
2023-03-09 08:16:30 -07:00
Irit Katriel 4c87537efb
gh-102192: Replace PyErr_Fetch/Restore etc by more efficient alternatives (in Python/) (#102193) 2023-02-28 11:50:52 +00:00
Dennis Sweeney e3c3f9fec0
gh-102250: Fix double-decref in COMPARE_AND_BRANCH error case (GH-102287) 2023-02-27 10:46:40 +00:00
Mark Shannon 7c106a443f
GH-100982: Restrict `FOR_ITER_RANGE` to a single instruction to allow instrumentation. (GH-101985) 2023-02-22 11:11:57 +00:00
Steve Dower a99eb5cd99
gh-101907: Stop using `_Py_OPCODE` and `_Py_OPARG` macros (GH-101912)
* gh-101907: Removes use of non-standard C++ extension from Include/cpython/code.h

* Make cases_generator correct on Windows
2023-02-20 14:56:48 +00:00
Eclips4 68bd8c5e2e
gh-101952: Fix possible segfault in `BUILD_SET` opcode (#101958) 2023-02-16 09:46:43 -08:00
Mark Shannon c7766245c1
GH-87849: Fix refleak in SEND instruction. (GH-101908)
Fix refleak in SEND instruction.
2023-02-15 12:21:40 +00:00
Irit Katriel 81e3aa835c
gh-101799: implement PREP_RERAISE_STAR as an intrinsic function (#101800) 2023-02-14 11:54:13 +00:00
Mark Shannon 160f2fe2b9
GH-87849: Simplify stack effect of SEND and specialize it for generators and coroutines. (GH-101788) 2023-02-13 11:24:55 +00:00
Guido van Rossum 616aec1ff1
gh-98831: Modernize CALL and family (#101508)
Includes a slight improvement to `DECREF_INPUTS()`.
2023-02-08 11:40:10 -08:00
Mark Shannon feec49c407
GH-101578: Normalize the current exception (GH-101607)
* Make sure that the current exception is always normalized.

* Remove redundant type and traceback fields for the current exception.

* Add new API functions: PyErr_GetRaisedException, PyErr_SetRaisedException

* Add new API functions: PyException_GetArgs, PyException_SetArgs
2023-02-08 09:31:12 +00:00
Guido van Rossum a9f01448a9
gh-98831: Modernize CALL_FUNCTION_EX (#101627)
New generator feature: Move CHECK_EVAL_BREAKER() call to just before DISPATCH().
2023-02-07 20:03:22 -08:00
Guido van Rossum b2b85b5db9
gh-98831: Modernize FORMAT_VALUE (#101628)
Generator update: support balanced parentheses and brackets in conditions and size expressions.
2023-02-07 17:35:55 -08:00
Guido van Rossum aacbdb0c65
gh-98831: Finish the UNPACK_SEQUENCE family (#101666)
New generator feature: Generate useful glue for output arrays, so you can just write values to the output array (no bounds checking). Rewrote UNPACK_SEQUENCE_TWO_TUPLE to use this, and also UNPACK_SEQUENCE_{TUPLE,LIST}.
2023-02-07 15:44:37 -08:00
penguin_wwy 753fc8a5d6
gh-101632: Add the new RETURN_CONST opcode (#101633) 2023-02-07 22:32:21 +00:00
Irit Katriel dec1ab0387
gh-98831: rewrite UNPACK_EX, UNPACK_SEQUENCE, UNPACK_SEQUENCE_TWO_TUPLE in the instruction definition DSL (#101641) 2023-02-07 20:37:43 +00:00
Guido van Rossum d54b8d8fbd
gh-98831: Modernize the FOR_ITER family of instructions (#101626)
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2023-02-07 08:28:28 -08:00
Irit Katriel 38752760c9
gh-98831: rewrite COPY and SWAP in the instruction definition DSL (#101620) 2023-02-06 22:45:18 +00:00
Irit Katriel 433fb3ef08
gh-98831: rewrite MAKE_FUNCTION and BUILD_SLICE in the instruction definition DSL (#101529) 2023-02-03 14:40:45 +00:00
Irit Katriel 04e06e20ee
gh-98831: rewrite SEND, GET_YIELD_FROM_ITER, RETURN_GENERATOR in the instruction definition DSL (#101516) 2023-02-03 11:30:21 +00:00
Irit Katriel 0675b8f032
gh-98831: rewrite RERAISE and CLEANUP_THROW in the instruction definition DSL (#101511) 2023-02-02 10:02:57 +00:00
Guido van Rossum ae9b38f424
gh-98831: Modernize the LOAD_GLOBAL family (#101502) 2023-02-01 13:12:49 -08:00