summaryrefslogtreecommitdiffstats
path: root/Python/ceval.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/ceval.c')
-rw-r--r--Python/ceval.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index beee532..9a608f0 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -189,7 +189,7 @@ lltrace_instruction(_PyInterpreterFrame *frame,
dump_stack(frame, stack_pointer);
const char *opname = _PyOpcode_OpName[opcode];
assert(opname != NULL);
- int offset = (int)(next_instr - _PyCode_CODE(_PyFrame_GetCode(frame)));
+ int offset = (int)(next_instr - _PyFrame_GetBytecode(frame));
if (OPCODE_HAS_ARG((int)_PyOpcode_Deopt[opcode])) {
printf("%d: %s %d\n", offset * 2, opname, oparg);
}
@@ -841,6 +841,19 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
}
/* Because this avoids the RESUME,
* we need to update instrumentation */
+#ifdef Py_GIL_DISABLED
+ /* Load thread-local bytecode */
+ if (frame->tlbc_index != ((_PyThreadStateImpl *)tstate)->tlbc_index) {
+ _Py_CODEUNIT *bytecode =
+ _PyEval_GetExecutableCode(tstate, _PyFrame_GetCode(frame));
+ if (bytecode == NULL) {
+ goto error;
+ }
+ ptrdiff_t off = frame->instr_ptr - _PyFrame_GetBytecode(frame);
+ frame->tlbc_index = ((_PyThreadStateImpl *)tstate)->tlbc_index;
+ frame->instr_ptr = bytecode + off;
+ }
+#endif
_Py_Instrument(_PyFrame_GetCode(frame), tstate->interp);
monitor_throw(tstate, frame, frame->instr_ptr);
/* TO DO -- Monitor throw entry. */
@@ -983,7 +996,7 @@ exception_unwind:
Python main loop. */
PyObject *exc = _PyErr_GetRaisedException(tstate);
PUSH(PyStackRef_FromPyObjectSteal(exc));
- next_instr = _PyCode_CODE(_PyFrame_GetCode(frame)) + handler;
+ next_instr = _PyFrame_GetBytecode(frame) + handler;
if (monitor_handled(tstate, frame, next_instr, exc) < 0) {
goto exception_unwind;
@@ -1045,6 +1058,8 @@ enter_tier_two:
#undef ENABLE_SPECIALIZATION
#define ENABLE_SPECIALIZATION 0
+#undef ENABLE_SPECIALIZATION_FT
+#define ENABLE_SPECIALIZATION_FT 0
#ifdef Py_DEBUG
#define DPRINTF(level, ...) \
@@ -1139,7 +1154,7 @@ exit_to_tier1_dynamic:
goto goto_to_tier1;
exit_to_tier1:
assert(next_uop[-1].format == UOP_FORMAT_TARGET);
- next_instr = next_uop[-1].target + _PyCode_CODE(_PyFrame_GetCode(frame));
+ next_instr = next_uop[-1].target + _PyFrame_GetBytecode(frame);
goto_to_tier1:
#ifdef Py_DEBUG
if (lltrace >= 2) {
@@ -1764,7 +1779,7 @@ _PyEvalFramePushAndInit(PyThreadState *tstate, _PyStackRef func,
if (frame == NULL) {
goto fail;
}
- _PyFrame_Initialize(frame, func, locals, code, 0, previous);
+ _PyFrame_Initialize(tstate, frame, func, locals, code, 0, previous);
if (initialize_locals(tstate, func_obj, frame->localsplus, args, argcount, kwnames)) {
assert(frame->owner == FRAME_OWNED_BY_THREAD);
clear_thread_frame(tstate, frame);