[pypy-svn] r62221 - in pypy/branch/pyjitpl5/pypy/jit: metainterp tl

arigo at codespeak.net arigo at codespeak.net
Fri Feb 27 13:51:47 CET 2009


Author: arigo
Date: Fri Feb 27 13:51:46 2009
New Revision: 62221

Modified:
   pypy/branch/pyjitpl5/pypy/jit/metainterp/optimize.py
   pypy/branch/pyjitpl5/pypy/jit/metainterp/warmspot.py
   pypy/branch/pyjitpl5/pypy/jit/tl/pypyjit_demo.py
Log:
- fix a bug in optimize.py.
- add the exception-catching logic that allowed me to locate this bug.


Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/optimize.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/optimize.py	(original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/optimize.py	Fri Feb 27 13:51:46 2009
@@ -762,15 +762,15 @@
 ##                    self.optimize_setfield(instnode, ofs, valuenode, op.args[3])
 ##                    continue
             elif opname == 'ooisnull' or opname == 'oononnull':
-                instnode = self.nodes[op.args[0]]
+                instnode = self.getnode(op.args[0])
                 if instnode.virtual:
                     box = op.results[0]
                     instnode = InstanceNode(box.constbox(), const=True)
                     self.nodes[box] = instnode
                     continue
             elif opname == 'oois' or opname == 'ooisnot':
-                instnode_x = self.nodes[op.args[0]]
-                instnode_y = self.nodes[op.args[1]]
+                instnode_x = self.getnode(op.args[0])
+                instnode_y = self.getnode(op.args[1])
                 if instnode_x.virtual or instnode_y.virtual:
                     box = op.results[0]
                     instnode = InstanceNode(box.constbox(), const=True)

Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/warmspot.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/warmspot.py	(original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/warmspot.py	Fri Feb 27 13:51:46 2009
@@ -126,8 +126,19 @@
         state = WarmEnterState()
         self.state = state
 
+        def crash_in_jit(e):
+            print "Crash in JIT!"
+            print '%s: %s' % (e.__class__, e)
+            if not we_are_translated():
+                import sys, pdb; pdb.post_mortem(sys.exc_info()[2])
+            raise AssertionError("crash in JIT")
+        crash_in_jit._dont_inline_ = True
+
         def maybe_enter_jit(*args):
-            state.maybe_compile_and_run(*args)
+            try:
+                state.maybe_compile_and_run(*args)
+            except Exception, e:
+                crash_in_jit(e)
         maybe_enter_jit._always_inline_ = True
 
         self.maybe_enter_jit_fn = maybe_enter_jit

Modified: pypy/branch/pyjitpl5/pypy/jit/tl/pypyjit_demo.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/tl/pypyjit_demo.py	(original)
+++ pypy/branch/pyjitpl5/pypy/jit/tl/pypyjit_demo.py	Fri Feb 27 13:51:46 2009
@@ -1,4 +1,6 @@
 
+print 543210
+
 i = 0
 while i < 100:
     i += 3



More information about the Pypy-commit mailing list