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

rxe at codespeak.net rxe at codespeak.net
Sat Oct 27 15:44:43 CEST 2007


Author: rxe
Date: Sat Oct 27 15:44:42 2007
New Revision: 48107

Modified:
   pypy/dist/pypy/translator/llvm/arraynode.py
   pypy/dist/pypy/translator/llvm/structnode.py
Log:
hmmm, seems varsize mallocs are now delt with elsewhere (and why there is now an issue with VoidArrayNode). kill some code

Modified: pypy/dist/pypy/translator/llvm/arraynode.py
==============================================================================
--- pypy/dist/pypy/translator/llvm/arraynode.py	(original)
+++ pypy/dist/pypy/translator/llvm/arraynode.py	Sat Oct 27 15:44:42 2007
@@ -4,18 +4,13 @@
 log = log.structnode
 
 class ArrayTypeNode(LLVMNode):
-    __slots__ = "db array arraytype ref constructor_ref constructor_decl".split()
+    __slots__ = "db array arraytype ref".split()
 
     def __init__(self, db, array):
         assert isinstance(array, lltype.Array)
         self.db = db
         self.array = array
         self.arraytype = arraytype = array.OF
-        # ref is used to reference the arraytype in llvm source 
-        # constructor_ref is used to reference the constructor 
-        # for the array type in llvm source code 
-        # constructor_decl is used to declare the constructor
-        # for the array type (see writeimpl)
         name = ""        
         if isinstance(arraytype, lltype.Ptr):
             name += "ptr_"
@@ -26,11 +21,6 @@
             name += str(arraytype)
 
         self.ref = self.make_ref('%arraytype_', name)
-        self.constructor_ref = self.make_ref('%new_array_', name)
-        self.constructor_decl = "%s * %s(%s %%len)" % \
-                                (self.ref,
-                                 self.constructor_ref,
-                                 self.db.get_machine_word())
 
     def __str__(self):
         return "<ArrayTypeNode %r>" % self.ref
@@ -46,9 +36,6 @@
                             self.db.get_machine_word(),
                             self.db.repr_type(self.arraytype))
 
-    def var_malloc_info(self):
-        return self.array, ()
-    
 class VoidArrayTypeNode(LLVMNode):
     __slots__ = "db array ref".split()
 
@@ -147,7 +134,7 @@
 
         s = "%s {%s}" % (self.get_typerepr(), value)
         return s
-    
+
 class StrArrayNode(ArrayNode):
     __slots__ = "".split()
 

Modified: pypy/dist/pypy/translator/llvm/structnode.py
==============================================================================
--- pypy/dist/pypy/translator/llvm/structnode.py	(original)
+++ pypy/dist/pypy/translator/llvm/structnode.py	Sat Oct 27 15:44:42 2007
@@ -63,38 +63,12 @@
 
 
 class StructVarsizeTypeNode(StructTypeNode):
-    __slots__ = "constructor_ref constructor_decl".split()
-
     def __init__(self, db, struct): 
         super(StructVarsizeTypeNode, self).__init__(db, struct)
-        prefix = '%new_varsizestruct_'
-        self.constructor_ref = self.make_ref(prefix, self.name)
-        self.constructor_decl = "%s * %s(%s %%len)" % \
-                                (self.ref,
-                                 self.constructor_ref,
-                                 self.db.get_machine_word())
 
     def __str__(self):
         return "<StructVarsizeTypeNode %r>" %(self.ref,)
         
-    # ______________________________________________________________________
-    # main entry points from genllvm 
-
-    def var_malloc_info(self):
-        # build up a list of indices to get to the last 
-        # var-sized struct (or rather the according array) 
-        indices_to_array = []
-        current = self.struct
-        while isinstance(current, lltype.Struct):
-            last_pos = len(current._names_without_voids()) - 1
-            # struct requires uint consts
-            indices_to_array.append(("uint", last_pos))
-            name = current._names_without_voids()[-1]
-            current = current._flds[name]
-        assert isinstance(current, lltype.Array)
-
-        return current, indices_to_array
-
 class StructNode(ConstantLLVMNode):
     """ A struct constant.  Can simply contain
     a primitive,



More information about the Pypy-commit mailing list