[pypy-svn] r16630 - in pypy/dist/pypy/translator/llvm2: . module

ericvrp at codespeak.net ericvrp at codespeak.net
Fri Aug 26 15:23:02 CEST 2005


Author: ericvrp
Date: Fri Aug 26 15:23:01 2005
New Revision: 16630

Modified:
   pypy/dist/pypy/translator/llvm2/build_llvm_module.py
   pypy/dist/pypy/translator/llvm2/genllvm.py
   pypy/dist/pypy/translator/llvm2/module/support.py
Log:
fixes to get pypy_ functionname prefix working


Modified: pypy/dist/pypy/translator/llvm2/build_llvm_module.py
==============================================================================
--- pypy/dist/pypy/translator/llvm2/build_llvm_module.py	(original)
+++ pypy/dist/pypy/translator/llvm2/build_llvm_module.py	Fri Aug 26 15:23:01 2005
@@ -35,7 +35,6 @@
     ]))
 
 def compile_module(module, source_files, object_files, library_files):
-    print 'QQQQQQQQQQQ compile_module'
     open("%s_setup.py" % module, "w").write(str(py.code.Source(
         '''
         from distutils.core import setup
@@ -52,18 +51,11 @@
     cmdexec(cmd)
 
 def make_module_from_llvm(llvmfile, pyxfile=None, optimize=True, exe_name=None):
-    print 'QQQQQQQQQQQ make_module_from_llvm'
-    print 'QQQQQQQ aaa make_module_from_llvm'
     include_dir = py.magic.autopath().dirpath()
-    print 'QQQQQQQ AAA make_module_from_llvm'
     dirpath = llvmfile.dirpath()
-    print 'QQQQQQQ BBB make_module_from_llvm'
     lastdir = path.local()
-    print 'QQQQQQQ CCC make_module_from_llvm'
     os.chdir(str(dirpath))
-    print 'QQQQQQQ DDD make_module_from_llvm'
     b = llvmfile.purebasename
-    print 'QQQQQQQ EEE make_module_from_llvm'
     if pyxfile:
         modname = pyxfile.purebasename
         source_files = [ "%s.c" % modname ]
@@ -92,7 +84,6 @@
 
     cmds = ["llvm-as < %s.ll | opt %s -f -o %s.bc" % (b, OPTIMIZATION_SWITCHES, b)]
 
-    print 'QQQQQQQ 111 make_module_from_llvm'
     if False and sys.maxint == 2147483647:        #32 bit platform
         cmds.append("llc %s %s.bc -f -o %s.s" % (EXCEPTIONS_SWITCHES, b, b))
         cmds.append("as %s.s -o %s.o" % (b, b))
@@ -108,32 +99,21 @@
         source_files.append("%s.c" % b)
 
     try:
-        print 'QQQQQQQ 222 make_module_from_llvm'
         if pyxfile:
             log.build("modname", modname)
         c = stdoutcapture.Capture(mixed_out_err = True)
         log.build("working in", path.local())
-        print 'QQQ X 111   make_module_from_llvm'
         try:
-            print 'QQQ X 222   make_module_from_llvm'
             try:
-                print 'QQQ X 333   make_module_from_llvm'
                 for cmd in cmds:
                     #log.build(cmd)
-                    print 'QQQQQQQQQQQ cmd', cmd
                     cmdexec(cmd)
                 if pyxfile:
-                    print 'QQQ aaa        ', cmd
                     make_c_from_pyxfile(pyxfile)
-                    print 'QQQ bbb        ', cmd
                     compile_module(modname, source_files, object_files, library_files)
-                    print 'QQQ ccc        ', cmd
-                print 'QQQ ddd        ', cmd
             finally:
-                print 'QQQ eee        ', cmd
                 foutput, ferror = c.done()
         except:
-            print 'QQQ fff        ', cmd
             data = 'OUTPUT:\n' + foutput.read() + '\n\nERROR:\n' + ferror.read()
             if pyxfile:
                 fdump = open("%s.errors" % modname, "w")
@@ -141,7 +121,6 @@
                 fdump.close()
             log.build(data)
             raise
-        print 'QQQQQQQ bbb make_module_from_llvm'
         # XXX do we need to do some check on fout/ferr?
         # XXX not a nice way to import a module
         if pyxfile:
@@ -153,10 +132,7 @@
             sys.path.pop(0)
     finally:
         os.chdir(str(lastdir))
-    print 'QQQQQQQ ccc make_module_from_llvm'
     if pyxfile:
-        print 'QQQQQQQ ddd make_module_from_llvm'
         return testmodule
     if exe_name:
-        print 'QQQQQQQ eee make_module_from_llvm'
         return exe_name

Modified: pypy/dist/pypy/translator/llvm2/genllvm.py
==============================================================================
--- pypy/dist/pypy/translator/llvm2/genllvm.py	(original)
+++ pypy/dist/pypy/translator/llvm2/genllvm.py	Fri Aug 26 15:23:01 2005
@@ -423,9 +423,9 @@
 
 def compile_function(function, annotation, **kwds):
     mod = compile_module(function, annotation, **kwds)
-    return getattr(mod, function.func_name + "_wrapper")
+    return getattr(mod, 'pypy_' + function.func_name + "_wrapper")
 
 def compile_module_function(function, annotation, **kwds):
     mod = compile_module(function, annotation, **kwds)
-    f = getattr(mod, function.func_name + "_wrapper")
+    f = getattr(mod, 'pypy_' + function.func_name + "_wrapper")
     return mod, f

Modified: pypy/dist/pypy/translator/llvm2/module/support.py
==============================================================================
--- pypy/dist/pypy/translator/llvm2/module/support.py	(original)
+++ pypy/dist/pypy/translator/llvm2/module/support.py	Fri Aug 26 15:23:01 2005
@@ -100,7 +100,7 @@
 for exc in "ZeroDivisionError OverflowError ValueError".split():    #_ZER _OVF _VAL
     extfunctions["%%__prepare_%(exc)s" % locals()] = ((), """
 internal fastcc void %%__prepare_%(exc)s() {
-    %%exception_value = call fastcc %%RPYTHON_EXCEPTION* %%instantiate_%(exc)s()
+    %%exception_value = call fastcc %%RPYTHON_EXCEPTION* %%pypy_instantiate_%(exc)s()
     %%tmp             = getelementptr %%RPYTHON_EXCEPTION* %%exception_value, int 0, uint 0
     %%exception_type  = load %%RPYTHON_EXCEPTION_VTABLE** %%tmp
     store %%RPYTHON_EXCEPTION_VTABLE* %%exception_type, %%RPYTHON_EXCEPTION_VTABLE** %%last_exception_type



More information about the Pypy-commit mailing list