-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
bpo-47177: Replace f_lasti
with prev_instr
#32208
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
Changes from 1 commit
f7662cd
840e14c
804d95d
16695dc
664e3eb
2de283b
cd1aab7
1d77eb3
1dd3ec5
725d34c
86ed96b
5251e0a
90a4c5a
670b94b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1247,13 +1247,13 @@ eval_frame_handle_pending(PyThreadState *tstate) | |
#ifdef Py_STATS | ||
#define INSTRUCTION_START(op) \ | ||
do { \ | ||
frame->last_instr = next_instr++; \ | ||
frame->next_instr = ++next_instr; \ | ||
OPCODE_EXE_INC(op); \ | ||
_py_stats.opcode_stats[lastopcode].pair_count[op]++; \ | ||
lastopcode = op; \ | ||
} while (0) | ||
#else | ||
#define INSTRUCTION_START(op) (frame->last_instr = next_instr++) | ||
#define INSTRUCTION_START(op) (frame->next_instr = ++next_instr) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here's something to consider. Rather that storing It would also simplify the changes as you wouldn't need to change all the offsets by one. Thoughts? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Interesting. I'll try that out in another branch. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The performance numbers show no difference between that branch and this one. The other branch does result in a net reduction of "adjust by 1" moves, so I think I slightly prefer it. Thoughts? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I prefer the other version. It should be quicker, and feels less intrusive. I'm not surprised that there is no measurable difference in performance, I would expect it to be very slight. |
||
#endif | ||
|
||
#if USE_COMPUTED_GOTOS | ||
|
@@ -1644,7 +1644,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int | |
} \ | ||
assert(_PyInterpreterFrame_LASTI(frame) >= -1); \ | ||
/* Jump back to the last instruction executed... */ \ | ||
next_instr = frame->last_instr + 1; \ | ||
next_instr = frame->next_instr; \ | ||
stack_pointer = _PyFrame_GetStackPointer(frame); \ | ||
/* Set stackdepth to -1. \ | ||
Update when returning or calling trace function. \ | ||
|
@@ -2195,7 +2195,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int | |
new_frame->localsplus[i] = NULL; | ||
} | ||
_PyFrame_SetStackPointer(frame, stack_pointer); | ||
frame->last_instr += INLINE_CACHE_ENTRIES_BINARY_SUBSCR; | ||
frame->next_instr += INLINE_CACHE_ENTRIES_BINARY_SUBSCR; | ||
new_frame->previous = frame; | ||
frame = cframe.current_frame = new_frame; | ||
CALL_STAT_INC(inlined_py_calls); | ||
|
@@ -2599,7 +2599,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int | |
if (oparg) { | ||
PyObject *lasti = PEEK(oparg + 1); | ||
if (PyLong_Check(lasti)) { | ||
frame->last_instr = first_instr + PyLong_AsLong(lasti); | ||
frame->next_instr = first_instr + PyLong_AsLong(lasti) + 1; | ||
assert(!_PyErr_Occurred(tstate)); | ||
} | ||
else { | ||
|
@@ -4611,7 +4611,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int | |
goto error; | ||
} | ||
_PyFrame_SetStackPointer(frame, stack_pointer); | ||
frame->last_instr += INLINE_CACHE_ENTRIES_CALL; | ||
frame->next_instr += INLINE_CACHE_ENTRIES_CALL; | ||
brandtbucher marked this conversation as resolved.
Show resolved
Hide resolved
|
||
new_frame->previous = frame; | ||
cframe.current_frame = frame = new_frame; | ||
CALL_STAT_INC(inlined_py_calls); | ||
|
@@ -4716,7 +4716,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int | |
} | ||
STACK_SHRINK(2-is_meth); | ||
_PyFrame_SetStackPointer(frame, stack_pointer); | ||
frame->last_instr += INLINE_CACHE_ENTRIES_CALL; | ||
frame->next_instr += INLINE_CACHE_ENTRIES_CALL; | ||
new_frame->previous = frame; | ||
frame = cframe.current_frame = new_frame; | ||
goto start_frame; | ||
|
@@ -4756,7 +4756,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int | |
} | ||
STACK_SHRINK(2-is_meth); | ||
_PyFrame_SetStackPointer(frame, stack_pointer); | ||
frame->last_instr += INLINE_CACHE_ENTRIES_CALL; | ||
frame->next_instr += INLINE_CACHE_ENTRIES_CALL; | ||
new_frame->previous = frame; | ||
frame = cframe.current_frame = new_frame; | ||
goto start_frame; | ||
|
@@ -5414,7 +5414,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int | |
{ | ||
if (tstate->tracing == 0) { | ||
int instr_prev = _PyInterpreterFrame_LASTI(frame); | ||
frame->last_instr = next_instr; | ||
frame->next_instr = next_instr + 1; | ||
TRACING_NEXTOPARG(); | ||
switch(opcode) { | ||
case COPY_FREE_VARS: | ||
|
@@ -6740,7 +6740,7 @@ maybe_call_line_trace(Py_tracefunc func, PyObject *obj, | |
(_PyInterpreterFrame_LASTI(frame) < instr_prev && | ||
// SEND has no quickened forms, so no need to use _PyOpcode_Deopt | ||
// here: | ||
_Py_OPCODE(*frame->last_instr) != SEND); | ||
_Py_OPCODE(frame->next_instr[-1]) != SEND); | ||
if (trace) { | ||
result = call_trace(func, obj, tstate, frame, PyTrace_LINE, Py_None); | ||
< A20F /td> | } | |
|
Uh oh!
There was an error while loading. Please reload this page.