Commit 6a83f5ea authored by Dag Sverre Seljebotn's avatar Dag Sverre Seljebotn

Fix suboptimal temp usage in BoolBinopNode. For further improvements see #147.

parent fc8b4ed0
...@@ -4048,7 +4048,6 @@ class BoolBinopNode(NewTempExprNode): ...@@ -4048,7 +4048,6 @@ class BoolBinopNode(NewTempExprNode):
def generate_evaluation_code(self, code): def generate_evaluation_code(self, code):
code.mark_pos(self.pos) code.mark_pos(self.pos)
self.allocate_temp_result(code)
self.operand1.generate_evaluation_code(code) self.operand1.generate_evaluation_code(code)
test_result, uses_temp = self.generate_operand1_test(code) test_result, uses_temp = self.generate_operand1_test(code)
if self.operator == 'and': if self.operator == 'and':
...@@ -4063,6 +4062,9 @@ class BoolBinopNode(NewTempExprNode): ...@@ -4063,6 +4062,9 @@ class BoolBinopNode(NewTempExprNode):
code.funcstate.release_temp(test_result) code.funcstate.release_temp(test_result)
self.operand1.generate_disposal_code(code, free_temp=False) self.operand1.generate_disposal_code(code, free_temp=False)
self.operand2.generate_evaluation_code(code) self.operand2.generate_evaluation_code(code)
self.allocate_temp_result(code)
code.putln("%s = %s;" % (self.result(), self.operand2.result())) code.putln("%s = %s;" % (self.result(), self.operand2.result()))
self.operand2.generate_disposal_code(code, decref=False) self.operand2.generate_disposal_code(code, decref=False)
code.putln("} else {") code.putln("} else {")
......
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