Commits

Antonio Cuni  committed b708d2d

add the relevant tasks to driver to do --jit on ootype; fix test_driver

  • Participants
  • Parent commits e3e7e8e
  • Branches oo-jit

Comments (0)

Files changed (3)

File pypy/config/translationoption.py

                      "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",

File pypy/translator/driver.py

         [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
                                        ['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
             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)

File pypy/translator/test/test_driver.py

     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']
                  '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'})
 
     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)