Commit Graph

3827 Commits

Author SHA1 Message Date
Erlend E. Aasland 2d43beec22
gh-104050: Argument Clinic: Annotate nested function parser_body() in the CLanguage class (#106699) 2023-07-12 22:49:30 +00:00
Alex Waygood 8aa4beaad0
gh-104683: Argument clinic: modernise `cpp.Monitor` (#106698) 2023-07-12 22:48:36 +00:00
Alex Waygood a180e7a0df
gh-104050: Argument clinic: Annotate the `Destination` class (#106655)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2023-07-12 22:33:47 +01:00
Irit Katriel 2ca008e2b7
gh-105481: move Python/opcode_metadata.h to Include/internal/pycore_opcode_metadata.h (#106673) 2023-07-12 11:30:25 +01:00
Alex Waygood 7ce3ea4906
gh-104683: Argument clinic: Minor readability improvements for `Destination.__init__` (#106652) 2023-07-11 23:08:28 +00:00
Ijtaba Hussain de827322ca
gh-103186: In test_tools.freeze, fetch CONFIG_ARGS from original source directory (#103213)
Fetch CONFIG_ARGS from the original source directory, instead of from
the copied source tree. When "make clean" is executed in the copied
source tree, the build directory is cleared and the configure argument
lookup fails. However, the original source directory still contains this
information.
2023-07-11 22:22:18 +00:00
Alex Waygood d0972c77aa
gh-104050: Argument Clinic: Annotate the `Block` class (#106519) 2023-07-11 21:21:14 +00:00
Guido van Rossum cabd6e8a10
gh-106529: Support JUMP_BACKWARD in Tier 2 (uops) (#106543)
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.
2023-07-11 18:08:10 +00:00
Eisuke Kawashima 64c0890b69
wasm: do not use inline comment in .editorconfig (#106610)
It is no longer valid since 0.15.0
https://github.com/editorconfig/specification/blob/v0.15/index.rst#no-inline-comments
2023-07-11 23:55:37 +09:00
Irit Katriel 388b5daa52
gh-106360: remove redundant #ifdef (#106622) 2023-07-11 13:41:50 +01:00
Charlie Zhao e5c32a811c
gh-106078: Move external C-API functions to decimal module global state (#106616) 2023-07-11 16:36:42 +05:30
Guido van Rossum 22988c323a
gh-106529: Implement POP_JUMP_IF_XXX uops (#106551)
- 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.
2023-07-10 16:04:26 -07:00
Charlie Zhao 93846657a3
gh-106078: Move static variables initialized once to decimal module global state (#106475) 2023-07-10 17:27:25 +05:30
Charlie Zhao 1c9e493462
gh-106078: Move static objects related to `CONTEXTVAR` to the decimal module global state (#106395)
Co-authored-by: Erlend E. Aasland <erlend@python.org>
2023-07-08 13:14:24 +05:30
Guido van Rossum b3648f036e
gh-104584: Allow unspecialized instructions in superblocks (#106497)
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.
2023-07-07 18:03:27 +00:00
Guido van Rossum 11038c56ad
gh-104584: Move super-instruction special-casing to generator (#106500)
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.
2023-07-07 17:42:10 +00:00
Alex Waygood 363f4f99c5
gh-104683: clinic.py: refactor `Parameter` and `Function` as dataclasses (#106477) 2023-07-07 13:10:07 +00:00
Alex Waygood 5548097925
gh-104683: clinic.py: refactor four simple classes as dataclasses (#106476) 2023-07-06 22:17:12 +01:00
Alex Waygood d0c6ba956f
gh-104683: clinic.py: Don't needlessly reimplement `contextlib.redirect_stdout` (#106478)
clinic.py: Don't needlessly reimplement `contextlib.redirect_stdout`
2023-07-06 14:23:02 +01:00
Erlend E. Aasland 9d1d4f9c73
gh-64595: Fix regression in file write logic in Argument Clinic (#106449)
Revert the two commits that introduced the regressions:

 - gh-104152
 - gh-104507
2023-07-05 13:23:22 +02:00
Erlend E. Aasland 7bb9fa5ae4
gh-104050: Partially annotate Argument Clinic CLanguage class (#106437)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-07-04 23:07:57 +00:00
Erlend E. Aasland 22087516bc
gh-104050: Annotate Argument Clinic parameter permutation helpers (#106431)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-07-04 22:15:10 +00:00
Erlend E. Aasland 110b97c94c
gh-104050: Annotate toplevel functions in clinic.py (#106435)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-07-04 22:13:30 +00:00
Mark Shannon 318ea2c72e
GH-106360: Support very basic superblock introspection (#106422)
* Add len() and indexing support to uop superblocks.
2023-07-04 17:23:00 +01:00
Erlend E. Aasland 8f6df5e9cb
gh-106368: Add tests for permutation helpers in Argument Clinic (#106407)
Added new test class PermutationTests()
2023-07-04 11:36:40 +00:00
Erlend E. Aasland b24479dcba
gh-104050: Annotate more Argument Clinic DSLParser state methods (#106376)
Annotate the following methods:

- state_parameter()
- state_parameter_docstring_start()

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-07-03 22:10:46 +00:00
Erlend E. Aasland 71b40443fe
gh-104683: Modernise Argument Clinic parameter state machine (#106362)
Use enums and pattern matching to make the code more readable.

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-07-03 21:16:21 +00:00
Charlie Zhao bf06c6825c
gh-106078: Move `context template` to decimal module global state (#106346) 2023-07-04 01:40:01 +05:30
Guido van Rossum 2028a4f6d9
gh-106290: Fix edge cases around uops (#106319)
- 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)
2023-07-03 20:05:11 +00:00
Erlend E. Aasland 2e2daac2f1
gh-104050: Add more type hints to Argument Clinic DSLParser() (#106354)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-07-03 14:03:31 +00:00
Erlend E. Aasland 0da4c883cf
gh-106359: Fix corner case bugs in Argument Clinic converter parser (#106361)
DSLParser.parse_converter() could return unusable kwdicts in some rare cases

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-07-03 13:14:59 +00:00
Erlend E. Aasland 60e41a0cbb
gh-104146: Remove unused attr 'parameter_indent' from clinic.DLParser (#106358) 2023-07-03 11:00:35 +00:00
Erlend E. Aasland 18fedd04a7
gh-104050: Annotate Argument Clinic DSLParser attributes (#106357) 2023-07-03 10:06:54 +00:00
Victor Stinner 5ccbbe5bb9
gh-106320: Move _PyUnicodeWriter to the internal C API (#106342)
Move also _PyUnicode_FormatAdvancedWriter().

CJK codecs and multibytecodec.c now define the Py_BUILD_CORE_MODULE
macro.
2023-07-03 10:23:43 +02:00
Erlend E. Aasland 569887aa9d
gh-104050: Add more type hints to Argument Clinic DSLParser() (#106343)
Annotate the following method signatures:

- state_dsl_start()
- state_parameter_docstring_start()
- state_parameters_start()

Inverting ignore_line() logic, add type hints (including type guard) to
it, and rename to valid_line().
2023-07-02 23:42:38 +00:00
Charlie Zhao dbefa88b27
gh-106078: Move DecimalException to _decimal state (#106301) 2023-07-02 16:50:40 +00:00
Victor Stinner 46d77610fc
gh-106316: Remove pytime.h header file (#106317)
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()
2023-07-01 22:27:18 +00:00
Irit Katriel 200f255411
gh-106149: move unconditional jump direction resolution from optimizer to assembler (#106291) 2023-07-01 11:28:07 +01:00
dependabot[bot] c336b4c14f
build(deps-dev): bump mypy from 1.3.0 to 1.4.1 in /Tools/clinic (#106305)
Bumps [mypy](https://github.com/python/mypy) from 1.3.0 to 1.4.1.
- [Commits](https://github.com/python/mypy/compare/v1.3.0...v1.4.1)

---
updated-dependencies:
- dependency-name: mypy
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-01 09:54:32 +00:00
Kirill Podoprigora 2062e11501
gh-106267: Add type cast to generated code (#106289) 2023-06-30 12:11:10 -07:00
Guido van Rossum 6e9f83d9ae
GH-106250: Support insts using one cache entry and no oparg (GH-106252) 2023-06-29 13:02:25 -07:00
Charlie Zhao fb0d9b9ac1
gh-106078: Convert `_decimal` types to heap types (#106079)
- Establish global state struct
- Convert static types to heap types and add them to global state:
    * PyDecContextManager_Type
    * PyDecContext_Type
    * PyDecSignalDictMixin_Type
    * PyDec_Type
- Add to global state:
    * PyDecSignalDict_Type
    * DecimalTuple

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Co-authored-by: Erlend E. Aasland <erlend@python.org>
2023-06-29 10:27:20 +00:00
Guido van Rossum 11731434df
gh-104584: Emit macro expansions to opcode_metadata.h (#106163)
This produces longer traces (superblocks?).

Also improved debug output (uop names are now printed instead of numeric opcodes). This would be simpler if the numeric opcode values were generated by generate_cases.py, but that's another project.

Refactored some code in generate_cases.py so the essential algorithm for cache effects is only run once. (Deciding which effects are used and what the total cache size is, regardless of what's used.)
2023-06-28 18:28:07 +00:00
Nikita Sobolev d830c4a944
gh-106200: Remove unused imports (#106201) 2023-06-28 11:55:41 +00:00
Victor Stinner 1f74b9e933
Fix c-analyzer for GCC: ignore LANG env var (#106173)
The c-analyzer doesn't support GCC localized messages, so just unset
the LANG environment variable.
2023-06-28 02:50:51 +00:00
Guido van Rossum 0762775a15
gh-104584: Add #line directives to executor_cases.c.h (#106126) 2023-06-27 06:56:39 -07:00
Guido van Rossum 51fc725117
gh-104584: Baby steps towards generating and executing traces (#105924)
Added a new, experimental, tracing optimizer and interpreter (a.k.a. "tier 2"). This currently pessimizes, so don't use yet -- this is infrastructure so we can experiment with optimizing passes. To enable it, pass ``-Xuops`` or set ``PYTHONUOPS=1``. To get debug output, set ``PYTHONUOPSDEBUG=N`` where ``N`` is a debug level (0-4, where 0 is no debug output and 4 is excessively verbose).

All of this code is likely to change dramatically before the 3.13 feature freeze. But this is a first step.
2023-06-26 19:02:57 -07:00
YAMAMOTO Takashi d8f87cdf94
gh-101538: Add experimental wasi-threads build (#101537)
Co-authored-by: Brett Cannon <brett@python.org>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2023-06-22 11:26:10 -07:00
Irit Katriel c01da2896a
gh-105481: refactor instr flag related code into a new InstructionFlags class (#105950) 2023-06-21 23:14:43 +00:00
Victor Stinner 155577de1b
make regen-stdlib-module-names rejects test modules (#105921)
Make sure that sys.stdlib_module_names doesn't contain test modules.
2023-06-20 10:12:44 +02:00