Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

GH-132554: "Virtual" iterators#132555

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
markshannon wants to merge26 commits intopython:main
base:main
Choose a base branch
Loading
fromfaster-cpython:virtual-iterators
Open
Show file tree
Hide file tree
Changes fromall commits
Commits
Show all changes
26 commits
Select commitHold shift + click to select a range
7476442
FOR_ITER now pushes NULL as well as the iterator. Preparation for vir…
markshannonApr 10, 2025
38a429f
use tagged ints for indexes. Work in progress
markshannonApr 11, 2025
2caf56f
Remove debug code
markshannonApr 15, 2025
588943a
Regenerate files
markshannonApr 15, 2025
aa62e39
Tidy up list of non-escaping functions
markshannonApr 16, 2025
88562ec
Fix up list iteration for FT build
markshannonApr 16, 2025
025049d
Fix tier 2 FT build
markshannonApr 16, 2025
35e389d
Remove debugging code
markshannonApr 30, 2025
e8f4ce6
Merge branch 'main' into virtual-iterators
markshannonApr 30, 2025
ed89950
Rename function
markshannonApr 30, 2025
ec8d797
Restrict specialization in free-threaded build
markshannonApr 30, 2025
cad1946
Merge branch 'main' into virtual-iterators
markshannonApr 30, 2025
428735b
Add news
markshannonApr 30, 2025
4c83848
handle tagged ints when doing type checks
markshannonApr 30, 2025
f43ccc3
Fix long check
markshannonApr 30, 2025
3fd46c3
Attempt to make _PyForIter_NextWithIndex thread safe.
markshannonApr 30, 2025
433282f
Add review comment
markshannonApr 30, 2025
e915a05
Simplify list indexing code
markshannonMay 8, 2025
69a328d
Merge branch 'main' into virtual-iterators
markshannonMay 8, 2025
6d1b93e
GET_ITER may leave the iterable on the stack
markshannonMay 8, 2025
37ca285
Fix test_dis
markshannonMay 8, 2025
f3b9074
Merge branch 'main' into virtual-iterators
markshannonMay 19, 2025
0efab59
Merge branch 'main' into virtual-iterators
markshannonMay 20, 2025
a0d814b
Merge branch 'main' into virtual-iterators
markshannonMay 22, 2025
5cd55c4
Merge branch 'main' into virtual-iterators
markshannonMay 22, 2025
867bd10
Merge branch 'main' into virtual-iterators
markshannonMay 22, 2025
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: 2 additions & 0 deletionsInclude/internal/pycore_ceval.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -353,6 +353,8 @@ PyAPI_FUNC(_PyStackRef) _PyFloat_FromDouble_ConsumeInputs(_PyStackRef left, _PyS
extern int _PyRunRemoteDebugger(PyThreadState *tstate);
#endif

_PyStackRef _PyForIter_NextWithIndex(PyObject *seq, _PyStackRef index);

#ifdef __cplusplus
}
#endif
Expand Down
2 changes: 1 addition & 1 deletionInclude/internal/pycore_code.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -313,7 +313,7 @@ extern void _Py_Specialize_CompareOp(_PyStackRef lhs, _PyStackRef rhs,
_Py_CODEUNIT *instr, int oparg);
extern void _Py_Specialize_UnpackSequence(_PyStackRef seq, _Py_CODEUNIT *instr,
int oparg);
extern void _Py_Specialize_ForIter(_PyStackRef iter, _Py_CODEUNIT *instr, int oparg);
extern void _Py_Specialize_ForIter(_PyStackRef iter,_PyStackRef null_or_index,_Py_CODEUNIT *instr, int oparg);
extern void _Py_Specialize_Send(_PyStackRef receiver, _Py_CODEUNIT *instr);
extern void _Py_Specialize_ToBool(_PyStackRef value, _Py_CODEUNIT *instr);
extern void _Py_Specialize_ContainsOp(_PyStackRef value, _Py_CODEUNIT *instr);
Expand Down
1 change: 1 addition & 0 deletionsInclude/internal/pycore_compile.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -95,6 +95,7 @@ typedef enum {
enum _PyCompile_FBlockType {
COMPILE_FBLOCK_WHILE_LOOP,
COMPILE_FBLOCK_FOR_LOOP,
COMPILE_FBLOCK_ASYNC_FOR_LOOP,
COMPILE_FBLOCK_TRY_EXCEPT,
COMPILE_FBLOCK_FINALLY_TRY,
COMPILE_FBLOCK_FINALLY_END,
Expand Down
4 changes: 3 additions & 1 deletionInclude/internal/pycore_magic_number.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -279,6 +279,8 @@ Known values:
Python 3.14b1 3624 (Don't optimize LOAD_FAST when local is killed by DELETE_FAST)
Python 3.15a0 3650 (Initial version)
Python 3.15a1 3651 (Simplify LOAD_CONST)
Python 3.15a1 3652 (Virtual iterators)


Python 3.16 will start with 3700

Expand All@@ -291,7 +293,7 @@ PC/launcher.c must also be updated.

*/

#define PYC_MAGIC_NUMBER3651
#define PYC_MAGIC_NUMBER3652
/* This is equivalent to converting PYC_MAGIC_NUMBER to 2 bytes
(little-endian) and then appending b'\r\n'. */
#define PYC_MAGIC_NUMBER_TOKEN \
Expand Down
40 changes: 20 additions & 20 deletionsInclude/internal/pycore_opcode_metadata.h
View file
Open in desktop

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

37 changes: 36 additions & 1 deletionInclude/internal/pycore_stackref.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -232,6 +232,9 @@ extern intptr_t PyStackRef_UntagInt(_PyStackRef ref);

extern _PyStackRef PyStackRef_TagInt(intptr_t i);

/* Increments a tagged int, but does not check for overflow */
extern _PyStackRef PyStackRef_IncrementTaggedIntNoOverflow(_PyStackRef ref);

extern bool
PyStackRef_IsNullOrInt(_PyStackRef ref);

Expand DownExpand Up@@ -262,6 +265,14 @@ PyStackRef_UntagInt(_PyStackRef i)
}


static inline _PyStackRef
PyStackRef_IncrementTaggedIntNoOverflow(_PyStackRef ref)
{
assert(ref.bits != (uintptr_t)-1); // Deosn't overflow
return (_PyStackRef){ .bits = ref.bits + 4 };
}


#ifdef Py_GIL_DISABLED

#define Py_TAG_DEFERRED Py_TAG_REFCNT
Expand DownExpand Up@@ -678,7 +689,13 @@ PyStackRef_XCLOSE(_PyStackRef ref)

#endif // !defined(Py_GIL_DISABLED) && defined(Py_STACKREF_DEBUG)

#define PyStackRef_TYPE(stackref) Py_TYPE(PyStackRef_AsPyObjectBorrow(stackref))
static inline PyTypeObject *
PyStackRef_TYPE(_PyStackRef stackref) {
if (PyStackRef_IsTaggedInt(stackref)) {
return &PyLong_Type;
}
return Py_TYPE(PyStackRef_AsPyObjectBorrow(stackref));
}

// Converts a PyStackRef back to a PyObject *, converting the
// stackref to a new reference.
Expand All@@ -689,36 +706,54 @@ PyStackRef_XCLOSE(_PyStackRef ref)
static inline bool
PyStackRef_GenCheck(_PyStackRef stackref)
{
if (PyStackRef_IsTaggedInt(stackref)) {
return false;
}
return PyGen_Check(PyStackRef_AsPyObjectBorrow(stackref));
}

static inline bool
PyStackRef_BoolCheck(_PyStackRef stackref)
{
if (PyStackRef_IsTaggedInt(stackref)) {
return false;
}
return PyBool_Check(PyStackRef_AsPyObjectBorrow(stackref));
}

static inline bool
PyStackRef_LongCheck(_PyStackRef stackref)
{
if (PyStackRef_IsTaggedInt(stackref)) {
return true;
}
return PyLong_Check(PyStackRef_AsPyObjectBorrow(stackref));
}

static inline bool
PyStackRef_ExceptionInstanceCheck(_PyStackRef stackref)
{
if (PyStackRef_IsTaggedInt(stackref)) {
return false;
}
return PyExceptionInstance_Check(PyStackRef_AsPyObjectBorrow(stackref));
}

static inline bool
PyStackRef_CodeCheck(_PyStackRef stackref)
{
if (PyStackRef_IsTaggedInt(stackref)) {
return false;
}
return PyCode_Check(PyStackRef_AsPyObjectBorrow(stackref));
}

static inline bool
PyStackRef_FunctionCheck(_PyStackRef stackref)
{
if (PyStackRef_IsTaggedInt(stackref)) {
return false;
}
return PyFunction_Check(PyStackRef_AsPyObjectBorrow(stackref));
}

Expand Down
1 change: 1 addition & 0 deletionsInclude/internal/pycore_uop_ids.h
View file
Open in desktop

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

6 changes: 5 additions & 1 deletionInclude/internal/pycore_uop_metadata.h
View file
Open in desktop

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

Loading
Loading

[8]ページ先頭

©2009-2025 Movatter.jp