Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement _GROW_TIER2_FRAME without adding tier2_extra_size #72

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
01440d3
gh-76785: Simplify Channels XID Types (gh-116318)
ericsnowcurrently Mar 4, 2024
207030f
gh-115320: Refactor `get_hash_info` in `sysmodule.c` not to swallow e…
sobolevn Mar 4, 2024
eb22e2b
gh-115490: Make the interpreter.channels and interpreter.queues Modul…
ericsnowcurrently Mar 4, 2024
88b5c66
gh-116265: Remove obsolete sentence. (#116284)
terryjreedy Mar 4, 2024
58c7919
gh-116029: Fix unused function warning on macOS (#116340)
colesbury Mar 5, 2024
6cddc73
gh-112087: Make list_{slice, ass_slice, subscript} to be threadsafe (…
corona10 Mar 5, 2024
7af063d
GH-116313: get WASI builds to run under wasmtime 18 w/ WASI 0.2/previ…
brettcannon Mar 5, 2024
ffcc450
gh-112075: Enable freeing with qsbr and fallback to lock on key chang…
DinoV Mar 5, 2024
a29998a
gh-116325: Raise `SyntaxError` rather than `IndexError` on ForwardRef…
sobolevn Mar 5, 2024
cbf3d38
GH-115685: Optimize `TO_BOOL` and variants based on truthiness of inp…
markshannon Mar 5, 2024
c91bdf8
gh-116326: Handler errors correctly in `getwindowsversion` in `sysmod…
sobolevn Mar 5, 2024
0c81ce1
GH-115819: Eliminate Boolean guards when value is known (GH-116355)
markshannon Mar 5, 2024
23db9c6
GH-115685: Split `_TO_BOOL_ALWAYS_TRUE` into micro-ops (GH-116352)
markshannon Mar 5, 2024
0064dfa
gh-115777: Fix double versionadded directives (GH-116269)
serhiy-storchaka Mar 5, 2024
df59401
Fix the PyGetSetDef documentation (GH-116056)
serhiy-storchaka Mar 5, 2024
f97f25e
gh-76511: Fix email.Message.as_string() for non-ASCII message with AS…
serhiy-storchaka Mar 5, 2024
bdba8ef
gh-74668: Fix support of bytes in urllib.parse.parse_qsl() (GH-115771)
serhiy-storchaka Mar 5, 2024
4402b3c
gh-76785: Minor Improvements to "interpreters" Module (gh-116328)
ericsnowcurrently Mar 5, 2024
e7ba6e9
chore: fix typos (#116345)
cuishuang Mar 5, 2024
d444dec
Fix debug output for optimized executor (#116337)
gvanrossum Mar 5, 2024
edc9d85
gh-109653: Just import `recursive_repr` in `dataclasses` (gh-109822)
sobolevn Mar 5, 2024
dab85e0
gh-76785: Use PRId64 to Fix a Compiler Warning on Windows (gh-116369)
ericsnowcurrently Mar 5, 2024
72714c0
gh-115103: Enable internal mimalloc assertions in debug builds (#116343)
colesbury Mar 5, 2024
e205c5c
gh-115986: Fix inaccuracies in pprint docs (#116104)
Privat33r-dev Mar 5, 2024
990a5f1
gh-116112: Fix `ResourceWarning` in `test_asyncio.test_stream` (#116371)
sobolevn Mar 5, 2024
e84eeed
Implement _GROW_TIER2_FRAME without adding tier2_extra_size
gvanrossum Mar 5, 2024
b25cf3c
Merge remote-tracking branch 'origin/main' into kenjin/tier2_inliner_…
gvanrossum Mar 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ENV WASI_SDK_VERSION=20
ENV WASI_SDK_PATH=/opt/wasi-sdk

ENV WASMTIME_HOME=/opt/wasmtime
ENV WASMTIME_VERSION=14.0.4
ENV WASMTIME_VERSION=18.0.2
ENV WASMTIME_CPU_ARCH=x86_64

RUN dnf -y --nodocs --setopt=install_weak_deps=False install /usr/bin/{blurb,clang,curl,git,ln,tar,xz} 'dnf-command(builddep)' && \
Expand Down
6 changes: 3 additions & 3 deletions Doc/c-api/structures.rst
Original file line number Diff line number Diff line change
Expand Up @@ -702,20 +702,20 @@ Defining Getters and Setters

.. c:member:: void* closure

Optional function pointer, providing additional data for getter and setter.
Optional user data pointer, providing additional data for getter and setter.

.. c:type:: PyObject *(*getter)(PyObject *, void *)

The ``get`` function takes one :c:expr:`PyObject*` parameter (the
instance) and a function pointer (the associated ``closure``):
instance) and a user data pointer (the associated ``closure``):

It should return a new reference on success or ``NULL`` with a set exception
on failure.

.. c:type:: int (*setter)(PyObject *, PyObject *, void *)

``set`` functions take two :c:expr:`PyObject*` parameters (the instance and
the value to be set) and a function pointer (the associated ``closure``):
the value to be set) and a user data pointer (the associated ``closure``):

In case the attribute should be deleted the second parameter is ``NULL``.
Should return ``0`` on success or ``-1`` with a set exception on failure.
2 changes: 1 addition & 1 deletion Doc/library/asyncio-eventloop.rst
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ Opening network connections
Added support for Windows.

.. versionchanged:: 3.11
The *reuse_address* parameter, disabled since Python 3.9.0, 3.8.1,
The *reuse_address* parameter, disabled since Python 3.8.1,
3.7.6 and 3.6.10, has been entirely removed.

.. coroutinemethod:: loop.create_unix_connection(protocol_factory, \
Expand Down
2 changes: 1 addition & 1 deletion Doc/library/audit_events.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Audit events table

This table contains all events raised by :func:`sys.audit` or
:c:func:`PySys_Audit` calls throughout the CPython runtime and the
standard library. These calls were added in 3.8.0 or later (see :pep:`578`).
standard library. These calls were added in 3.8 or later (see :pep:`578`).

See :func:`sys.addaudithook` and :c:func:`PySys_AddAuditHook` for
information on handling these events.
Expand Down
2 changes: 1 addition & 1 deletion Doc/library/decimal.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1517,7 +1517,7 @@ are also included in the pure Python version for compatibility.
the C version uses a thread-local rather than a coroutine-local context and the value
is ``False``. This is slightly faster in some nested context scenarios.

.. versionadded:: 3.9 backported to 3.7 and 3.8.
.. versionadded:: 3.8.3


Rounding modes
Expand Down
2 changes: 1 addition & 1 deletion Doc/library/idle.rst
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ in an editor window.
The editing features described in previous subsections work when entering
code interactively. IDLE's Shell window also responds to the following:

* :kbd:`C-c` attemps to interrupt statement execution (but may fail).
* :kbd:`C-c` attempts to interrupt statement execution (but may fail).

* :kbd:`C-d` closes Shell if typed at a ``>>>`` prompt.

Expand Down
12 changes: 1 addition & 11 deletions Doc/library/ipaddress.rst
Original file line number Diff line number Diff line change
Expand Up @@ -121,22 +121,12 @@ write code that handles both IP versions correctly. Address objects are
Leading zeros are tolerated, even in ambiguous cases that look like
octal notation.

.. versionchanged:: 3.10
.. versionchanged:: 3.9.5

Leading zeros are no longer tolerated and are treated as an error.
IPv4 address strings are now parsed as strict as glibc
:func:`~socket.inet_pton`.

.. versionchanged:: 3.9.5

The above change was also included in Python 3.9 starting with
version 3.9.5.

.. versionchanged:: 3.8.12

The above change was also included in Python 3.8 starting with
version 3.8.12.

.. attribute:: version

The appropriate version number: ``4`` for IPv4, ``6`` for IPv6.
Expand Down
4 changes: 2 additions & 2 deletions Doc/library/pprint.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Functions
The configuration parameters *stream*, *indent*, *width*, *depth*,
*compact*, *sort_dicts* and *underscore_numbers* are passed to the
:class:`PrettyPrinter` constructor and their meanings are as
described in its documentation above.
described in its documentation below.

>>> import pprint
>>> stuff = ['spam', 'eggs', 'lumberjack', 'knights', 'ni']
Expand All @@ -78,7 +78,7 @@ Functions
Return the formatted representation of *object* as a string. *indent*,
*width*, *depth*, *compact*, *sort_dicts* and *underscore_numbers* are
passed to the :class:`PrettyPrinter` constructor as formatting parameters
and their meanings are as described in its documentation above.
and their meanings are as described in its documentation below.


.. function:: isreadable(object)
Expand Down
6 changes: 3 additions & 3 deletions Doc/library/ssl.rst
Original file line number Diff line number Diff line change
Expand Up @@ -737,11 +737,11 @@ Constants
When Python has been compiled against an older version of OpenSSL, the
flag defaults to *0*.

.. versionadded:: 3.7
.. versionadded:: 3.6.3

.. deprecated:: 3.7
The option is deprecated since OpenSSL 1.1.0. It was added to 2.7.15,
3.6.3 and 3.7.0 for backwards compatibility with OpenSSL 1.0.2.
The option is deprecated since OpenSSL 1.1.0. It was added to 2.7.15 and
3.6.3 for backwards compatibility with OpenSSL 1.0.2.

.. data:: OP_NO_RENEGOTIATION

Expand Down
8 changes: 1 addition & 7 deletions Doc/library/typing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -954,7 +954,6 @@ using ``[]``.
be used for this concept instead. Type checkers should treat the two
equivalently.

.. versionadded:: 3.5.4
.. versionadded:: 3.6.2

.. data:: Self
Expand Down Expand Up @@ -3292,7 +3291,6 @@ Aliases to types in :mod:`collections`

Deprecated alias to :class:`collections.ChainMap`.

.. versionadded:: 3.5.4
.. versionadded:: 3.6.1

.. deprecated:: 3.9
Expand All @@ -3303,7 +3301,6 @@ Aliases to types in :mod:`collections`

Deprecated alias to :class:`collections.Counter`.

.. versionadded:: 3.5.4
.. versionadded:: 3.6.1

.. deprecated:: 3.9
Expand All @@ -3314,7 +3311,6 @@ Aliases to types in :mod:`collections`

Deprecated alias to :class:`collections.deque`.

.. versionadded:: 3.5.4
.. versionadded:: 3.6.1

.. deprecated:: 3.9
Expand Down Expand Up @@ -3389,7 +3385,7 @@ Aliases to container ABCs in :mod:`collections.abc`

Deprecated alias to :class:`collections.abc.Collection`.

.. versionadded:: 3.6.0
.. versionadded:: 3.6

.. deprecated:: 3.9
:class:`collections.abc.Collection` now supports subscripting (``[]``).
Expand Down Expand Up @@ -3681,7 +3677,6 @@ Aliases to :mod:`contextlib` ABCs
Deprecated alias to :class:`contextlib.AbstractContextManager`.

.. versionadded:: 3.5.4
.. versionadded:: 3.6.0

.. deprecated:: 3.9
:class:`contextlib.AbstractContextManager`
Expand All @@ -3692,7 +3687,6 @@ Aliases to :mod:`contextlib` ABCs

Deprecated alias to :class:`contextlib.AbstractAsyncContextManager`.

.. versionadded:: 3.5.4
.. versionadded:: 3.6.2

.. deprecated:: 3.9
Expand Down
2 changes: 1 addition & 1 deletion Include/cpython/code.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ typedef struct {
PyObject *_co_freevars;
} _PyCoCached;

/* Ancilliary data structure used for instrumentation.
/* Ancillary data structure used for instrumentation.
Line instrumentation creates an array of
these. One entry per code unit.*/
typedef struct {
Expand Down
2 changes: 1 addition & 1 deletion Include/internal/pycore_compile.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ int _PyCompile_EnsureArrayLargeEnough(
int _PyCompile_ConstCacheMergeOne(PyObject *const_cache, PyObject **obj);


// Export for '_opcode' extention module
// Export for '_opcode' extension module
PyAPI_FUNC(int) _PyCompile_OpcodeIsValid(int opcode);
PyAPI_FUNC(int) _PyCompile_OpcodeHasArg(int opcode);
PyAPI_FUNC(int) _PyCompile_OpcodeHasConst(int opcode);
Expand Down
31 changes: 0 additions & 31 deletions Include/internal/pycore_frame.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ typedef struct _PyInterpreterFrame {
_Py_CODEUNIT *instr_ptr; /* Instruction currently executing (or about to begin) */
int stacktop; /* Offset of TOS from localsplus */
uint16_t return_offset; /* Only relevant during a function call */
uint16_t tier2_extra_size; /* How many extra entries is at the end of localsplus for tier 2 inlining */
char owner;
/* Locals and stack */
PyObject *localsplus[1];
Expand Down Expand Up @@ -132,7 +131,6 @@ _PyFrame_Initialize(
frame->instr_ptr = _PyCode_CODE(code);
frame->return_offset = 0;
frame->owner = FRAME_OWNED_BY_THREAD;
frame->tier2_extra_size = 0;

for (int i = null_locals_from; i < code->co_nlocalsplus; i++) {
frame->localsplus[i] = NULL;
Expand Down Expand Up @@ -260,35 +258,6 @@ _PyThreadState_PushFrame(PyThreadState *tstate, size_t size);

void _PyThreadState_PopFrame(PyThreadState *tstate, _PyInterpreterFrame *frame);


/* Converts frame for tier 2.
* Adds stack space at the end of the current frame for Tier 2 execution.
* The frame that is being expanded MUST be the current executing frame, and
* it must be at the top of the datastack.
* */
static inline int
_PyFrame_ConvertToTier2(PyThreadState *tstate, _PyInterpreterFrame *frame,
int localsplus_grow)
{
assert(localsplus_grow > 0);
// Already grown previously
if (frame->tier2_extra_size >= localsplus_grow) {
return 0;
}
if (frame->owner != FRAME_OWNED_BY_THREAD) {
return 1;
}
if (!_PyThreadState_HasStackSpace(tstate, localsplus_grow)) {
return 1;
}
assert(_PyThreadState_HasStackSpace(tstate, localsplus_grow));
assert(tstate->current_frame == frame);
tstate->datastack_top += localsplus_grow;
assert(tstate->datastack_top < tstate->datastack_limit);
frame->tier2_extra_size += localsplus_grow;
return 0;
}

/* Pushes a frame without checking for space.
* Must be guarded by _PyThreadState_HasStackSpace()
* Consumes reference to func. */
Expand Down
2 changes: 1 addition & 1 deletion Include/internal/pycore_gc.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ static inline int _PyObject_GC_MAY_BE_TRACKED(PyObject *obj) {

/* True if an object is shared between multiple threads and
* needs special purpose when freeing to do the possibility
* of in-flight lock-free reads occuring */
* of in-flight lock-free reads occurring */
static inline int _PyObject_GC_IS_SHARED(PyObject *op) {
return (op->ob_gc_bits & _PyGC_BITS_SHARED) != 0;
}
Expand Down
2 changes: 1 addition & 1 deletion Include/internal/pycore_instruments.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ extern "C" {
#define PY_MONITORING_EVENT_RERAISE 14


/* Ancilliary events */
/* Ancillary events */

#define PY_MONITORING_EVENT_C_RETURN 15
#define PY_MONITORING_EVENT_C_RAISE 16
Expand Down
2 changes: 1 addition & 1 deletion Include/internal/pycore_interp.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ typedef struct _rare_events {
*/
struct _is {

/* This struct countains the eval_breaker,
/* This struct contains the eval_breaker,
* which is by far the hottest field in this struct
* and should be placed at the beginning. */
struct _ceval_state ceval;
Expand Down
4 changes: 2 additions & 2 deletions Include/internal/pycore_lock.h
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ PyAPI_FUNC(void) _PyRWMutex_Unlock(_PyRWMutex *rwmutex);
// underlying data and then read the sequence number again after reading the data. If the
// sequence has not changed the data is valid.
//
// Differs a little bit in that we use CAS on sequence as the lock, instead of a seperate spin lock.
// Differs a little bit in that we use CAS on sequence as the lock, instead of a separate spin lock.
// The writer can also detect that the undelering data has not changed and abandon the write
// and restore the previous sequence.
typedef struct {
Expand All @@ -284,7 +284,7 @@ PyAPI_FUNC(void) _PySeqLock_LockWrite(_PySeqLock *seqlock);
// Unlock the sequence lock and move to the next sequence number.
PyAPI_FUNC(void) _PySeqLock_UnlockWrite(_PySeqLock *seqlock);

// Abandon the current update indicating that no mutations have occured
// Abandon the current update indicating that no mutations have occurred
// and restore the previous sequence value.
PyAPI_FUNC(void) _PySeqLock_AbandonWrite(_PySeqLock *seqlock);

Expand Down
2 changes: 1 addition & 1 deletion Include/internal/pycore_mimalloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ typedef enum {
# define MI_DEBUG_FREED PYMEM_DEADBYTE
# define MI_DEBUG_PADDING PYMEM_FORBIDDENBYTE
#ifdef Py_DEBUG
# define MI_DEBUG 1
# define MI_DEBUG 2
#else
# define MI_DEBUG 0
#endif
Expand Down
2 changes: 1 addition & 1 deletion Include/internal/pycore_opcode_metadata.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Include/internal/pycore_optimizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,14 @@ extern _Py_UopsSymbol *_Py_uop_sym_new_type(
_Py_UOpsContext *ctx, PyTypeObject *typ);
extern _Py_UopsSymbol *_Py_uop_sym_new_const(_Py_UOpsContext *ctx, PyObject *const_val);
extern _Py_UopsSymbol *_Py_uop_sym_new_null(_Py_UOpsContext *ctx);
extern bool _Py_uop_sym_has_type(_Py_UopsSymbol *sym);
extern bool _Py_uop_sym_matches_type(_Py_UopsSymbol *sym, PyTypeObject *typ);
extern bool _Py_uop_sym_set_null(_Py_UopsSymbol *sym);
extern bool _Py_uop_sym_set_non_null(_Py_UopsSymbol *sym);
extern bool _Py_uop_sym_set_type(_Py_UopsSymbol *sym, PyTypeObject *typ);
extern bool _Py_uop_sym_set_const(_Py_UopsSymbol *sym, PyObject *const_val);
extern bool _Py_uop_sym_is_bottom(_Py_UopsSymbol *sym);
extern int _Py_uop_sym_truthiness(_Py_UopsSymbol *sym);


extern int _Py_uop_abstractcontext_init(_Py_UOpsContext *ctx);
Expand Down
Loading