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

rxe at codespeak.net rxe at codespeak.net
Fri Dec 9 20:37:14 CET 2005


Author: rxe
Date: Fri Dec  9 20:37:13 2005
New Revision: 20972

Modified:
   pypy/dist/pypy/translator/llvm/database.py
   pypy/dist/pypy/translator/llvm/opwriter.py
Log:
Attempt to use the database in a few places that we werent.  This is an attempt
to fix weirdness during translating pypy-llvm, testing on snake now.



Modified: pypy/dist/pypy/translator/llvm/database.py
==============================================================================
--- pypy/dist/pypy/translator/llvm/database.py	(original)
+++ pypy/dist/pypy/translator/llvm/database.py	Fri Dec  9 20:37:13 2005
@@ -323,6 +323,10 @@
     def repr_name(self, obj):
         return self.obj2node[obj].ref
 
+    def repr_value(self, value):
+        # XXX Testing
+        return self.obj2node[value].get_ref()
+
     # __________________________________________________________
     # Primitive stuff
 

Modified: pypy/dist/pypy/translator/llvm/opwriter.py
==============================================================================
--- pypy/dist/pypy/translator/llvm/opwriter.py	(original)
+++ pypy/dist/pypy/translator/llvm/opwriter.py	Fri Dec  9 20:37:13 2005
@@ -305,9 +305,9 @@
 
     def last_exception_type_ptr(self, op):
         e = self.db.translator.rtyper.getexceptiondata()
-        # XXX Can we use database?
-        lltype_of_exception_type = ('%structtype_' + e.lltype_of_exception_type.TO.__name__ + '*')
-        self.codewriter.load('%'+str(op.result), lltype_of_exception_type, '%last_exception_type')
+        self.codewriter.load('%' + str(op.result),
+                             self.db.repr_type(e.lltype_of_exception_type),
+                             '%last_exception_type')
 
     def invoke(self, op):
         op_args = [arg for arg in op.args
@@ -344,15 +344,9 @@
                              argtypes, none_label, exc_label)
 
         e = self.db.translator.rtyper.getexceptiondata()
-        ll_exception_match       = '%pypy_' + e.fn_exception_match._obj._name
-
-        # XXX Can we use database?
-        lltype_of_exception_type = ('%structtype_' +
-                                    e.lltype_of_exception_type.TO.__name__
-                                    + '*')
-        lltype_of_exception_value = ('%structtype_' +
-                                    e.lltype_of_exception_value.TO.__name__
-                                    + '*')
+        ll_exception_match = self.db.repr_value(e.fn_exception_match._obj)        
+        lltype_of_exception_type = self.db.repr_type(e.lltype_of_exception_type)
+        lltype_of_exception_value = self.db.repr_type(e.lltype_of_exception_value)
 
         self.codewriter.label(exc_label)
 



More information about the Pypy-commit mailing list