Buffer first assignment refcount optimization
authorDag Sverre Seljebotn <dagss@student.matnat.uio.no>
Sun, 20 Jul 2008 12:37:04 +0000 (14:37 +0200)
committerDag Sverre Seljebotn <dagss@student.matnat.uio.no>
Sun, 20 Jul 2008 12:37:04 +0000 (14:37 +0200)
Cython/Compiler/Buffer.py

index 97bd6e00640dd672d4d5628ae53961ee28270892..4b1d630e94da5fb7c5d81d8c4ac3454d60a22938 100644 (file)
@@ -205,6 +205,13 @@ class BufferTransform(CythonTransform):
             u"ACQUIRE": StatListNode(node.pos, stats=acquire_stats),
             u"BUFINFO": NameNode(pos=node.pos, name=buffer_aux.buffer_info_var.name)
         }, pos=node.pos)
+        # Preserve first assignment info on LHS
+        if node.first:
+            # TODO: Prettier code
+            print acq.stats[4].dump()
+            acq.stats[4].first = True
+            del acq.stats[0]
+            del acq.stats[0]
         # Note: The below should probably be refactored into something
         # like fragment.substitute(..., context=self.context), with
         # TreeFragment getting context.pipeline_until_now() and