Commit 8a46f2e0 authored by Kevin Modzelewski's avatar Kevin Modzelewski Committed by Kevin Modzelewski

A bunch of small fixes

parent e2c3ff8f
...@@ -548,7 +548,7 @@ void Rewriter::_incref(RewriterVar* var, int num_refs) { ...@@ -548,7 +548,7 @@ void Rewriter::_incref(RewriterVar* var, int num_refs) {
if (var->isConstant() && !Rewriter::isLargeConstant(var->constant_value)) { if (var->isConstant() && !Rewriter::isLargeConstant(var->constant_value)) {
for (int i = 0; i < num_refs; i++) { for (int i = 0; i < num_refs; i++) {
assembler->incq(assembler::Immediate(var->constant_value)); assembler->incq(assembler::Immediate((uint64_t)var->constant_value + offsetof(Box, ob_refcnt)));
} }
} else { } else {
auto reg = var->getInReg(); auto reg = var->getInReg();
......
...@@ -1945,6 +1945,8 @@ private: ...@@ -1945,6 +1945,8 @@ private:
if (prev) { if (prev) {
auto load = emitter.getBuilder()->CreateLoad(gep); auto load = emitter.getBuilder()->CreateLoad(gep);
emitter.setType(load, RefType::OWNED); emitter.setType(load, RefType::OWNED);
if (maybe_was_undefined)
emitter.setNullable(load, true);
} }
llvm::Value* v = val->makeConverted(emitter, UNKNOWN)->getValue(); llvm::Value* v = val->makeConverted(emitter, UNKNOWN)->getValue();
auto store = emitter.getBuilder()->CreateStore(v, gep); auto store = emitter.getBuilder()->CreateStore(v, gep);
......
...@@ -443,6 +443,7 @@ static int main(int argc, char** argv) noexcept { ...@@ -443,6 +443,7 @@ static int main(int argc, char** argv) noexcept {
Box* module = PyImport_ImportModule("site"); Box* module = PyImport_ImportModule("site");
if (!module) if (!module)
throwCAPIException(); throwCAPIException();
Py_DECREF(module);
} catch (ExcInfo e) { } catch (ExcInfo e) {
e.printExcAndTraceback(); e.printExcAndTraceback();
e.clear(); e.clear();
......
...@@ -222,8 +222,7 @@ BORROWED(Box*) getFrame(int depth) { ...@@ -222,8 +222,7 @@ BORROWED(Box*) getFrame(int depth) {
void frameInvalidateBack(BoxedFrame* frame) { void frameInvalidateBack(BoxedFrame* frame) {
RELEASE_ASSERT(!frame->hasExited(), "should not happen"); RELEASE_ASSERT(!frame->hasExited(), "should not happen");
assert(!frame->_back && "have to decref it"); Py_CLEAR(frame->_back);
frame->_back = NULL;
} }
extern "C" void initFrame(FrameInfo* frame_info) { extern "C" void initFrame(FrameInfo* frame_info) {
......
...@@ -5,7 +5,7 @@ def smallest(): ...@@ -5,7 +5,7 @@ def smallest():
n = n * 0.99 n = n * 0.99
return n return n
for i in xrange(1000): for i in xrange(100):
print smallest() print smallest()
def test(x): def test(x):
......
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