[pypy-svn] r17886 - in pypy/dist/pypy/translator: backendopt goal llvm llvm/backendopt

ericvrp at codespeak.net ericvrp at codespeak.net
Mon Sep 26 23:34:10 CEST 2005


Author: ericvrp
Date: Mon Sep 26 23:34:09 2005
New Revision: 17886

Added:
   pypy/dist/pypy/translator/llvm/backendopt/
   pypy/dist/pypy/translator/llvm/backendopt/exception.py
      - copied unchanged from r17884, pypy/dist/pypy/translator/backendopt/exception.py
Removed:
   pypy/dist/pypy/translator/backendopt/exception.py
Modified:
   pypy/dist/pypy/translator/goal/bench-cronjob.py
   pypy/dist/pypy/translator/llvm/exception.py
   pypy/dist/pypy/translator/llvm/opwriter.py
Log:
* About 13.3x slower then CPython by eliminating malloc's that clearly
  allocate zero bytes (which were 500 of about 16000 mallocs)

* Using 'fast' exceptionpolicy by default now

* Moving backendopt transformations that are used by genllvm only,
  to a seperate directory.



Modified: pypy/dist/pypy/translator/goal/bench-cronjob.py
==============================================================================
--- pypy/dist/pypy/translator/goal/bench-cronjob.py	(original)
+++ pypy/dist/pypy/translator/goal/bench-cronjob.py	Mon Sep 26 23:34:09 2005
@@ -2,6 +2,21 @@
 
 import time, os, sys, stat
 
+current_result = '''
+executable                        richards             pystone
+python 2.4.2c1                      855ms (  1.00x)    44642 (  1.00x)
+pypy-llvm-17884                   11034ms ( 12.91x)     3362 ( 13.28x)
+pypy-llvm-17881                   11702ms ( 13.69x)     3240 ( 13.78x)
+pypy-llvm-17870                   12683ms ( 14.83x)     3073 ( 14.53x)
+pypy-llvm-17862                   13053ms ( 15.27x)     3017 ( 14.79x)
+pypy-llvm-17797                   13497ms ( 15.79x)     2832 ( 15.76x)
+pypy-llvm-17792                   13808ms ( 16.15x)     2818 ( 15.84x)
+pypy-llvm-17758                   16998ms ( 19.88x)     2237 ( 19.96x)
+pypy-c-17853                      22389ms ( 26.19x)     1651 ( 27.04x)
+pypy-c-17806                      22328ms ( 26.11x)     1660 ( 26.88x)
+pypy-c-17758                      23485ms ( 27.47x)     1598 ( 27.92x)
+'''
+
 homedir = os.getenv('HOME')
 os.putenv('PATH','~/bin:/usr/local/bin:/usr/bin:/bin:/opt/bin:/usr/i686-pc-linux-gnu/gcc-bin/3.3.6')
 

Modified: pypy/dist/pypy/translator/llvm/exception.py
==============================================================================
--- pypy/dist/pypy/translator/llvm/exception.py	(original)
+++ pypy/dist/pypy/translator/llvm/exception.py	Mon Sep 26 23:34:09 2005
@@ -28,7 +28,7 @@
         return noresult
 
     def new(exceptionpolicy=None):  #factory
-        exceptionpolicy = exceptionpolicy or 'cpython'
+        exceptionpolicy = exceptionpolicy or 'fast'
         if exceptionpolicy == 'cpython':
             from pypy.translator.llvm.exception import CPythonExceptionPolicy
             exceptionpolicy = CPythonExceptionPolicy()
@@ -174,7 +174,7 @@
 ''' % locals()
 
     def transform(self, translator, graph=None):
-        from pypy.translator.backendopt.exception import create_exception_handling
+        from pypy.translator.llvm.backendopt.exception import create_exception_handling
         if graph:
             create_exception_handling(translator, graph)
         else:

Modified: pypy/dist/pypy/translator/llvm/opwriter.py
==============================================================================
--- pypy/dist/pypy/translator/llvm/opwriter.py	(original)
+++ pypy/dist/pypy/translator/llvm/opwriter.py	Mon Sep 26 23:34:09 2005
@@ -390,7 +390,11 @@
     def malloc(self, op): 
         arg_type = op.args[0].value
         targetvar = self.db.repr_arg(op.result) 
-        
+        if isinstance(arg_type, lltype.Struct) and arg_type._names_without_voids() == []:
+            t = self.db.repr_arg_type(op.result)
+            self.codewriter.cast(targetvar, t, 'null', t)
+            self.codewriter.comment('removed malloc(%s) from previous line' % t)
+            return
         type_ = self.db.repr_type(arg_type)
         self.codewriter.malloc(targetvar, type_, atomic=arg_type._is_atomic())
 



More information about the Pypy-commit mailing list