[pypy-commit] pypy sepcomp2: Extract information from the first rtyper, but don't use it
amauryfa
noreply at buildbot.pypy.org
Wed Feb 22 21:19:38 CET 2012
Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: sepcomp2
Changeset: r52770:410f58726ea8
Date: 2012-02-22 21:17 +0100
http://bitbucket.org/pypy/pypy/changeset/410f58726ea8/
Log: Extract information from the first rtyper, but don't use it to build
the import module.
diff --git a/pypy/translator/c/exportinfo.py b/pypy/translator/c/exportinfo.py
--- a/pypy/translator/c/exportinfo.py
+++ b/pypy/translator/c/exportinfo.py
@@ -73,14 +73,17 @@
constructor._always_inline_ = True
constructor.argtypes = self.cls.__init__.argtypes
return constructor
+
+ def save_repr(self, rtyper):
+ bookkeeper = rtyper.annotator.bookkeeper
+ classdef = bookkeeper.getuniqueclassdef(self.cls)
+ self.classrepr = rtyper.getrepr(model.SomeInstance(classdef)
+ ).lowleveltype
- def make_repr(self, module, rtyper):
+ def make_repr(self, module):
"""Returns the class repr, but also installs a Controller that
will intercept all operations on the class."""
- bookkeeper = rtyper.annotator.bookkeeper
- classdef = bookkeeper.getuniqueclassdef(self.cls)
- classrepr = rtyper.getrepr(model.SomeInstance(classdef)).lowleveltype
- STRUCTPTR = classrepr
+ STRUCTPTR = self.classrepr
constructor = getattr(module, self.constructor_name)
@@ -166,6 +169,9 @@
"""Builds an object with all exported functions."""
rtyper = builder.db.translator.rtyper
+ for clsname, class_info in self.classes.items():
+ class_info.save_repr(rtyper)
+
exported_funcptr = self.get_lowlevel_functions(
builder.translator.annotator)
# Map exported functions to the names given by the translator.
@@ -199,7 +205,7 @@
func = make_llexternal_function(import_name, funcptr, import_eci)
setattr(mod, funcname, func)
for clsname, class_info in self.classes.items():
- structptr = class_info.make_repr(mod, rtyper)
+ structptr = class_info.make_repr(mod)
setattr(mod, clsname, structptr)
return mod
More information about the pypy-commit
mailing list