[pypy-svn] r18730 - pypy/dist/pypy/translator/js

ericvrp at codespeak.net ericvrp at codespeak.net
Tue Oct 18 11:11:39 CEST 2005


Author: ericvrp
Date: Tue Oct 18 11:11:38 2005
New Revision: 18730

Modified:
   pypy/dist/pypy/translator/js/arraynode.py
   pypy/dist/pypy/translator/js/funcnode.py
   pypy/dist/pypy/translator/js/node.py
   pypy/dist/pypy/translator/js/structnode.py
Log:
Removed slots and some caching.
I don't want to see that kind of code before things really start working!


Modified: pypy/dist/pypy/translator/js/arraynode.py
==============================================================================
--- pypy/dist/pypy/translator/js/arraynode.py	(original)
+++ pypy/dist/pypy/translator/js/arraynode.py	Tue Oct 18 11:11:38 2005
@@ -11,8 +11,6 @@
     a struct,
     pointer to struct/array
     """
-    __slots__ = "db value arraytype ref".split()
-    
     def __init__(self, db, value):
         assert isinstance(lltype.typeOf(value), lltype.Array)
         self.db = db
@@ -59,8 +57,6 @@
 
 
 class StrArrayNode(ArrayNode):
-    __slots__ = "".split()
-
     printables = dict([(ord(i), None) for i in
       ("0123456789abcdefghijklmnopqrstuvwxyz" +
        "ABCDEFGHIJKLMNOPQRSTUVWXYZ" +
@@ -78,8 +74,6 @@
 
 
 class VoidArrayNode(ArrayNode):
-    __slots__ = "db value ref".split()
-
     def __init__(self, db, value):
         assert isinstance(lltype.typeOf(value), lltype.Array)
         self.db = db

Modified: pypy/dist/pypy/translator/js/funcnode.py
==============================================================================
--- pypy/dist/pypy/translator/js/funcnode.py	(original)
+++ pypy/dist/pypy/translator/js/funcnode.py	Tue Oct 18 11:11:38 2005
@@ -10,8 +10,6 @@
 
 
 class FuncNode(ConstantLLVMNode):
-    __slots__ = "db value ref graph blockindex".split()
-
     def __init__(self, db, value):
         self.db = db
         self.value = value

Modified: pypy/dist/pypy/translator/js/node.py
==============================================================================
--- pypy/dist/pypy/translator/js/node.py	(original)
+++ pypy/dist/pypy/translator/js/node.py	Tue Oct 18 11:11:38 2005
@@ -4,8 +4,6 @@
 _nodename_count = {}
 
 class LLVMNode(object):
-    __slots__ = "".split()
-
     def reset_nodename_count():
         global _nodename_count
         _nodename_count = {}
@@ -50,8 +48,6 @@
 
 
 class ConstantLLVMNode(LLVMNode):
-    __slots__ = "".split()
-
     def get_ref(self):
         """ Returns a reference as used for operations in blocks. """        
         return self.ref

Modified: pypy/dist/pypy/translator/js/structnode.py
==============================================================================
--- pypy/dist/pypy/translator/js/structnode.py	(original)
+++ pypy/dist/pypy/translator/js/structnode.py	Tue Oct 18 11:11:38 2005
@@ -17,8 +17,6 @@
     a struct,
     pointer to struct/array
     """
-    __slots__ = "db value structtype ref _get_ref_cache _get_types".split()
-
     def __init__(self, db, value):
         self.db = db
         self.value = value
@@ -26,7 +24,6 @@
         prefix = 'structinstance_'
         name = str(value).split()[1]
         self.ref = self.make_ref(prefix, name)
-        self._get_ref_cache = None
         self._get_types = self._compute_types()
 
     def __str__(self):
@@ -72,14 +69,11 @@
 
     def get_ref(self):
         """ Returns a reference as used for operations in blocks. """        
-        if self._get_ref_cache:
-            return self._get_ref_cache
         p, c = lltype.parentlink(self.value)
         if p is None:
             ref = self.ref
         else:
             ref = self.db.get_childref(p, c)
-        self._get_ref_cache = ref
         return ref
 
     def constantvalue(self):
@@ -143,16 +137,12 @@
         super(StructVarsizeNode, self).setup()
     
     #def get_typerepr(self):
-    #        try:
-    #            return self._get_typerepr_cache
-    #        except:
-    #            # last type is a special case and need to be worked out recursively
-    #            types = self._get_types[:-1]
-    #            types_repr = [self.db.repr_type(T) for name, T in types]
-    #            types_repr.append(self._get_lastnode().get_typerepr())
-    #            result = "{%s}" % ", ".join(types_repr)
-    #            self._get_typerepr_cache = result
-    #            return result
+    #    # last type is a special case and need to be worked out recursively
+    #    types = self._get_types[:-1]
+    #    types_repr = [self.db.repr_type(T) for name, T in types]
+    #    types_repr.append(self._get_lastnode().get_typerepr())
+    #    result = "{%s}" % ", ".join(types_repr)
+    #    return result
          
     def get_ref(self):
         return self.ref



More information about the Pypy-commit mailing list