Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Prev Previous commit
Next Next commit
Address review comments.
  • Loading branch information
markshannon committed Jun 1, 2023
commit 2eeebbad332f2490fb114df15dc6c9c4baed242f
4 changes: 2 additions & 2 deletions Include/cpython/code.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ typedef struct {
} _PyCoLineInstrumentationData;


typedef struct _PyExecutorArray {
typedef struct {
int size;
int capacity;
struct _PyExecutorObject *executors[1];
Expand Down Expand Up @@ -160,7 +160,7 @@ typedef struct {
PyObject *co_qualname; /* unicode (qualname, for reference) */ \
PyObject *co_linetable; /* bytes object that holds location info */ \
PyObject *co_weakreflist; /* to support weakrefs to code objects */ \
_PyExecutorArray *co_executors; /* excecutors from optimizer */ \
_PyExecutorArray *co_executors; /* executors from optimizer */ \
_PyCoCached *_co_cached; /* cached co_* attributes */ \
uint64_t _co_instrumentation_version; /* current instrumentation version */ \
_PyCoMonitoringData *_co_monitoring; /* Monitoring data */ \
Expand Down
3 changes: 0 additions & 3 deletions Include/cpython/optimizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,8 @@ extern "C" {
typedef struct {
uint8_t opcode;
uint8_t oparg;
uint16_t _;
} _PyVMData;

typedef uint32_t _PyOptimizerCapabilities; /* Data used by the VM for executor object management */

typedef struct _PyExecutorObject {
PyObject_HEAD
/* WARNING: execute consumes a reference to self. This is necessary to allow executors to tail call into each other. */
Expand Down
1 change: 0 additions & 1 deletion Include/internal/pycore_interp.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ extern "C" {
#include "pycore_typeobject.h" // struct type_cache
#include "pycore_unicodeobject.h" // struct _Py_unicode_state
#include "pycore_warnings.h" // struct _warnings_runtime_state
#include "cpython/optimizer.h"


struct _Py_long_state {
Expand Down
2 changes: 1 addition & 1 deletion Python/bytecodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -2115,7 +2115,7 @@ dummy_func(
}

inst(JUMP_BACKWARD, (--)) {
Comment thread
markshannon marked this conversation as resolved.
_Py_CODEUNIT *here = next_instr-1;
_Py_CODEUNIT *here = next_instr - 1;
assert(oparg <= INSTR_OFFSET());
JUMPBY(1-oparg);
Comment thread
markshannon marked this conversation as resolved.
here[1].cache += (1 << OPTIMIZER_BITS_IN_COUNTER);
Expand Down
2 changes: 1 addition & 1 deletion Python/generated_cases.c.h

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

8 changes: 4 additions & 4 deletions Python/optimizer.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ error_optimize(

static PyTypeObject DefaultOptimizer_Type = {
PyVarObject_HEAD_INIT(&PyType_Type, 0)
.tp_name = "No-op optimizer",
.tp_name = "noop_optimizer",
.tp_basicsize = sizeof(_PyOptimizerObject),
.tp_itemsize = 0,
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_DISALLOW_INSTANTIATION,
Expand Down Expand Up @@ -157,12 +157,12 @@ _PyOptimizer_BackEdge(_PyInterpreterFrame *frame, _Py_CODEUNIT *src, _Py_CODEUNI
/** Test support **/


typedef struct _PyCounterOptimizerObject {
typedef struct {
_PyOptimizerObject base;
int64_t count;
} _PyCounterOptimizerObject;

typedef struct _PyCounterExecutorObject {
typedef struct {
_PyExecutorObject executor;
_PyCounterOptimizerObject *optimizer;
_Py_CODEUNIT *next_instr;
Expand All @@ -176,7 +176,7 @@ counter_dealloc(_PyCounterExecutorObject *self) {

static PyTypeObject CounterExecutor_Type = {
PyVarObject_HEAD_INIT(&PyType_Type, 0)
.tp_name = "Test executor",
.tp_name = "counting_executor",
.tp_basicsize = sizeof(_PyCounterExecutorObject),
.tp_itemsize = 0,
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_DISALLOW_INSTANTIATION,
Expand Down
2 changes: 1 addition & 1 deletion Python/pystate.c
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ init_interpreter(PyInterpreterState *interp,
}
interp->sys_profile_initialized = false;
interp->sys_trace_initialized = false;
interp->optimizer= &_PyOptimizer_Default;
interp->optimizer = &_PyOptimizer_Default;
interp->optimizer_backedge_threshold = _PyOptimizer_Default.backedge_threshold;
interp->optimizer_resume_threshold = _PyOptimizer_Default.backedge_threshold;
if (interp != &runtime->_main_interpreter) {
Expand Down