[pypy-commit] pypy exctrans: create gc header during databasing instead of during sourcing
rlamy
pypy.commits at gmail.com
Wed Dec 30 06:51:35 EST 2015
Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: exctrans
Changeset: r81500:adc26e26c112
Date: 2015-12-30 04:14 +0100
http://bitbucket.org/pypy/pypy/changeset/adc26e26c112/
Log: create gc header during databasing instead of during sourcing
diff --git a/rpython/translator/c/node.py b/rpython/translator/c/node.py
--- a/rpython/translator/c/node.py
+++ b/rpython/translator/c/node.py
@@ -539,7 +539,17 @@
class StructNode(ContainerNode):
nodekind = 'struct'
if USESLOTS:
- __slots__ = ()
+ __slots__ = ('gc_init',)
+
+ def __init__(self, db, T, obj):
+ ContainerNode.__init__(self, db, T, obj)
+ if needs_gcheader(T):
+ gct = self.db.gctransformer
+ if gct is not None:
+ self.gc_init = gct.gcheader_initdata(self)
+ db.getcontainernode(self.gc_init)
+ else:
+ self.gc_init = None
def basename(self):
T = self.getTYPE()
@@ -566,12 +576,7 @@
data = []
if needs_gcheader(T):
- gct = defnode.db.gctransformer
- if gct is not None:
- gc_init = gct.gcheader_initdata(self)
- else:
- gc_init = None
- data.append(('gcheader', gc_init))
+ data.append(('gcheader', self.gc_init))
for name in defnode.fieldnames:
data.append((name, getattr(self.obj, name)))
@@ -664,7 +669,17 @@
class ArrayNode(ContainerNode):
nodekind = 'array'
if USESLOTS:
- __slots__ = ()
+ __slots__ = ('gc_init',)
+
+ def __init__(self, db, T, obj):
+ ContainerNode.__init__(self, db, T, obj)
+ if needs_gcheader(T):
+ gct = self.db.gctransformer
+ if gct is not None:
+ self.gc_init = gct.gcheader_initdata(self)
+ db.getcontainernode(self.gc_init)
+ else:
+ self.gc_init = None
def getptrname(self):
if barebonearray(self.getTYPE()):
@@ -684,12 +699,7 @@
T = self.getTYPE()
yield '{'
if needs_gcheader(T):
- gct = self.db.gctransformer
- if gct is not None:
- gc_init = gct.gcheader_initdata(self)
- else:
- gc_init = None
- lines = generic_initializationexpr(self.db, gc_init, 'gcheader',
+ lines = generic_initializationexpr(self.db, self.gc_init, 'gcheader',
'%sgcheader' % (decoration,))
for line in lines:
yield line
More information about the pypy-commit
mailing list