Commit 24b8ce70 authored by Marius Wachtler's avatar Marius Wachtler

deopt: free additional deopt state copy of all object before starting to interpret

parent e07eda8f
......@@ -2046,7 +2046,7 @@ Box* astInterpretFunctionEval(FunctionMetadata* md, Box* globals, Box* boxedLoca
// caution when changing the function arguments: this function gets called from an assembler wrapper!
extern "C" Box* astInterpretDeoptFromASM(FunctionMetadata* md, AST_expr* after_expr, AST_stmt* enclosing_stmt,
Box* expr_val, FrameStackState frame_state) {
Box* expr_val, STOLEN(FrameStackState) frame_state) {
static_assert(sizeof(FrameStackState) <= 2 * 8, "astInterpretDeopt assumes that all args get passed in regs!");
assert(md);
......@@ -2139,6 +2139,10 @@ extern "C" Box* astInterpretDeoptFromASM(FunctionMetadata* md, AST_expr* after_e
assert(starting_statement);
}
// clear the frame_state now that we have initalized the interpreter with it.
// this make sure that we don't have unneccessary references around (e.g. could be a problem for PASSED_GENERATOR)
Py_CLEAR(frame_state.locals);
Box* v = ASTInterpreter::execute(interpreter, start_block, starting_statement);
return v ? v : incref(None);
}
......
......@@ -79,7 +79,7 @@ Box* astInterpretFunction(FunctionMetadata* f, Box* closure, Box* generator, Box
Box* astInterpretFunctionEval(FunctionMetadata* cf, Box* globals, Box* boxedLocals);
// this function is implemented in the src/codegen/ast_interpreter_exec.S assembler file
extern "C" Box* astInterpretDeopt(FunctionMetadata* cf, AST_expr* after_expr, AST_stmt* enclosing_stmt, Box* expr_val,
FrameStackState frame_state);
STOLEN(FrameStackState) frame_state);
struct FrameInfo;
FrameInfo* getFrameInfoForInterpretedFrame(void* frame_ptr);
......
......@@ -148,7 +148,6 @@ extern "C" Box* deopt(AST_expr* expr, Box* value) {
deopt_state.frame_state.frame_info->exc.value = NULL;
}
AUTO_DECREF(deopt_state.frame_state.locals);
return astInterpretDeopt(deopt_state.cf->md, expr, deopt_state.current_stmt, value, deopt_state.frame_state);
}
......
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