[pypy-svn] r48122 - pypy/dist/pypy/translator/llvm

rxe at codespeak.net rxe at codespeak.net
Sun Oct 28 02:24:12 CEST 2007


Author: rxe
Date: Sun Oct 28 02:24:11 2007
New Revision: 48122

Modified:
   pypy/dist/pypy/translator/llvm/arraynode.py
   pypy/dist/pypy/translator/llvm/gc.py
   pypy/dist/pypy/translator/llvm/opwriter.py
   pypy/dist/pypy/translator/llvm/structnode.py
Log:
cosmetic.  some changes from Hildesheim sprint, not sure what they were about or were valid

Modified: pypy/dist/pypy/translator/llvm/arraynode.py
==============================================================================
--- pypy/dist/pypy/translator/llvm/arraynode.py	(original)
+++ pypy/dist/pypy/translator/llvm/arraynode.py	Sun Oct 28 02:24:11 2007
@@ -121,7 +121,7 @@
         return ref
 
     def get_childref(self, index):
-        return "getelementptr(%s* %s, int 0, uint 1, int %s)" %(
+        return "getelementptr(%s* %s, int 0, uint 1, int %s)" % (
             self.get_typerepr(),
             self.ref,
             index)

Modified: pypy/dist/pypy/translator/llvm/gc.py
==============================================================================
--- pypy/dist/pypy/translator/llvm/gc.py	(original)
+++ pypy/dist/pypy/translator/llvm/gc.py	Sun Oct 28 02:24:11 2007
@@ -7,12 +7,6 @@
 
 from pypy.translator.llvm.buildllvm import postfix
 
-def have_boehm():
-    import distutils.sysconfig
-    from os.path import exists
-    libdir = distutils.sysconfig.EXEC_PREFIX + "/lib"  
-    return exists(libdir + '/libgc.so') or exists(libdir + '/libgc.a')
-
 class GcPolicy:
     n_malloced = 0
     def __init__(self, db):
@@ -49,10 +43,7 @@
         raise Exception, 'GcPolicy should not be used directly'
 
     def new(db, gcpolicy=None):
-    #    """ factory """
         if gcpolicy == 'boehm':
-            # XXX would be nice to localise this sort of thing?
-            #assert have_boehm(), 'warning: Boehm GC libary not found in /usr/lib'
             gcpolicy = BoehmGcPolicy(db)
         elif gcpolicy == 'ref':
             gcpolicy = RefcountingGcPolicy(db)

Modified: pypy/dist/pypy/translator/llvm/opwriter.py
==============================================================================
--- pypy/dist/pypy/translator/llvm/opwriter.py	(original)
+++ pypy/dist/pypy/translator/llvm/opwriter.py	Sun Oct 28 02:24:11 2007
@@ -428,6 +428,7 @@
 
         # getelementptr gets a pointer to the right type, except the generated code really expected 
         # an array of size 1... so we just cast it
+        #assert isinstance(opr.op.result.concretetype.TO, lltype.FixedSizeArray) #XXX why?
         element_type = self.db.repr_type(op.result.concretetype.TO.OF) + '*'
         self.codewriter.cast(opr.retref, element_type, tmpvar, opr.rettype)
 
@@ -443,6 +444,7 @@
 
         # getelementptr gets a pointer to the right type, except the generated code really expected 
         # an array of size 1... so we just cast it
+        #assert isinstance(opr.op.result.concretetype.TO, lltype.FixedSizeArray) #XXX why?
         element_type = self.db.repr_type(opr.op.result.concretetype.TO.OF) + '*'
         self.codewriter.cast(opr.retref, element_type, tmpvar, opr.rettype)
 
@@ -458,6 +460,15 @@
         element_type = self.db.repr_type(opr.op.result.concretetype.TO.OF) + '*'
         self.codewriter.cast(opr.retref, element_type, tmpvar, opr.rettype)
 
+# +        if isinstance(opr.op.result.concretetype, lltype.FixedSizeArray):            
+# +            tmpvar = self._tmp()
+# +            self.codewriter.getelementptr(tmpvar, arraytype, array, [(self.word, incr)])
+# +            element_type = self.db.repr_type(opr.op.result.concretetype.TO.OF) + '*'
+# +            self.codewriter.cast(opr.retref, element_type, tmpvar, opr.rettype)
+# +        else:
+# +            self.codewriter.getelementptr(opr.retref, arraytype, array, [(self.word, incr)], getptr=False)
+# +
+
     def adr_delta(self, opr):
         addr1, addr2 = self._tmp(2)
         self.codewriter.cast(addr1, opr.argtypes[0], opr.argrefs[0], self.word)
@@ -583,3 +594,4 @@
         # If it gets this far it is always false
         self.codewriter.cast(opr.retref, 'bool',
                              'false', opr.rettype)
+

Modified: pypy/dist/pypy/translator/llvm/structnode.py
==============================================================================
--- pypy/dist/pypy/translator/llvm/structnode.py	(original)
+++ pypy/dist/pypy/translator/llvm/structnode.py	Sun Oct 28 02:24:11 2007
@@ -192,6 +192,8 @@
 
     def setup(self):
         if isinstance(self.value, lltype._subarray):
+            # XXX what is this?
+            # self.value._parentstructure()
             p, c = lltype.parentlink(self.value)
             if p is not None:
                 self.db.prepare_constant(lltype.typeOf(p), p)



More information about the Pypy-commit mailing list