[pypy-svn] r14558 - pypy/dist/pypy/rpython

arigo at codespeak.net arigo at codespeak.net
Tue Jul 12 19:44:52 CEST 2005


Author: arigo
Date: Tue Jul 12 19:44:49 2005
New Revision: 14558

Modified:
   pypy/dist/pypy/rpython/rpbc.py
   pypy/dist/pypy/rpython/rtyper.py
Log:
Moved some logic out of HighLevelOp.__init__() into a method setup() that can
be called from the proper TyperError-catching context.


Modified: pypy/dist/pypy/rpython/rpbc.py
==============================================================================
--- pypy/dist/pypy/rpython/rpbc.py	(original)
+++ pypy/dist/pypy/rpython/rpbc.py	Tue Jul 12 19:44:49 2005
@@ -7,7 +7,6 @@
 from pypy.rpython.lltype import Ptr, malloc, nullptr
 from pypy.rpython.rmodel import Repr, TyperError, inputconst, warning
 from pypy.rpython import rclass
-from pypy.rpython.rtyper import HighLevelOp
 from pypy.rpython import robject
 
 class __extend__(annmodel.SomePBC):

Modified: pypy/dist/pypy/rpython/rtyper.py
==============================================================================
--- pypy/dist/pypy/rpython/rtyper.py	(original)
+++ pypy/dist/pypy/rpython/rtyper.py	Tue Jul 12 19:44:49 2005
@@ -190,6 +190,7 @@
 
         for hop in self.highlevelops(block, newops):
             try:
+                hop.setup()  # this is called from here to catch TyperErrors...
                 self.translate_hl_to_ll(hop, varmapping)
             except TyperError, e:
                 self.gottypererror(e, block, hop.spaceop, newops)
@@ -423,20 +424,25 @@
 class HighLevelOp(object):
 
     def __init__(self, rtyper, spaceop, exceptionlinks, llops):
-        self.rtyper   = rtyper
-        self.spaceop  = spaceop
+        self.rtyper         = rtyper
+        self.spaceop        = spaceop
+        self.exceptionlinks = exceptionlinks
+        self.llops          = llops
+
+    def setup(self):
+        rtyper = self.rtyper
+        spaceop = self.spaceop
         self.nb_args  = len(spaceop.args)
-        self.llops    = llops
         self.args_v   = list(spaceop.args)
         self.args_s   = [rtyper.binding(a) for a in spaceop.args]
         self.s_result = rtyper.binding(spaceop.result)
         self.args_r   = [rtyper.getrepr(s_a) for s_a in self.args_s]
         self.r_result = rtyper.getrepr(self.s_result)
         rtyper.call_all_setups()  # compute ForwardReferences now
-        self.exceptionlinks = exceptionlinks
 
     def copy(self):
-        result = HighLevelOp.__new__(HighLevelOp)
+        result = HighLevelOp(self.rtyper, self.spaceop,
+                             self.exceptionlinks, self.llops)
         for key, value in self.__dict__.items():
             if type(value) is list:     # grunt
                 value = value[:]



More information about the Pypy-commit mailing list