[pypy-svn] r54366 - in pypy/branch/oo-jit/pypy: config translator translator/test

antocuni at codespeak.net antocuni at codespeak.net
Sat May 3 15:46:10 CEST 2008


Author: antocuni
Date: Sat May  3 15:46:09 2008
New Revision: 54366

Modified:
   pypy/branch/oo-jit/pypy/config/translationoption.py
   pypy/branch/oo-jit/pypy/translator/driver.py
   pypy/branch/oo-jit/pypy/translator/test/test_driver.py
Log:
add the relevant tasks to driver to do --jit on ootype; fix test_driver



Modified: pypy/branch/oo-jit/pypy/config/translationoption.py
==============================================================================
--- pypy/branch/oo-jit/pypy/config/translationoption.py	(original)
+++ pypy/branch/oo-jit/pypy/config/translationoption.py	Sat May  3 15:46:09 2008
@@ -31,13 +31,14 @@
                      "llvm":   [("translation.type_system", "lltype"),
                                 ("translation.backendopt.raisingop2direct_call", True),
                                 ],
-                     "cli":    [("translation.type_system", "ootype")],
+                     "cli":    [("translation.type_system", "ootype"),
+                                ("translation.jitbackend", "cli")],
                      "jvm":    [("translation.type_system", "ootype")],
                      "js":     [("translation.type_system", "ootype")],
                      },
                  cmdline="-b --backend"),
     ChoiceOption("jitbackend", "Backent to use for JIT code generation",
-                 ["ia32", "i386", "ppc"], cmdline="--jit-backend",
+                 ["ia32", "i386", "ppc", "cli"], cmdline="--jit-backend",
                  default=None),
     BoolOption("llvm_via_c", "compile llvm via C",
                default=False, cmdline="--llvm-via-c",

Modified: pypy/branch/oo-jit/pypy/translator/driver.py
==============================================================================
--- pypy/branch/oo-jit/pypy/translator/driver.py	(original)
+++ pypy/branch/oo-jit/pypy/translator/driver.py	Sat May  3 15:46:09 2008
@@ -378,6 +378,14 @@
         [RTYPE],
         "Backendopt before Hint-annotate")
 
+    def task_prehannotatebackendopt_ootype(self):
+        self.task_prehannotatebackendopt_lltype()
+    #
+    task_prehannotatebackendopt_ootype = taskdef(
+        task_prehannotatebackendopt_ootype,
+        [OOTYPE],
+        "Backendopt before Hint-annotate")
+
     def task_hintannotate_lltype(self):
         from pypy.jit.hintannotator.model import OriginFlags
         from pypy.jit.hintannotator.model import SomeLLAbstractConstant
@@ -416,30 +424,19 @@
                                        ['prehannotatebackendopt_lltype'],
                                        "Hint-annotate")
 
-    def task_rainbow_lltype(self):
-        cpu = self.config.translation.jitbackend
-        if cpu is None:
-            from pypy.jit.codegen import detect_cpu
-            cpu = detect_cpu.autodetect()
-        if cpu == 'i386':
-            from pypy.jit.codegen.i386.rgenop import RI386GenOp as RGenOp
-            RGenOp.MC_SIZE = 32 * 1024 * 1024
-        elif cpu == 'ia32':
-            from pypy.jit.codegen.ia32.rgenop import RI386GenOp as RGenOp
-            RGenOp.MC_SIZE = 32 * 1024 * 1024
-        elif cpu == 'ppc':
-            from pypy.jit.codegen.ppc.rgenop import RPPCGenOp as RGenOp
-            RGenOp.MC_SIZE = 32 * 1024 * 1024
-        else:
-            raise Exception('Unsuported cpu %r'%cpu)
+    def task_hintannotate_ootype(self):
+        self.task_hintannotate_lltype()
+    task_hintannotate_ootype = taskdef(task_hintannotate_ootype,
+                                       ['prehannotatebackendopt_ootype'],
+                                       "Hint-annotate")
 
+    def do_task_rainbow(self, RGenOp, BytecodeWriter):
         del self.hint_translator
         ha = self.hannotator
         t = self.translator
         rtyper = t.rtyper
         # make the bytecode and the rainbow interp
-        from pypy.jit.rainbow.codewriter import LLTypeBytecodeWriter
-        writer = LLTypeBytecodeWriter(t, ha, RGenOp, verbose=False)
+        writer = BytecodeWriter(t, ha, RGenOp, verbose=False)
         jitcode = writer.make_bytecode(self.portal_graph)
         if ha.policy.hotpath:
             from pypy.jit.rainbow.hotpath import HotRunnerDesc
@@ -459,11 +456,40 @@
             rewriter.rewrite(origportalgraph=self.orig_portal_graph,
                              portalgraph=self.portal_graph,
                              view=False)
+
+    def task_rainbow_lltype(self):
+        from pypy.jit.rainbow.codewriter import LLTypeBytecodeWriter
+        cpu = self.config.translation.jitbackend
+        if cpu is None:
+            from pypy.jit.codegen import detect_cpu
+            cpu = detect_cpu.autodetect()
+        if cpu == 'i386':
+            from pypy.jit.codegen.i386.rgenop import RI386GenOp as RGenOp
+            RGenOp.MC_SIZE = 32 * 1024 * 1024
+        elif cpu == 'ia32':
+            from pypy.jit.codegen.ia32.rgenop import RI386GenOp as RGenOp
+            RGenOp.MC_SIZE = 32 * 1024 * 1024
+        elif cpu == 'ppc':
+            from pypy.jit.codegen.ppc.rgenop import RPPCGenOp as RGenOp
+            RGenOp.MC_SIZE = 32 * 1024 * 1024
+        else:
+            raise Exception('Unsuported cpu %r'%cpu)
+        self.do_task_rainbow(RGenOp, LLTypeBytecodeWriter)
     #
     task_rainbow_lltype = taskdef(task_rainbow_lltype,
                              ["hintannotate_lltype"],
                              "Create Rainbow-Interpreter")
 
+    def task_rainbow_ootype(self):
+        from pypy.jit.rainbow.codewriter import OOTypeBytecodeWriter
+        from pypy.jit.codegen.cli.rgenop import RCliGenOp as RGenOp
+        cpu = self.config.translation.jitbackend
+        assert cpu == 'cli'
+        self.do_task_rainbow(RGenOp, OOTypeBytecodeWriter)
+    task_rainbow_ootype = taskdef(task_rainbow_ootype,
+                             ["hintannotate_ootype"],
+                             "Create Rainbow-Interpreter")
+
     def task_backendopt_lltype(self):
         from pypy.translator.backendopt.all import backend_optimizations
         backend_optimizations(self.translator)

Modified: pypy/branch/oo-jit/pypy/translator/test/test_driver.py
==============================================================================
--- pypy/branch/oo-jit/pypy/translator/test/test_driver.py	(original)
+++ pypy/branch/oo-jit/pypy/translator/test/test_driver.py	Sat May  3 15:46:09 2008
@@ -7,7 +7,7 @@
     td = TranslationDriver()
     expected = ['annotate', 'backendopt', 'llinterpret', 'rtype', 'source',
                 'compile', 'run', 'prehannotatebackendopt', 'hintannotate',
-                'timeshift']
+                'rainbow']
     assert set(td.exposed) == set(expected)
 
     assert td.backend_select_goals(['compile_c']) == ['compile_c']
@@ -38,7 +38,8 @@
                  'run_llvm', 'run_c', 'run_js', 'run_cli',
                  'compile_jvm', 'source_jvm', 'run_jvm',
                  'prehannotatebackendopt_lltype', 'hintannotate_lltype',
-                 'timeshift_lltype']
+                 'prehannotatebackendopt_ootype', 'hintannotate_ootype',
+                 'rainbow_lltype', 'rainbow_ootype']
     assert set(td.exposed) == set(expected)                             
 
     td = TranslationDriver({'backend': None, 'type_system': 'lltype'})
@@ -53,6 +54,6 @@
 
     expected = ['annotate', 'backendopt', 'llinterpret', 'rtype', 'source_c',
                 'source_llvm', 'compile_c', 'compile_llvm', 'run_llvm',
-                'run_c', 'prehannotatebackendopt', 'hintannotate', 'timeshift']
+                'run_c', 'prehannotatebackendopt', 'hintannotate', 'rainbow']
 
     assert set(td.exposed) == set(expected)



More information about the Pypy-commit mailing list