Commit b4ece352 authored by Marius Wachtler's avatar Marius Wachtler

microptimization: reduce number of calls to BoxedFrame::handleFrameExit

by decrefing frame_info->exc earlier this will less often be true:
if (frame->ob_refcnt > 1)
    frame->handleFrameExit();
parent 0611d82f
...@@ -271,6 +271,12 @@ extern "C" void deinitFrame(FrameInfo* frame_info) noexcept { ...@@ -271,6 +271,12 @@ extern "C" void deinitFrame(FrameInfo* frame_info) noexcept {
PyErr_Clear(); PyErr_Clear();
} }
if (frame_info->exc.type) {
Py_CLEAR(frame_info->exc.type);
Py_CLEAR(frame_info->exc.value);
Py_CLEAR(frame_info->exc.traceback);
}
assert(cur_thread_state.frame_info == frame_info); assert(cur_thread_state.frame_info == frame_info);
cur_thread_state.frame_info = frame_info->back; cur_thread_state.frame_info = frame_info->back;
BoxedFrame* frame = frame_info->frame_obj; BoxedFrame* frame = frame_info->frame_obj;
...@@ -289,12 +295,6 @@ extern "C" void deinitFrame(FrameInfo* frame_info) noexcept { ...@@ -289,12 +295,6 @@ extern "C" void deinitFrame(FrameInfo* frame_info) noexcept {
Py_CLEAR(frame_info->boxedLocals); Py_CLEAR(frame_info->boxedLocals);
if (frame_info->exc.type) {
Py_CLEAR(frame_info->exc.type);
Py_CLEAR(frame_info->exc.value);
Py_CLEAR(frame_info->exc.traceback);
}
Py_CLEAR(frame_info->globals); Py_CLEAR(frame_info->globals);
assert(!PyErr_Occurred()); assert(!PyErr_Occurred());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment