forked from python/cpython
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/main' into funcflags
- Loading branch information
Showing
55 changed files
with
1,523 additions
and
878 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
|
||
#ifndef Py_LIMITED_API | ||
#ifndef Py_OPTIMIZER_H | ||
#define Py_OPTIMIZER_H | ||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
typedef struct { | ||
uint8_t opcode; | ||
uint8_t oparg; | ||
} _PyVMData; | ||
|
||
typedef struct _PyExecutorObject { | ||
PyObject_HEAD | ||
/* WARNING: execute consumes a reference to self. This is necessary to allow executors to tail call into each other. */ | ||
struct _PyInterpreterFrame *(*execute)(struct _PyExecutorObject *self, struct _PyInterpreterFrame *frame, PyObject **stack_pointer); | ||
_PyVMData vm_data; /* Used by the VM, but opaque to the optimizer */ | ||
/* Data needed by the executor goes here, but is opaque to the VM */ | ||
} _PyExecutorObject; | ||
|
||
typedef struct _PyOptimizerObject _PyOptimizerObject; | ||
|
||
typedef _PyExecutorObject *(*optimize_func)(_PyOptimizerObject* self, PyCodeObject *code, _Py_CODEUNIT *instr); | ||
|
||
typedef struct _PyOptimizerObject { | ||
PyObject_HEAD | ||
optimize_func optimize; | ||
uint16_t resume_threshold; | ||
uint16_t backedge_threshold; | ||
/* Data needed by the optimizer goes here, but is opaque to the VM */ | ||
} _PyOptimizerObject; | ||
|
||
PyAPI_FUNC(int) PyUnstable_Replace_Executor(PyCodeObject *code, _Py_CODEUNIT *instr, _PyExecutorObject *executor); | ||
|
||
PyAPI_FUNC(void) PyUnstable_SetOptimizer(_PyOptimizerObject* optimizer); | ||
|
||
PyAPI_FUNC(_PyOptimizerObject *) PyUnstable_GetOptimizer(void); | ||
|
||
struct _PyInterpreterFrame * | ||
_PyOptimizer_BackEdge(struct _PyInterpreterFrame *frame, _Py_CODEUNIT *src, _Py_CODEUNIT *dest, PyObject **stack_pointer); | ||
|
||
extern _PyOptimizerObject _PyOptimizer_Default; | ||
|
||
/* For testing */ | ||
PyAPI_FUNC(PyObject *)PyUnstable_Optimizer_NewCounter(void); | ||
|
||
#define OPTIMIZER_BITS_IN_COUNTER 4 | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
#endif /* !Py_OPTIMIZER_H */ | ||
#endif /* Py_LIMITED_API */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.