[pypy-svn] r65455 - in pypy/branch/pyjitpl5-experiments/pypy: jit/backend jit/backend/cli jit/metainterp jit/tl translator translator/oosupport

antocuni at codespeak.net antocuni at codespeak.net
Wed May 27 15:52:38 CEST 2009


Author: antocuni
Date: Wed May 27 15:52:37 2009
New Revision: 65455

Modified:
   pypy/branch/pyjitpl5-experiments/pypy/jit/backend/cli/runner.py
   pypy/branch/pyjitpl5-experiments/pypy/jit/backend/detect_cpu.py
   pypy/branch/pyjitpl5-experiments/pypy/jit/metainterp/warmspot.py
   pypy/branch/pyjitpl5-experiments/pypy/jit/tl/pypyjit_demo.py
   pypy/branch/pyjitpl5-experiments/pypy/jit/tl/targetpypyjit.py
   pypy/branch/pyjitpl5-experiments/pypy/translator/driver.py
   pypy/branch/pyjitpl5-experiments/pypy/translator/oosupport/constant.py
Log:
make it possible to translate targetpypyjit with the cli backend


Modified: pypy/branch/pyjitpl5-experiments/pypy/jit/backend/cli/runner.py
==============================================================================
--- pypy/branch/pyjitpl5-experiments/pypy/jit/backend/cli/runner.py	(original)
+++ pypy/branch/pyjitpl5-experiments/pypy/jit/backend/cli/runner.py	Wed May 27 15:52:37 2009
@@ -241,7 +241,7 @@
         return dotnet.classof(System.Double)
 ##     elif T is ootype.String:
 ##         return dotnet.classof(System.String)
-    elif T is ootype.Char:
+    elif T in (ootype.Char, ootype.UniChar):
         return dotnet.classof(System.Char)
     elif isinstance(T, ootype.OOType):
         return ootype.runtimeClass(T)

Modified: pypy/branch/pyjitpl5-experiments/pypy/jit/backend/detect_cpu.py
==============================================================================
--- pypy/branch/pyjitpl5-experiments/pypy/jit/backend/detect_cpu.py	(original)
+++ pypy/branch/pyjitpl5-experiments/pypy/jit/backend/detect_cpu.py	Wed May 27 15:52:37 2009
@@ -47,6 +47,8 @@
         from pypy.jit.backend.x86.runner import CPU
     elif backend_name == 'minimal':
         from pypy.jit.backend.minimal.runner import LLtypeCPU as CPU
+    elif backend_name == 'cli':
+        from pypy.jit.backend.cli.runner import CliCPU as CPU
     else:
         raise ProcessorAutodetectError, "unsupported cpu '%s'" % backend_name
     return CPU

Modified: pypy/branch/pyjitpl5-experiments/pypy/jit/metainterp/warmspot.py
==============================================================================
--- pypy/branch/pyjitpl5-experiments/pypy/jit/metainterp/warmspot.py	(original)
+++ pypy/branch/pyjitpl5-experiments/pypy/jit/metainterp/warmspot.py	Wed May 27 15:52:37 2009
@@ -30,6 +30,7 @@
 
 def apply_jit(translator, backend_name="auto", **kwds):
     from pypy.jit.metainterp.simple_optimize import Optimizer
+    #from pypy.jit.metainterp.optimize2 import Optimizer
     if 'CPUClass' not in kwds:
         from pypy.jit.backend.detect_cpu import getcpuclass
         kwds['CPUClass'] = getcpuclass(backend_name)

Modified: pypy/branch/pyjitpl5-experiments/pypy/jit/tl/pypyjit_demo.py
==============================================================================
--- pypy/branch/pyjitpl5-experiments/pypy/jit/tl/pypyjit_demo.py	(original)
+++ pypy/branch/pyjitpl5-experiments/pypy/jit/tl/pypyjit_demo.py	Wed May 27 15:52:37 2009
@@ -7,12 +7,17 @@
 
 def simple_loop():
     print "simple loop"
+    import time
     i = 0
     N = 100
+    #N = 10000000
     step = 3
+    start = time.clock()
     while i < N:
         i = i + step
+    end = time.clock()
     print i
+    print end-start, 'seconds'
 
 def g(i):
     for k in range(i, i +2):
@@ -24,7 +29,8 @@
 
 try:
     #do()
-    loop()
+    #loop()
+    simple_loop()
     print "---ending 2---"
 except BaseException, e:
     print "---ending 0---"

Modified: pypy/branch/pyjitpl5-experiments/pypy/jit/tl/targetpypyjit.py
==============================================================================
--- pypy/branch/pyjitpl5-experiments/pypy/jit/tl/targetpypyjit.py	(original)
+++ pypy/branch/pyjitpl5-experiments/pypy/jit/tl/targetpypyjit.py	Wed May 27 15:52:37 2009
@@ -65,8 +65,15 @@
     config.objspace.usemodules.pypyjit = True
     config.objspace.usemodules._weakref = False
     config.objspace.usemodules._sre = False
-    config.objspace.std.multimethods = 'mrd'
-    multimethod.Installer = multimethod.InstallerVersion2
+    if config.translation.type_system == 'lltype':
+        config.objspace.std.multimethods = 'mrd'
+        multimethod.Installer = multimethod.InstallerVersion2
+    else:
+        from pypy.rlib import jit
+        jit.PARAMETERS['hash_bits'] = 6 # XXX: this is a hack, should be fixed at some point
+        config.objspace.std.multimethods = 'doubledispatch'
+        multimethod.Installer = multimethod.InstallerVersion1
+        
     config.objspace.std.builtinshortcut = True
     config.objspace.opcodes.CALL_LIKELY_BUILTIN = True
     config.objspace.std.withrangelist = True
@@ -76,6 +83,7 @@
     w_dict = space.newdict()
     return entry_point, None, PyPyAnnotatorPolicy(single_space = space)
 
+
 def jitpolicy(driver):
     """Returns the JIT policy to use when translating."""
     from pypy.module.pypyjit.policy import PyPyJitPolicy

Modified: pypy/branch/pyjitpl5-experiments/pypy/translator/driver.py
==============================================================================
--- pypy/branch/pyjitpl5-experiments/pypy/translator/driver.py	(original)
+++ pypy/branch/pyjitpl5-experiments/pypy/translator/driver.py	Wed May 27 15:52:37 2009
@@ -369,6 +369,20 @@
         [RTYPE],
         "Backendopt before jitting")
 
+    def task_prejitbackendopt_ootype(self):
+        from pypy.translator.backendopt.all import backend_optimizations
+        backend_optimizations(self.translator,
+                              inline_threshold=0,
+                              merge_if_blocks=True,
+                              constfold=False, # XXX?
+                              raisingop2direct_call=False,
+                              remove_asserts=False)
+    #
+    task_prejitbackendopt_ootype = taskdef(
+        task_prejitbackendopt_ootype,
+        [OOTYPE],
+        "Backendopt before jitting")
+
     def task_pyjitpl_lltype(self):
         get_policy = self.extra['jitpolicy']
         self.jitpolicy = get_policy(self)
@@ -383,6 +397,20 @@
                                   [RTYPE, '?prejitbackendopt_lltype'],
                                   "JIT compiler generation")
 
+    def task_pyjitpl_ootype(self):
+        get_policy = self.extra['jitpolicy']
+        self.jitpolicy = get_policy(self)
+        #
+        from pypy.jit.metainterp.warmspot import apply_jit
+        apply_jit(self.translator, policy=self.jitpolicy,
+                  backend_name='cli') #XXX
+        #
+        self.log.info("the JIT compiler was generated")
+    #
+    task_pyjitpl_ootype = taskdef(task_pyjitpl_ootype,
+                                  [OOTYPE, '?prejitbackendopt_ootype'],
+                                  "JIT compiler generation")
+
     def task_backendopt_lltype(self):
         from pypy.translator.backendopt.all import backend_optimizations
         backend_optimizations(self.translator)

Modified: pypy/branch/pyjitpl5-experiments/pypy/translator/oosupport/constant.py
==============================================================================
--- pypy/branch/pyjitpl5-experiments/pypy/translator/oosupport/constant.py	(original)
+++ pypy/branch/pyjitpl5-experiments/pypy/translator/oosupport/constant.py	Wed May 27 15:52:37 2009
@@ -28,7 +28,7 @@
 from pypy.rpython.ootypesystem import ootype
 import operator
 
-MAX_CONST_PER_STEP = 100
+MAX_CONST_PER_STEP = 50
 
 PRIMITIVE_TYPES = set([ootype.Void, ootype.Bool, ootype.Char, ootype.UniChar,
                        ootype.Float, ootype.Signed, ootype.Unsigned,



More information about the Pypy-commit mailing list