[pypy-svn] r18042 - pypy/dist/pypy/translator/goal

pedronis at codespeak.net pedronis at codespeak.net
Sat Oct 1 05:51:23 CEST 2005


Author: pedronis
Date: Sat Oct  1 05:51:22 2005
New Revision: 18042

Modified:
   pypy/dist/pypy/translator/goal/driver.py
   pypy/dist/pypy/translator/goal/translate_pypy_new.py
Log:
implemented llinterpret



Modified: pypy/dist/pypy/translator/goal/driver.py
==============================================================================
--- pypy/dist/pypy/translator/goal/driver.py	(original)
+++ pypy/dist/pypy/translator/goal/driver.py	Sat Oct  1 05:51:22 2005
@@ -37,7 +37,7 @@
 class TranslationDriver(SimpleTaskEngine):
 
     def __init__(self, translator, inputtypes, policy=None, options=None,
-                 runner=None, disable=[], default_goal = None):
+                 runner=None, disable=[], default_goal = None, extra = {}):
         SimpleTaskEngine.__init__(self)
 
         self.translator = translator
@@ -61,6 +61,8 @@
                 f()
         self.runner = runner
 
+        self.extra = extra
+
         self.done = {}
 
         maybe_skip = []
@@ -82,7 +84,7 @@
                 self.proceed(backend_goal)
             setattr(self, task, proc)
 
-        for task in ('annotate', 'rtype', 'backendopt', 'source', 'compile', 'run'):
+        for task in ('annotate', 'rtype', 'backendopt', 'source', 'compile', 'run', 'llinterpret'):
             expose_task(task)
             
     def backend_select_goals(self, goals):
@@ -219,15 +221,17 @@
                          "Running compiled c source",
                          idemp=True)
 
-    def task_llinterpret(self): # TODO
-        #def interpret():
-        #    from pypy.rpython.llinterp import LLInterpreter
-        #    py.log.setconsumer("llinterp operation", None)    
-        #    interp = LLInterpreter(translator.flowgraphs, transalator.rtyper)
-        #    interp.eval_function(translator.entrypoint,
-        #                         targetspec_dic['get_llinterp_args']())
-        #interpret()
-        raise NotImplementedError
+    def task_llinterpret(self):
+        from pypy.rpython.llinterp import LLInterpreter
+        py.log.setconsumer("llinterp operation", None)
+        
+        translator = self.translator
+        interp = LLInterpreter(translator.flowgraphs, translator.rtyper)
+        v = interp.eval_function(translator.entrypoint,
+                                 self.extra.get('get_llinterp_args',
+                                                lambda: [])())
+
+        log.llinterpret.event("result -> %s" % v)
     #
     task_llinterpret = taskdef(task_llinterpret, 
                                ['?backendopt', 'rtype'], 
@@ -307,7 +311,8 @@
         driver = TranslationDriver(translator, inputtypes,
                                    policy, options, targetspec_dic.get('run'),
                                    disable=disable,
-                                   default_goal = default_goal)
+                                   default_goal = default_goal,
+                                   extra = targetspec_dic)
 
         return driver
 

Modified: pypy/dist/pypy/translator/goal/translate_pypy_new.py
==============================================================================
--- pypy/dist/pypy/translator/goal/translate_pypy_new.py	(original)
+++ pypy/dist/pypy/translator/goal/translate_pypy_new.py	Sat Oct  1 05:51:22 2005
@@ -76,14 +76,9 @@
     '5_fork_before':  [OPT(('--fork-before',), """(UNIX) Create restartable checkpoint before step""", 
                            ['annotate', 'rtype', 'backendopt', 'source'])],
   
+    '6_llinterpret':  [OPT(('--llinterpret',), "Interpret the rtyped flow graphs", GOAL)],
     },
 
-    
-                    
-    #'Process options':[
-    #    ['-f', '--fork', 
-    #           "(UNIX) Create restartable checkpoint after annotation [,specialization]",
-    #                        [['fork1','fork2']], [] ],
             
 }
 



More information about the Pypy-commit mailing list