Commit graph

1208 commits

Author SHA1 Message Date
Russell Keith-Magee bee7bb3310
gh-114099: Add configure and Makefile targets to support iOS compilation. (GH-115390) 2024-02-25 20:21:10 -05:00
Seth Michael Larson c6a47de709
gh-115663: Remove 'regen-sbom' from the 'regen-all' target (#115790) 2024-02-22 15:42:26 +02:00
Malcolm Smith 7f5e3f04f8
gh-111225: Link extension modules against libpython on Android (#115780)
Part of the work on PEP 738: Adding Android as a supported platform.

* Rename the LIBPYTHON variable to MODULE_LDFLAGS, to more accurately 
  reflect its purpose.
* Edit makesetup to use MODULE_LDFLAGS when linking extension modules.
* Edit the Makefile so that extension modules depend on libpython on 
  Android and Cygwin.
* Restore `-fPIC` on Android. It was removed several years ago with a 
  note that the toolchain used it automatically, but this is no longer
  the case. Omitting it causes all linker commands to fail with an error
  like `relocation R_AARCH64_ADR_PREL_PG_HI21 cannot be used against
  symbol '_Py_FalseStruct'; recompile with -fPIC`.
2024-02-21 23:18:57 +00:00
Russell Keith-Magee 074bbec9c4
gh-115737: Correct libpython install name for macOS shared library builds. (gh-115750) 2024-02-21 04:11:04 -05:00
Sam Gross 5903190727
gh-115103: Implement delayed memory reclamation (QSBR) (#115180)
This adds a safe memory reclamation scheme based on FreeBSD's "GUS" and
quiescent state based reclamation (QSBR). The API provides a mechanism
for callers to detect when it is safe to free memory that may be
concurrently accessed by readers.
2024-02-16 15:25:19 -05:00
mpage a95b1a56bb
gh-115041: Add wrappers that are atomic only in free-threaded builds (#115046)
These are intended to be used in places where atomics are required in
free-threaded builds but not in the default build. We don't want to
introduce the potential performance overhead of an atomic operation in the
default build.
2024-02-14 15:15:05 -05:00
T. Wouters 518af37eb5
gh-115421: Update the list of installed test subdirectories. (#115422)
Update the list of installed test subdirectories with all newly added
subdirectories of Lib/test, so that the tests in those directories are
properly installed.
2024-02-14 00:58:49 +01:00
Eric Snow 514b1c91b8
gh-76785: Improved Subinterpreters Compatibility with 3.12 (gh-115424)
For the most part, these changes make is substantially easier to backport subinterpreter-related code to 3.12, especially the related modules (e.g. _xxsubinterpreters). The main motivation is to support releasing a PyPI package with the 3.13 capabilities compiled for 3.12.

A lot of the changes here involve either hiding details behind macros/functions or splitting up some files.
2024-02-13 14:56:49 -07:00
Ken Jin 7cce857622
gh-114058: Foundations of the Tier2 redundancy eliminator (GH-115085)
---------

Co-authored-by: Mark Shannon <9448417+markshannon@users.noreply.github.com>
Co-authored-by: Jules <57632293+JuliaPoo@users.noreply.github.com>
Co-authored-by: Guido van Rossum <gvanrossum@users.noreply.github.com>
2024-02-13 21:24:48 +08:00
Nikita Sobolev ccc76c3e88
gh-108303: Move all pydoc related test files to new test.test_pydoc package (#114506) 2024-02-13 11:40:40 +01:00
Russell Keith-Magee 2f0778675a
gh-114099: Refactor configure and Makefile to accomodate non-macOS frameworks (#115120)
Part of the PEP 730 work to add iOS support.

This change lays the groundwork for introducing iOS/tvOS/watchOS 
frameworks; it includes the structural refactoring needed so that iOS
branches can be added into in a subsequent PR.

Summary of changes:
* Updates config.sub to the 2024-01-01 release. This is the "as 
  released" version of config.sub.
* Adds a RESSRCDIR variable to allow sharing of macOS and iOS Makefile 
  steps.
* Adds an INSTALLTARGETS variable so platforms can customise which
  targets are actually installed. This will be used to exclude certain
  targets (e.g., binaries, manfiles) from iOS framework installs.
* Adds a PYTHONFRAMEWORKINSTALLNAMEPREFIX variable; this is used as
  the install name for the library. This is needed to allow for iOS
  frameworks to specify an @rpath-based install name.
* Evaluates MACHDEP earlier in the configure process so that
  ac_sys_system is available.
* Modifies _PYTHON_HOST_PLATFORM evaluation for cross-platform builds
  so that the CPU architecture is differentiated from the host
  identifier. This will be used to generate a _PYTHON_HOST_PLATFORM
  definition that includes ABI information, not just CPU architecture.
* Differentiates between SOABI_PLATFORM and PLATFORM_TRIPLET.
  SOABI_PLATFORM is used in binary module names, and includes the ABI,
  but not the OS or CPU architecture (e.g.,
  math.cpython-313-iphonesimulator.dylib). PLATFORM_TRIPLET is used
  as the sys._multiarch value, and on iOS will contains the ABI and
  architecture (e.g., iphoneos-arm64). This differentiation hasn't
  historically been needed because while macOS is a multiarch platform,
  it uses a bare darwin as PLATFORM_TRIPLE.
* Removes the use of the deprecated -Wl,-single_module flag when
  compiling macOS frameworks.
* Some whitespace normalisation where there was a mix of spaces and tabs 
  in a single block.
2024-02-13 00:10:24 +01:00
Sam Gross a3af3cb4f4
gh-110481: Implement inter-thread queue for biased reference counting (#114824)
Biased reference counting maintains two refcount fields in each object:
`ob_ref_local` and `ob_ref_shared`. The true refcount is the sum of these two
fields. In some cases, when refcounting operations are split across threads,
the ob_ref_shared field can be negative (although the total refcount must be
at least zero). In this case, the thread that decremented the refcount
requests that the owning thread give up ownership and merge the refcount
fields.
2024-02-09 17:08:32 -05:00
Skip Montanaro 2afc7182e6
gh-114505: Add missing header file dependencies (#114513)
Also move PYTHON_HEADERS up and make _testembed.o depend on it.
2024-02-07 08:50:24 +00:00
Zachary Ware 1032326fe4
gh-114883: Fix Makefile dependency tree for non-jit builds (GH-114884) 2024-02-03 23:16:03 +00:00
Brandt Bucher f6d9e5926b
GH-113464: Add a JIT backend for tier 2 (GH-113465)
Add an option (--enable-experimental-jit for configure-based builds
or --experimental-jit for PCbuild-based ones) to build an
*experimental* just-in-time compiler, based on copy-and-patch (https://fredrikbk.com/publications/copy-and-patch.pdf).

See Tools/jit/README.md for more information on how to install the required build-time tooling.
2024-01-28 18:48:48 -08:00
Sam Gross b52fc70d1a
gh-112529: Implement GC for free-threaded builds (#114262)
* gh-112529: Implement GC for free-threaded builds

This implements a mark and sweep GC for the free-threaded builds of
CPython. The implementation relies on mimalloc to find GC tracked
objects (i.e., "containers").
2024-01-25 10:27:36 -08:00
Nikita Sobolev ba253a4794
gh-108303: Move .whl test files to Lib/test/wheeldata/ (#114343) 2024-01-23 16:33:12 +01:00
Sam Gross 1d6d5e854c
gh-112529: Use GC heaps for GC allocations in free-threaded builds (gh-114157)
* gh-112529: Use GC heaps for GC allocations in free-threaded builds

The free-threaded build's garbage collector implementation will need to
find GC objects by traversing mimalloc heaps. This hooks up the
allocation calls with the correct heaps by using a thread-local
"current_obj_heap" variable.

* Refactor out setting heap based on type
2024-01-21 01:14:45 +09:00
Nikita Sobolev 9c93350f58
gh-108303: Move all doctest related files and tests to Lib/test/test_doctest/ (#112109)
Co-authored-by: Brett Cannon <brett@python.org>
2024-01-18 16:58:11 +01:00
Brandt Bucher 30e6cbdba2
GH-113860: Get rid of _PyUOpExecutorObject (GH-113954) 2024-01-12 11:58:23 +00:00
Donghee Na 57bdc6c30d
gh-111968: Introduce _PyFreeListState and _PyFreeListState_GET API (gh-113584) 2024-01-10 08:04:41 +09:00
Jakub Kulík bc71ae2b97
gh-113688: fix dtrace build on Solaris (#113814)
(the gcmodule -> gc refactoring broke it)
2024-01-08 11:28:09 -08:00
Rami 84d1f76092
gh-89532: Remove LibreSSL workarounds (#28728)
Remove LibreSSL specific workaround ifdefs from `_ssl.c` and delete the non-version-specific `_ssl_data.h` file (relevant for OpenSSL < 1.1.1, which we no longer support per PEP 644).

Co-authored-by: Christian Heimes <christian@python.org>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2024-01-06 23:25:58 +00:00
Sam Gross 99854ce170
gh-113688: Split up gcmodule.c (gh-113715)
This splits part of Modules/gcmodule.c of into Python/gc.c, which
now contains the core garbage collection implementation. The Python
module remain in the Modules/gcmodule.c file.
2024-01-05 12:17:16 -08:00
Sam Gross 31d8757b60
gh-113370: Add missing obmalloc.o dependencies on mimalloc (#113371) 2023-12-21 22:44:55 +01:00
Mark Shannon 723f4d6698
GH-111485: Delete the old generator code. (GH-113321) 2023-12-21 12:46:28 +00:00
Gregory P. Smith 103c4ea274
gh-112305: Fix check-clean-src to detect frozen_modules .h files. (#113344)
A typo left this check broken so many of us who do out-of-tree builds
were seeing strange failures due to bad `Python/frozen_modules/*.h`
files being picked up from the source tree and used at build time from
different Python versions leading to errors like:

`Fatal Python error: _PyImport_InitCore: failed to initialize importlib`

Or similar once our build got to an "invoke the interpreter"
bootstrapping step due to incorrect bytecode being embedded.
2023-12-20 23:32:13 -08:00
Sam Gross a3e8afe0a3
gh-113330: Fix mimalloc headers reference (#113331)
The `MIMALLOC_HEADERS` variable is defined in the Makefile.pre.in, not
the configure script, so we should use the `$(MIMALLOC_HEADERS)` syntax
instead of the `@MIMALLOC_HEADERS@` syntax.
2023-12-20 22:07:17 +01:00
Mark Shannon de8a4e52a5
GH-111485: Generate TARGET table for computed goto dispatch. (GH-113319) 2023-12-20 15:09:12 +00:00
Mark Shannon e96f26083b
GH-111485: Generate instruction and uop metadata (GH-113287) 2023-12-20 14:27:25 +00:00
Barney Gale d91e43ed78
GH-110109: Move tests for pathlib ABCs to new module. (#112904) 2023-12-16 19:04:33 +00:00
Mark Shannon 0c55f27060
GH-111485: Factor out tier 2 code generation from the rest of the interpreter code generator (GH-112968) 2023-12-12 12:12:17 +00:00
Mark Shannon c27e9d5d17
GH-111485: Factor out generation of uop IDs from cases generator. (GH-112877) 2023-12-11 14:14:36 +00:00
Alex Waygood c1652d6d62
gh-110109: Fix installed buildbots now pathlib is a package (#112901) 2023-12-09 18:05:33 +00:00
Mark Shannon aefdebdef1
GH-111485: Factor out opcode ID generator from the main cases generator. (GH-112831) 2023-12-08 11:48:30 +00:00
Sam Gross db460735af
gh-112538: Add internal-only _PyThreadStateImpl "wrapper" for PyThreadState (gh-112560)
Every PyThreadState instance is now actually a _PyThreadStateImpl.
It is safe to cast from `PyThreadState*` to `_PyThreadStateImpl*` and back.
The _PyThreadStateImpl will contain fields that we do not want to expose
in the public C API.
2023-12-07 12:11:45 -07:00
Seth Michael Larson 21221c398f
gh-112302: Add Software Bill-of-Materials (SBOM) tracking for dependencies (#112303) 2023-12-07 18:01:58 +02:00
Mark Shannon b449415b2f
GH-111485: Separate out parsing, analysis and code-gen phases of tier 1 code generator (GH-112299) 2023-12-07 12:49:40 +00:00
Serhiy Storchaka f8c0198e3b
gh-108927: Include new dir test/regrtestdata in the installation (GH-112765)
Co-authored-by: Victor Stinner <vstinner@python.org>
2023-12-06 09:48:27 +02:00
Brett Cannon 37589d76bb
GH-103065, GH-106704, GH-105253: Provide a Tools/wasm/wasi.py script to simplify doing a WASI build (GH-112473) 2023-11-29 16:18:25 -08:00
Guido van Rossum be0bd54c6b
gh-106529: Cleanups split off gh-112134 (#112214)
- Double max trace size to 256
- Add a dependency on executor_cases.c.h for ceval.o
- Mark `_SPECIALIZE_UNPACK_SEQUENCE` as `TIER_ONE_ONLY`
- Add debug output back showing the optimized trace
- Bunch of cleanups to Tools/cases_generator/
2023-11-17 11:49:42 -08:00
Victor Stinner d9fd33a869
gh-112088: Run autoreconf in GHA check_generated_files (#112090)
The "Check if generated files are up to date" job of GitHub Actions
now runs the "autoreconf -ivf -Werror" command instead of the "make
regen-configure" command to avoid depending on the external quay.io
server.

Add Tools/build/regen-configure.sh script to regenerate the configure
with an Ubuntu container image. The
"quay.io/tiran/cpython_autoconf:271" container image
(https://github.com/tiran/cpython_autoconf) is no longer used.
2023-11-15 21:47:14 +01:00
Victor Stinner e5dfcc2b6e
gh-96954: Don't run regen-unicodedata in regen-all (#112120)
The "make regen-unicodedata" should now be run manually. By the
default, it requires an Internet connection, which is not always the
case. Some Linux distributions build Linux packages in isolated
environment (without network).
2023-11-15 18:14:08 +01:00
Miro Hrončok ec05507367
gh-96954: Fix make regen-unicodedata in out-of-tree builds (#112118)
This avoids:

    python3.13 Tools/unicode/makeunicodedata.py
    python3.13: can't open file '.../build/debug/Tools/unicode/makeunicodedata.py': [Errno 2] No such file or directory
    make: *** [Makefile:1498: regen-unicodedata] Error 2

Re-run `make regen-unicodedata` to update the script path in generated files.
2023-11-15 16:42:17 +00:00
Victor Stinner 62802b6228
gh-111545: Add Include/cpython/pyhash.h header file (#112063)
Move non-limited C API to a new Include/cpython/pyhash.h header file.
2023-11-15 01:19:20 +01:00
Nikita Sobolev 65d6dc2715
gh-108303: Install Lib/test/configdata (#111899) 2023-11-10 13:00:50 +01:00
Sam Gross 31c90d5838
gh-111569: Implement Python critical section API (gh-111571)
Critical sections are helpers to replace the global interpreter lock
with finer grained locking.  They provide similar guarantees to the GIL
and avoid the deadlock risk that plain locking involves.  Critical
sections are implicitly ended whenever the GIL would be released.  They
are resumed when the GIL would be acquired.  Nested critical sections
behave as if the sections were interleaved.
2023-11-08 15:39:29 -07:00
CF Bolz-Tereick 9573d14215
gh-96954: use a directed acyclic word graph for storing the unicodedata codepoint names (#97906)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
Co-authored-by: Dennis Sweeney <36520290+sweeneyde@users.noreply.github.com>
2023-11-04 15:56:58 +01:00
Nikita Sobolev 890ef1b035
gh-108303: Move zip and tar archives to Lib/test/archivetestdata (#111549) 2023-11-04 10:57:53 +01:00
Guido van Rossum 7e135a48d6
gh-111520: Integrate the Tier 2 interpreter in the Tier 1 interpreter (#111428)
- There is no longer a separate Python/executor.c file.
- Conventions in Python/bytecodes.c are slightly different -- don't use `goto error`,
  you must use `GOTO_ERROR(error)` (same for others like `unused_local_error`).
- The `TIER_ONE` and `TIER_TWO` symbols are only valid in the generated (.c.h) files.
- In Lib/test/support/__init__.py, `Py_C_RECURSION_LIMIT` is imported from `_testcapi`.
- On Windows, in debug mode, stack allocation grows from 8MiB to 12MiB.
- **Beware!** This changes the env vars to enable uops and their debugging
  to `PYTHON_UOPS` and `PYTHON_LLTRACE`.
2023-11-01 13:13:02 -07:00