Author: Benjamin Peterson <benja...@python.org>
Branch: 
Changeset: r64045:71b42a2d862d
Date: 2013-05-13 15:04 -0500
http://bitbucket.org/pypy/pypy/changeset/71b42a2d862d/

Log:    move JitException subclasses to jitexc module

diff --git a/rpython/jit/metainterp/blackhole.py 
b/rpython/jit/metainterp/blackhole.py
--- a/rpython/jit/metainterp/blackhole.py
+++ b/rpython/jit/metainterp/blackhole.py
@@ -1,7 +1,8 @@
 from rpython.jit.codewriter import heaptracker, longlong
 from rpython.jit.codewriter.jitcode import JitCode, SwitchDictDescr
 from rpython.jit.metainterp.compile import ResumeAtPositionDescr
-from rpython.jit.metainterp.jitexc import JitException, get_llexception, 
reraise
+from rpython.jit.metainterp.jitexc import get_llexception, reraise
+from rpython.jit.metainterp import jitexc
 from rpython.rlib import longlong2float
 from rpython.rlib.debug import ll_assert, make_sure_not_resized
 from rpython.rlib.objectmodel import we_are_translated
@@ -25,7 +26,7 @@
 LONGLONG_TYPECODE = 'i' if longlong.is_64_bit else 'f'
 
 
-class LeaveFrame(JitException):
+class LeaveFrame(jitexc.JitException):
     pass
 
 class MissingValue(object):
@@ -306,7 +307,7 @@
                 self.dispatch_loop(self, self.jitcode.code, self.position)
             except LeaveFrame:
                 break
-            except JitException:
+            except jitexc.JitException:
                 raise     # go through
             except Exception, e:
                 lle = get_llexception(self.cpu, e)
@@ -902,8 +903,7 @@
     @arguments("self", "i", "I", "R", "F", "I", "R", "F")
     def bhimpl_jit_merge_point(self, jdindex, *args):
         if self.nextblackholeinterp is None:    # we are the last level
-            CRN = self.builder.metainterp_sd.ContinueRunningNormally
-            raise CRN(*args)
+            raise jitexc.ContinueRunningNormally(*args)
             # Note that the case above is an optimization: the case
             # below would work too.  But it keeps unnecessary stuff on
             # the stack; the solution above first gets rid of the blackhole
@@ -1400,7 +1400,7 @@
             # we now proceed to interpret the bytecode in this frame
             self.run()
         #
-        except JitException, e:
+        except jitexc.JitException, e:
             raise     # go through
         except Exception, e:
             # if we get an exception, return it to the caller frame
@@ -1495,20 +1495,20 @@
         sd = self.builder.metainterp_sd
         kind = self._return_type
         if kind == 'v':
-            raise sd.DoneWithThisFrameVoid()
+            raise jitexc.DoneWithThisFrameVoid()
         elif kind == 'i':
-            raise sd.DoneWithThisFrameInt(self.get_tmpreg_i())
+            raise jitexc.DoneWithThisFrameInt(self.get_tmpreg_i())
         elif kind == 'r':
-            raise sd.DoneWithThisFrameRef(self.cpu, self.get_tmpreg_r())
+            raise jitexc.DoneWithThisFrameRef(self.cpu, self.get_tmpreg_r())
         elif kind == 'f':
-            raise sd.DoneWithThisFrameFloat(self.get_tmpreg_f())
+            raise jitexc.DoneWithThisFrameFloat(self.get_tmpreg_f())
         else:
             assert False
 
     def _exit_frame_with_exception(self, e):
         sd = self.builder.metainterp_sd
         e = lltype.cast_opaque_ptr(llmemory.GCREF, e)
-        raise sd.ExitFrameWithExceptionRef(self.cpu, e)
+        raise jitexc.ExitFrameWithExceptionRef(self.cpu, e)
 
     def _handle_jitexception_in_portal(self, e):
         # This case is really rare, but can occur if
@@ -1558,23 +1558,23 @@
     while True:
         try:
             current_exc = blackholeinterp._resume_mainloop(current_exc)
-        except JitException, e:
+        except jitexc.JitException as e:
             blackholeinterp, current_exc = _handle_jitexception(
                 blackholeinterp, e)
         blackholeinterp.builder.release_interp(blackholeinterp)
         blackholeinterp = blackholeinterp.nextblackholeinterp
 
-def _handle_jitexception(blackholeinterp, jitexc):
+def _handle_jitexception(blackholeinterp, exc):
     # See comments in _handle_jitexception_in_portal().
     while not blackholeinterp.jitcode.is_portal:
         blackholeinterp.builder.release_interp(blackholeinterp)
         blackholeinterp = blackholeinterp.nextblackholeinterp
     if blackholeinterp.nextblackholeinterp is None:
         blackholeinterp.builder.release_interp(blackholeinterp)
-        raise jitexc     # bottommost entry: go through
+        raise exc     # bottommost entry: go through
     # We have reached a recursive portal level.
     try:
-        blackholeinterp._handle_jitexception_in_portal(jitexc)
+        blackholeinterp._handle_jitexception_in_portal(exc)
     except Exception, e:
         # It raised a general exception (it should not be a JitException here).
         lle = get_llexception(blackholeinterp.cpu, e)
diff --git a/rpython/jit/metainterp/compile.py 
b/rpython/jit/metainterp/compile.py
--- a/rpython/jit/metainterp/compile.py
+++ b/rpython/jit/metainterp/compile.py
@@ -12,7 +12,7 @@
 from rpython.jit.metainterp.history import TreeLoop, Box, JitCellToken, 
TargetToken
 from rpython.jit.metainterp.history import AbstractFailDescr, BoxInt
 from rpython.jit.metainterp.history import BoxPtr, BoxFloat, ConstInt
-from rpython.jit.metainterp import history, resume
+from rpython.jit.metainterp import history, resume, jitexc
 from rpython.jit.metainterp.optimize import InvalidLoop
 from rpython.jit.metainterp.inliner import Inliner
 from rpython.jit.metainterp.resume import NUMBERING, PENDINGFIELDSP, 
ResumeDataDirectReader
@@ -415,32 +415,32 @@
 class DoneWithThisFrameDescrVoid(_DoneWithThisFrameDescr):
     def handle_fail(self, deadframe, metainterp_sd, jitdriver_sd):
         assert jitdriver_sd.result_type == history.VOID
-        raise metainterp_sd.DoneWithThisFrameVoid()
+        raise jitexc.DoneWithThisFrameVoid()
 
 class DoneWithThisFrameDescrInt(_DoneWithThisFrameDescr):
     def handle_fail(self, deadframe, metainterp_sd, jitdriver_sd):
         assert jitdriver_sd.result_type == history.INT
         result = metainterp_sd.cpu.get_int_value(deadframe, 0)
-        raise metainterp_sd.DoneWithThisFrameInt(result)
+        raise jitexc.DoneWithThisFrameInt(result)
 
 class DoneWithThisFrameDescrRef(_DoneWithThisFrameDescr):
     def handle_fail(self, deadframe, metainterp_sd, jitdriver_sd):
         assert jitdriver_sd.result_type == history.REF
         cpu = metainterp_sd.cpu
         result = cpu.get_ref_value(deadframe, 0)
-        raise metainterp_sd.DoneWithThisFrameRef(cpu, result)
+        raise jitexc.DoneWithThisFrameRef(cpu, result)
 
 class DoneWithThisFrameDescrFloat(_DoneWithThisFrameDescr):
     def handle_fail(self, deadframe, metainterp_sd, jitdriver_sd):
         assert jitdriver_sd.result_type == history.FLOAT
         result = metainterp_sd.cpu.get_float_value(deadframe, 0)
-        raise metainterp_sd.DoneWithThisFrameFloat(result)
+        raise jitexc.DoneWithThisFrameFloat(result)
 
 class ExitFrameWithExceptionDescrRef(_DoneWithThisFrameDescr):
     def handle_fail(self, deadframe, metainterp_sd, jitdriver_sd):
         cpu = metainterp_sd.cpu
         value = cpu.get_ref_value(deadframe, 0)
-        raise metainterp_sd.ExitFrameWithExceptionRef(cpu, value)
+        raise jitexc.ExitFrameWithExceptionRef(cpu, value)
 
 
 class TerminatingLoopToken(JitCellToken): # FIXME: kill?
@@ -865,7 +865,7 @@
         if not exception:
             exception = cast_instance_to_gcref(memory_error)
         assert exception, "PropagateExceptionDescr: no exception??"
-        raise metainterp_sd.ExitFrameWithExceptionRef(cpu, exception)
+        raise jitexc.ExitFrameWithExceptionRef(cpu, exception)
 
 def compile_tmp_callback(cpu, jitdriver_sd, greenboxes, redargtypes,
                          memory_manager=None):
diff --git a/rpython/jit/metainterp/jitexc.py b/rpython/jit/metainterp/jitexc.py
--- a/rpython/jit/metainterp/jitexc.py
+++ b/rpython/jit/metainterp/jitexc.py
@@ -1,8 +1,9 @@
 from rpython.rtyper.annlowlevel import cast_instance_to_base_ptr
 from rpython.rtyper.annlowlevel import cast_base_ptr_to_instance
-from rpython.rtyper.lltypesystem import rclass
+from rpython.rtyper.lltypesystem import lltype, rclass
 from rpython.rtyper.llinterp import LLException
 from rpython.rlib.objectmodel import we_are_translated
+from rpython.jit.codewriter import longlong
 
 
 class JitException(Exception):
@@ -12,6 +13,54 @@
     """
     _go_through_llinterp_uncaught_ = True     # ugh
 
+class DoneWithThisFrameVoid(JitException):
+    def __str__(self):
+        return 'DoneWithThisFrameVoid()'
+
+class DoneWithThisFrameInt(JitException):
+    def __init__(self, result):
+        assert lltype.typeOf(result) is lltype.Signed
+        self.result = result
+    def __str__(self):
+        return 'DoneWithThisFrameInt(%s)' % (self.result,)
+
+class DoneWithThisFrameRef(JitException):
+    def __init__(self, cpu, result):
+        assert lltype.typeOf(result) == cpu.ts.BASETYPE
+        self.result = result
+    def __str__(self):
+        return 'DoneWithThisFrameRef(%s)' % (self.result,)
+
+class DoneWithThisFrameFloat(JitException):
+    def __init__(self, result):
+        assert lltype.typeOf(result) is longlong.FLOATSTORAGE
+        self.result = result
+    def __str__(self):
+        return 'DoneWithThisFrameFloat(%s)' % (self.result,)
+
+class ExitFrameWithExceptionRef(JitException):
+    def __init__(self, cpu, value):
+        assert lltype.typeOf(value) == cpu.ts.BASETYPE
+        self.value = value
+    def __str__(self):
+        return 'ExitFrameWithExceptionRef(%s)' % (self.value,)
+
+class ContinueRunningNormally(JitException):
+    def __init__(self, gi, gr, gf, ri, rr, rf):
+        # the six arguments are: lists of green ints, greens refs,
+        # green floats, red ints, red refs, and red floats.
+        self.green_int = gi
+        self.green_ref = gr
+        self.green_float = gf
+        self.red_int = ri
+        self.red_ref = rr
+        self.red_float = rf
+    def __str__(self):
+        return 'ContinueRunningNormally(%s, %s, %s, %s, %s, %s)' % (
+            self.green_int, self.green_ref, self.green_float,
+            self.red_int, self.red_ref, self.red_float)
+
+
 def _get_standard_error(rtyper, Class):
     exdata = rtyper.getexceptiondata()
     clsdef = rtyper.annotator.bookkeeper.getuniqueclassdef(Class)
diff --git a/rpython/jit/metainterp/pyjitpl.py 
b/rpython/jit/metainterp/pyjitpl.py
--- a/rpython/jit/metainterp/pyjitpl.py
+++ b/rpython/jit/metainterp/pyjitpl.py
@@ -5,11 +5,10 @@
 from rpython.jit.codewriter import heaptracker
 from rpython.jit.codewriter.effectinfo import EffectInfo
 from rpython.jit.codewriter.jitcode import JitCode, SwitchDictDescr
-from rpython.jit.metainterp import history, compile, resume, executor
+from rpython.jit.metainterp import history, compile, resume, executor, jitexc
 from rpython.jit.metainterp.heapcache import HeapCache
 from rpython.jit.metainterp.history import (Const, ConstInt, ConstPtr,
     ConstFloat, Box, TargetToken)
-from rpython.jit.metainterp.jitexc import JitException, get_llexception
 from rpython.jit.metainterp.jitprof import EmptyProfiler
 from rpython.jit.metainterp.logger import Logger
 from rpython.jit.metainterp.optimizeopt.util import args_dict_box
@@ -1705,13 +1704,13 @@
             result_type = self.jitdriver_sd.result_type
             if result_type == history.VOID:
                 assert resultbox is None
-                raise sd.DoneWithThisFrameVoid()
+                raise jitexc.DoneWithThisFrameVoid()
             elif result_type == history.INT:
-                raise sd.DoneWithThisFrameInt(resultbox.getint())
+                raise jitexc.DoneWithThisFrameInt(resultbox.getint())
             elif result_type == history.REF:
-                raise sd.DoneWithThisFrameRef(self.cpu, 
resultbox.getref_base())
+                raise jitexc.DoneWithThisFrameRef(self.cpu, 
resultbox.getref_base())
             elif result_type == history.FLOAT:
-                raise sd.DoneWithThisFrameFloat(resultbox.getfloatstorage())
+                raise 
jitexc.DoneWithThisFrameFloat(resultbox.getfloatstorage())
             else:
                 assert False
 
@@ -1734,7 +1733,7 @@
             self.compile_exit_frame_with_exception(excvaluebox)
         except SwitchToBlackhole, stb:
             self.aborted_tracing(stb.reason)
-        raise self.staticdata.ExitFrameWithExceptionRef(self.cpu, 
excvaluebox.getref_base())
+        raise jitexc.ExitFrameWithExceptionRef(self.cpu, 
excvaluebox.getref_base())
 
     def check_recursion_invariant(self):
         portal_call_depth = -1
@@ -1842,9 +1841,9 @@
             op.name = self.framestack[-1].jitcode.name
 
     def execute_raised(self, exception, constant=False):
-        if isinstance(exception, JitException):
-            raise JitException, exception      # go through
-        llexception = get_llexception(self.cpu, exception)
+        if isinstance(exception, jitexc.JitException):
+            raise jitexc.JitException, exception      # go through
+        llexception = jitexc.get_llexception(self.cpu, exception)
         self.execute_ll_raised(llexception, constant)
 
     def execute_ll_raised(self, llexception, constant=False):
@@ -2089,7 +2088,7 @@
             gi, gr, gf = self._unpack_boxes(live_arg_boxes, 0, num_green_args)
             ri, rr, rf = self._unpack_boxes(live_arg_boxes, num_green_args,
                                             len(live_arg_boxes))
-            CRN = self.staticdata.ContinueRunningNormally
+            CRN = jitexc.ContinueRunningNormally
             raise CRN(gi, gr, gf, ri, rr, rf)
         else:
             # However, in order to keep the existing tests working
@@ -2671,11 +2670,11 @@
 
 # ____________________________________________________________
 
-class ChangeFrame(JitException):
+class ChangeFrame(jitexc.JitException):
     """Raised after we mutated metainterp.framestack, in order to force
     it to reload the current top-of-stack frame that gets interpreted."""
 
-class SwitchToBlackhole(JitException):
+class SwitchToBlackhole(jitexc.JitException):
     def __init__(self, reason, raising_exception=False):
         self.reason = reason
         self.raising_exception = raising_exception
diff --git a/rpython/jit/metainterp/test/support.py 
b/rpython/jit/metainterp/test/support.py
--- a/rpython/jit/metainterp/test/support.py
+++ b/rpython/jit/metainterp/test/support.py
@@ -6,7 +6,7 @@
 from rpython.jit.metainterp.warmspot import ll_meta_interp, get_stats
 from rpython.jit.metainterp.warmstate import unspecialize_value
 from rpython.jit.metainterp.optimizeopt import ALL_OPTS_DICT
-from rpython.jit.metainterp import pyjitpl, history
+from rpython.jit.metainterp import pyjitpl, history, jitexc
 from rpython.jit.codewriter.policy import JitPolicy
 from rpython.jit.codewriter import codewriter, longlong
 from rpython.rlib.rfloat import isnan
@@ -118,30 +118,19 @@
     return blackholeinterp._final_result_anytype()
 
 def _run_with_pyjitpl(testself, args):
-
-    class DoneWithThisFrame(Exception):
-        pass
-
-    class DoneWithThisFrameRef(DoneWithThisFrame):
-        def __init__(self, cpu, *args):
-            DoneWithThisFrame.__init__(self, *args)
-
     cw = testself.cw
     opt = history.Options(listops=True)
     metainterp_sd = pyjitpl.MetaInterpStaticData(cw.cpu, opt)
     metainterp_sd.finish_setup(cw)
     [jitdriver_sd] = metainterp_sd.jitdrivers_sd
     metainterp = pyjitpl.MetaInterp(metainterp_sd, jitdriver_sd)
-    metainterp_sd.DoneWithThisFrameInt = DoneWithThisFrame
-    metainterp_sd.DoneWithThisFrameRef = DoneWithThisFrameRef
-    metainterp_sd.DoneWithThisFrameFloat = DoneWithThisFrame
     testself.metainterp = metainterp
     try:
         metainterp.compile_and_run_once(jitdriver_sd, *args)
-    except DoneWithThisFrame, e:
-        #if option.view:
-        #    metainterp.stats.view()
-        return e.args[0]
+    except (jitexc.DoneWithThisFrameInt,
+            jitexc.DoneWithThisFrameRef,
+            jitexc.DoneWithThisFrameFloat) as e:
+        return e.result
     else:
         raise Exception("FAILED")
 
diff --git a/rpython/jit/metainterp/test/test_blackhole.py 
b/rpython/jit/metainterp/test/test_blackhole.py
--- a/rpython/jit/metainterp/test/test_blackhole.py
+++ b/rpython/jit/metainterp/test/test_blackhole.py
@@ -4,7 +4,7 @@
 from rpython.jit.metainterp.blackhole import BlackholeInterpBuilder
 from rpython.jit.metainterp.blackhole import BlackholeInterpreter
 from rpython.jit.metainterp.blackhole import convert_and_run_from_pyjitpl
-from rpython.jit.metainterp import history, pyjitpl
+from rpython.jit.metainterp import history, pyjitpl, jitexc
 from rpython.jit.codewriter.assembler import JitCode
 from rpython.rtyper.lltypesystem import lltype, llmemory
 from rpython.rtyper.llinterp import LLException
@@ -119,6 +119,7 @@
                       "\x01\x02",          # int_return/i
                       [],
                       num_regs_i=3, num_regs_r=0, num_regs_f=0)
+        jitcode.is_portal = True
         pc = 1
         registers_i = [history.BoxInt(40), history.ConstInt(2), None]
     class MyMetaInterp:
@@ -129,8 +130,6 @@
                 def start_blackhole(): pass
                 @staticmethod
                 def end_blackhole(): pass
-            class DoneWithThisFrameInt(Exception):
-                pass
         last_exc_value_box = None
         framestack = [MyMIFrame()]
     MyMetaInterp.staticdata.blackholeinterpbuilder = getblackholeinterp(
@@ -138,9 +137,9 @@
     MyMetaInterp.staticdata.blackholeinterpbuilder.metainterp_sd = \
         MyMetaInterp.staticdata
     #
-    d = py.test.raises(MyMetaInterp.staticdata.DoneWithThisFrameInt,
+    d = py.test.raises(jitexc.DoneWithThisFrameInt,
                        convert_and_run_from_pyjitpl, MyMetaInterp())
-    assert d.value.args == (42,)
+    assert d.value.result == 42
 
 
 class TestBlackhole(LLJitMixin):
diff --git a/rpython/jit/metainterp/test/test_warmspot.py 
b/rpython/jit/metainterp/test/test_warmspot.py
--- a/rpython/jit/metainterp/test/test_warmspot.py
+++ b/rpython/jit/metainterp/test/test_warmspot.py
@@ -1,4 +1,5 @@
 import py
+from rpython.jit.metainterp import jitexc
 from rpython.jit.metainterp.warmspot import get_stats
 from rpython.rlib.jit import JitDriver, set_param, unroll_safe, jit_callback
 from rpython.jit.backend.llgraph import runner
@@ -583,14 +584,14 @@
                 no = self.no
                 assert deadframe._no == no
                 if no == 0:
-                    raise metainterp_sd.warmrunnerdesc.DoneWithThisFrameInt(3)
+                    raise jitexc.DoneWithThisFrameInt(3)
                 if no == 1:
-                    raise metainterp_sd.warmrunnerdesc.ContinueRunningNormally(
+                    raise jitexc.ContinueRunningNormally(
                         [0], [], [], [1], [], [])
                 if no == 3:
                     exc = lltype.malloc(OBJECT)
                     exc.typeptr = exc_vtable
-                    raise 
metainterp_sd.warmrunnerdesc.ExitFrameWithExceptionRef(
+                    raise jitexc.ExitFrameWithExceptionRef(
                         metainterp_sd.cpu,
                         lltype.cast_opaque_ptr(llmemory.GCREF, exc))
                 assert 0
diff --git a/rpython/jit/metainterp/warmspot.py 
b/rpython/jit/metainterp/warmspot.py
--- a/rpython/jit/metainterp/warmspot.py
+++ b/rpython/jit/metainterp/warmspot.py
@@ -16,10 +16,9 @@
 from rpython.translator.backendopt import removenoops
 from rpython.translator.unsimplify import call_final_function
 
-from rpython.jit.metainterp import history, pyjitpl, gc, memmgr
+from rpython.jit.metainterp import history, pyjitpl, gc, memmgr, jitexc
 from rpython.jit.metainterp.pyjitpl import MetaInterpStaticData
 from rpython.jit.metainterp.jitprof import Profiler, EmptyProfiler
-from rpython.jit.metainterp.jitexc import JitException
 from rpython.jit.metainterp.jitdriver import JitDriverStaticData
 from rpython.jit.codewriter import support, codewriter, longlong
 from rpython.jit.codewriter.policy import JitPolicy
@@ -172,9 +171,6 @@
     stats.maybe_view()
     stats.check_consistency()
 
-class ContinueRunningNormallyBase(JitException):
-    pass
-
 # ____________________________________________________________
 
 class WarmRunnerDesc(object):
@@ -210,7 +206,6 @@
         #
         self.hooks = policy.jithookiface
         self.make_virtualizable_infos()
-        self.make_exception_classes()
         self.make_driverhook_graphs()
         self.make_enter_functions()
         self.rewrite_jit_merge_points(policy)
@@ -466,70 +461,6 @@
                 vinfos[VTYPEPTR] = VirtualizableInfo(self, VTYPEPTR)
             jd.virtualizable_info = vinfos[VTYPEPTR]
 
-    def make_exception_classes(self):
-
-        class DoneWithThisFrameVoid(JitException):
-            def __str__(self):
-                return 'DoneWithThisFrameVoid()'
-
-        class DoneWithThisFrameInt(JitException):
-            def __init__(self, result):
-                assert lltype.typeOf(result) is lltype.Signed
-                self.result = result
-            def __str__(self):
-                return 'DoneWithThisFrameInt(%s)' % (self.result,)
-
-        class DoneWithThisFrameRef(JitException):
-            def __init__(self, cpu, result):
-                assert lltype.typeOf(result) == cpu.ts.BASETYPE
-                self.result = result
-            def __str__(self):
-                return 'DoneWithThisFrameRef(%s)' % (self.result,)
-
-        class DoneWithThisFrameFloat(JitException):
-            def __init__(self, result):
-                assert lltype.typeOf(result) is longlong.FLOATSTORAGE
-                self.result = result
-            def __str__(self):
-                return 'DoneWithThisFrameFloat(%s)' % (self.result,)
-
-        class ExitFrameWithExceptionRef(JitException):
-            def __init__(self, cpu, value):
-                assert lltype.typeOf(value) == cpu.ts.BASETYPE
-                self.value = value
-            def __str__(self):
-                return 'ExitFrameWithExceptionRef(%s)' % (self.value,)
-
-        class ContinueRunningNormally(ContinueRunningNormallyBase):
-            def __init__(self, gi, gr, gf, ri, rr, rf):
-                # the six arguments are: lists of green ints, greens refs,
-                # green floats, red ints, red refs, and red floats.
-                self.green_int = gi
-                self.green_ref = gr
-                self.green_float = gf
-                self.red_int = ri
-                self.red_ref = rr
-                self.red_float = rf
-            def __str__(self):
-                return 'ContinueRunningNormally(%s, %s, %s, %s, %s, %s)' % (
-                    self.green_int, self.green_ref, self.green_float,
-                    self.red_int, self.red_ref, self.red_float)
-
-        # XXX there is no point any more to not just have the exceptions
-        # as globals
-        self.DoneWithThisFrameVoid = DoneWithThisFrameVoid
-        self.DoneWithThisFrameInt = DoneWithThisFrameInt
-        self.DoneWithThisFrameRef = DoneWithThisFrameRef
-        self.DoneWithThisFrameFloat = DoneWithThisFrameFloat
-        self.ExitFrameWithExceptionRef = ExitFrameWithExceptionRef
-        self.ContinueRunningNormally = ContinueRunningNormally
-        self.metainterp_sd.DoneWithThisFrameVoid = DoneWithThisFrameVoid
-        self.metainterp_sd.DoneWithThisFrameInt = DoneWithThisFrameInt
-        self.metainterp_sd.DoneWithThisFrameRef = DoneWithThisFrameRef
-        self.metainterp_sd.DoneWithThisFrameFloat = DoneWithThisFrameFloat
-        self.metainterp_sd.ExitFrameWithExceptionRef = 
ExitFrameWithExceptionRef
-        self.metainterp_sd.ContinueRunningNormally = ContinueRunningNormally
-
     def make_enter_functions(self):
         for jd in self.jitdrivers_sd:
             self.make_enter_function(jd)
@@ -544,7 +475,7 @@
             tb = not we_are_translated() and sys.exc_info()[2]
             try:
                 raise e
-            except JitException:
+            except jitexc.JitException:
                 raise     # go through
             except MemoryError:
                 raise     # go through
@@ -850,7 +781,7 @@
                     # want to interrupt the whole interpreter loop.
                     return support.maybe_on_top_of_llinterp(rtyper,
                                                       portal_ptr)(*args)
-                except self.ContinueRunningNormally, e:
+                except jitexc.ContinueRunningNormally, e:
                     args = ()
                     for ARGTYPE, attrname, count in portalfunc_ARGS:
                         x = getattr(e, attrname)[count]
@@ -858,19 +789,19 @@
                         args = args + (x,)
                     start = False
                     continue
-                except self.DoneWithThisFrameVoid:
+                except jitexc.DoneWithThisFrameVoid:
                     assert result_kind == 'void'
                     return
-                except self.DoneWithThisFrameInt, e:
+                except jitexc.DoneWithThisFrameInt, e:
                     assert result_kind == 'int'
                     return specialize_value(RESULT, e.result)
-                except self.DoneWithThisFrameRef, e:
+                except jitexc.DoneWithThisFrameRef, e:
                     assert result_kind == 'ref'
                     return specialize_value(RESULT, e.result)
-                except self.DoneWithThisFrameFloat, e:
+                except jitexc.DoneWithThisFrameFloat, e:
                     assert result_kind == 'float'
                     return specialize_value(RESULT, e.result)
-                except self.ExitFrameWithExceptionRef, e:
+                except jitexc.ExitFrameWithExceptionRef, e:
                     value = ts.cast_to_baseclass(e.value)
                     if not we_are_translated():
                         raise LLException(ts.get_typeptr(value), value)
@@ -882,7 +813,7 @@
             # XXX the bulk of this function is mostly a copy-paste from above
             try:
                 raise e
-            except self.ContinueRunningNormally, e:
+            except jitexc.ContinueRunningNormally, e:
                 args = ()
                 for ARGTYPE, attrname, count in portalfunc_ARGS:
                     x = getattr(e, attrname)[count]
@@ -892,19 +823,19 @@
                 if result_kind != 'void':
                     result = unspecialize_value(result)
                 return result
-            except self.DoneWithThisFrameVoid:
+            except jitexc.DoneWithThisFrameVoid:
                 assert result_kind == 'void'
                 return
-            except self.DoneWithThisFrameInt, e:
+            except jitexc.DoneWithThisFrameInt, e:
                 assert result_kind == 'int'
                 return e.result
-            except self.DoneWithThisFrameRef, e:
+            except jitexc.DoneWithThisFrameRef, e:
                 assert result_kind == 'ref'
                 return e.result
-            except self.DoneWithThisFrameFloat, e:
+            except jitexc.DoneWithThisFrameFloat, e:
                 assert result_kind == 'float'
                 return e.result
-            except self.ExitFrameWithExceptionRef, e:
+            except jitexc.ExitFrameWithExceptionRef, e:
                 value = ts.cast_to_baseclass(e.value)
                 if not we_are_translated():
                     raise LLException(ts.get_typeptr(value), value)
@@ -932,7 +863,7 @@
                 vinfo.reset_vable_token(virtualizable)
             try:
                 fail_descr.handle_fail(deadframe, self.metainterp_sd, jd)
-            except JitException, e:
+            except jitexc.JitException, e:
                 return handle_jitexception(e)
             else:
                 assert 0, "should have raised"
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to