[pypy-svn] r18579 - in pypy/dist/pypy/translator: c goal
tismer at codespeak.net
tismer at codespeak.net
Fri Oct 14 18:40:57 CEST 2005
Author: tismer
Date: Fri Oct 14 18:40:55 2005
New Revision: 18579
Modified:
pypy/dist/pypy/translator/c/genc.py
pypy/dist/pypy/translator/goal/driver.py
pypy/dist/pypy/translator/goal/translate_pypy.py
Log:
splitted translate_pypy's source step into two:
There is now an extra database step in driver.py.
This was done in order to take a fork/snapshot right before
the source is generated.
Modified: pypy/dist/pypy/translator/c/genc.py
==============================================================================
--- pypy/dist/pypy/translator/c/genc.py (original)
+++ pypy/dist/pypy/translator/c/genc.py Fri Oct 14 18:40:55 2005
@@ -25,21 +25,33 @@
libraries = []
self.libraries = libraries
- def generate_source(self):
- assert self.c_source_filename is None
+ def build_database(self):
translator = self.translator
- pf = self.getentrypointptr()
db = LowLevelDatabase(translator, standalone=self.standalone, gcpolicy=self.gcpolicy)
if self.stackless:
from pypy.translator.c.stackless import StacklessData
db.stacklessdata = StacklessData()
- # we need a concrete gcpolicy to do this
+ # we need a concrete gcpolicy to do this
self.libraries += db.gcpolicy.gc_libraries()
+ # XXX the following has the side effect to generate
+ # some needed things. Find out why.
+ pf = self.getentrypointptr()
pfname = db.get(pf)
+ # XXX
db.complete()
+ return db
+
+ def generate_source(self, db=None):
+ assert self.c_source_filename is None
+ translator = self.translator
+
+ if db is None:
+ db = self.build_database()
+ pf = self.getentrypointptr()
+ pfname = db.get(pf)
modulename = uniquemodulename('testing')
targetdir = udir.ensure(modulename, dir=1)
Modified: pypy/dist/pypy/translator/goal/driver.py
==============================================================================
--- pypy/dist/pypy/translator/goal/driver.py (original)
+++ pypy/dist/pypy/translator/goal/driver.py Fri Oct 14 18:40:55 2005
@@ -174,7 +174,7 @@
task_backendopt = taskdef(task_backendopt,
['rtype'], "Back-end optimisations")
- def task_source_c(self): # xxx messy
+ def task_database_c(self):
translator = self.translator
opt = self.options
if translator.annotator is not None:
@@ -191,13 +191,23 @@
cbuilder = translator.cbuilder(standalone=standalone, gcpolicy=gcpolicy)
cbuilder.stackless = opt.stackless
- c_source_filename = cbuilder.generate_source()
- self.log.info("written: %s" % (c_source_filename,))
+ database = cbuilder.build_database()
+ self.log.info("database for generating C source was created")
self.cbuilder = cbuilder
+ self.database = database
#
- task_source_c = taskdef(task_source_c,
+ task_database_c = taskdef(task_database_c,
['?backendopt', '?rtype', '?annotate'],
- "Generating c source")
+ "Creating database for generating c source")
+
+ def task_source_c(self): # xxx messy
+ translator = self.translator
+ cbuilder = self.cbuilder
+ database = self.database
+ c_source_filename = cbuilder.generate_source(database)
+ self.log.info("written: %s" % (c_source_filename,))
+ #
+ task_source_c = taskdef(task_source_c, ['database_c'], "Generating c source")
def task_compile_c(self): # xxx messy
cbuilder = self.cbuilder
Modified: pypy/dist/pypy/translator/goal/translate_pypy.py
==============================================================================
--- pypy/dist/pypy/translator/goal/translate_pypy.py (original)
+++ pypy/dist/pypy/translator/goal/translate_pypy.py Fri Oct 14 18:40:55 2005
@@ -75,7 +75,7 @@
(see pypy/translator/tool/pygame/graphclient.py)""", int)],
'5_fork_before': [OPT(('--fork-before',), """(UNIX) Create restartable checkpoint before step""",
- ['annotate', 'rtype', 'backendopt', 'source'])],
+ ['annotate', 'rtype', 'backendopt', 'database', 'source'])],
'6_llinterpret': [OPT(('--llinterpret',), "Interpret the rtyped flow graphs", GOAL)],
},
More information about the Pypy-commit
mailing list