Commit a3f6d697 authored by Marius Wachtler's avatar Marius Wachtler

fix closure bugs

parent e14f792a
......@@ -783,7 +783,7 @@ Box* ASTInterpreter::doOSR(AST_Jump* node) {
sorted_symbol_table[source_info->getInternedStrings().get(PASSED_GENERATOR_NAME)] = generator;
if (frame_info.passed_closure)
sorted_symbol_table[source_info->getInternedStrings().get(PASSED_CLOSURE_NAME)] = frame_info.passed_closure;
sorted_symbol_table[source_info->getInternedStrings().get(PASSED_CLOSURE_NAME)] = incref(frame_info.passed_closure);
if (created_closure)
sorted_symbol_table[source_info->getInternedStrings().get(CREATED_CLOSURE_NAME)] = created_closure;
......@@ -1815,8 +1815,11 @@ void ASTInterpreterJitInterface::setLocalClosureHelper(void* _interpreter, long
assert(interpreter->getSymVRegMap()[id] == vreg);
Box* prev = interpreter->vregs[vreg];
interpreter->vregs[vreg] = v;
interpreter->created_closure->elts[interpreter->scope_info->getClosureOffset(id)] = incref(v);
auto closure_offset = interpreter->scope_info->getClosureOffset(id);
Box* prev_closure_elt = interpreter->created_closure->elts[closure_offset];
interpreter->created_closure->elts[closure_offset] = incref(v);
Py_XDECREF(prev);
Py_XDECREF(prev_closure_elt);
}
void ASTInterpreterJitInterface::uncacheExcInfoHelper(void* _interpreter) {
......
......@@ -1311,8 +1311,10 @@ private:
llvm::BasicBlock* fail_bb
= llvm::BasicBlock::Create(g.context, "deref_undefined", irstate->getLLVMFunction());
llvm::Constant* null_value = getNullPtr(g.llvm_value_type_ptr);
emitter.setType(null_value, RefType::BORROWED);
llvm::Value* check_val
= emitter.getBuilder()->CreateICmpEQ(lookupResult, getNullPtr(g.llvm_value_type_ptr));
= emitter.getBuilder()->CreateICmpEQ(lookupResult, null_value);
llvm::BranchInst* non_null_check = emitter.getBuilder()->CreateCondBr(check_val, fail_bb, success_bb);
// Case that it is undefined: call the assert fail function.
......
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