[pypy-svn] r37106 - in pypy/dist/pypy: interpreter jit/goal jit/timeshifter module/pypyjit

pedronis at codespeak.net pedronis at codespeak.net
Sun Jan 21 21:18:32 CET 2007


Author: pedronis
Date: Sun Jan 21 21:18:30 2007
New Revision: 37106

Modified:
   pypy/dist/pypy/interpreter/pyopcode.py
   pypy/dist/pypy/jit/goal/jitstep.py
   pypy/dist/pypy/jit/timeshifter/hrtyper.py
   pypy/dist/pypy/jit/timeshifter/transform.py
   pypy/dist/pypy/module/pypyjit/interp_jit.py
Log:
some work to make interp_jit.setup() approach working. It produces a way too big dispatch_jit at the moment tough: to investigate.
 


Modified: pypy/dist/pypy/interpreter/pyopcode.py
==============================================================================
--- pypy/dist/pypy/interpreter/pyopcode.py	(original)
+++ pypy/dist/pypy/interpreter/pyopcode.py	Sun Jan 21 21:18:30 2007
@@ -92,7 +92,8 @@
         if attach_tb:
             pytraceback.record_application_traceback(
                 self.space, operr, self, self.last_instr)
-            ec.exception_trace(self, operr)
+            if BYTECODE_TRACE_ENABLED:
+                ec.exception_trace(self, operr)
 
         block = self.unrollstack(SApplicationException.kind)
         if block is None:

Modified: pypy/dist/pypy/jit/goal/jitstep.py
==============================================================================
--- pypy/dist/pypy/jit/goal/jitstep.py	(original)
+++ pypy/dist/pypy/jit/goal/jitstep.py	Sun Jan 21 21:18:30 2007
@@ -26,6 +26,7 @@
                      'pypy.interpreter.typedef': True,
                      'pypy.interpreter.eval': True,
                      'pypy.interpreter.function': True,
+                     'pypy.interpreter.pytraceback': True,
                      }
 
 POLICY = PyPyHintAnnotatorPolicy(novirtualcontainer = True,
@@ -43,9 +44,10 @@
                                  for v in portal_graph.getargs()])
     drv.log.info('Hint-annotated %d graphs.' % (
         len(hannotator.translator.graphs),))
+    n = len(list(hannotator.translator.graphs[0].iterblocks()))
+    drv.log.info("portal has %d blocks" % n)
     drv.hannotator = hannotator
 
-
 def timeshift(drv):
     from pypy.jit.timeshifter.hrtyper import HintRTyper
     #from pypy.jit.codegen.llgraph.rgenop import RGenOp
@@ -61,6 +63,6 @@
     for graph in ha.translator.graphs:
         checkgraph(graph)
         t.graphs.append(graph)
-
+        
     # XXX temp
     drv.source()

Modified: pypy/dist/pypy/jit/timeshifter/hrtyper.py
==============================================================================
--- pypy/dist/pypy/jit/timeshifter/hrtyper.py	(original)
+++ pypy/dist/pypy/jit/timeshifter/hrtyper.py	Sun Jan 21 21:18:30 2007
@@ -308,6 +308,8 @@
         self.log.event("Timeshifted %d graphs." % (len(seen),))
 
         if origportalgraph:
+            n = len(list(self.portalgraph.iterblocks()))
+            self.log.event("portal has now %d blocks" % n)
             self.rewire_portal()
 
     # remember a shared pointer for the portal graph,

Modified: pypy/dist/pypy/jit/timeshifter/transform.py
==============================================================================
--- pypy/dist/pypy/jit/timeshifter/transform.py	(original)
+++ pypy/dist/pypy/jit/timeshifter/transform.py	Sun Jan 21 21:18:30 2007
@@ -586,8 +586,14 @@
                 v_result = nextblock.inputargs.pop(index)
                 nextblock.inputargs.insert(0, v_result)
         else:
-            assert op.result not in varsalive   # XXX gray result used
-
+            if op.result in varsalive:
+                index = varsalive.index(op.result)
+                del varsalive[index]
+                linkargs.pop(index)
+                c_void = Constant(None, lltype.Void)
+                linkargs.insert(0, c_void)
+                v_result = nextblock.inputargs.pop(index)
+                nextblock.inputargs.insert(0, v_result)                                
         reds, greens = self.sort_by_color(varsalive)
 
         v_func = op.args[0]

Modified: pypy/dist/pypy/module/pypyjit/interp_jit.py
==============================================================================
--- pypy/dist/pypy/module/pypyjit/interp_jit.py	(original)
+++ pypy/dist/pypy/module/pypyjit/interp_jit.py	Sun Jan 21 21:18:30 2007
@@ -23,7 +23,7 @@
     # dispatch_bytecode() has been manually inlined.
     # Do this with py.code.Source manipulations for now.
     src = py.code.Source(super_dispatch)
-    CALL_SITE = 'return self.dispatch_bytecode(co_code, next_instr, ec)'
+    CALL_SITE = 'w_result = self.dispatch_bytecode(co_code, next_instr, ec)'
     for i, line in enumerate(src):
         if line.strip() == CALL_SITE:
             break
@@ -36,12 +36,20 @@
     hdr = src2[0].strip()
     assert hdr == 'def dispatch_bytecode(self, co_code, next_instr, ec):'
     src2 = src2[1:].deindent().indent(indent)
+    #print src2
+
+    src3 = py.code.Source('%s\n%s\n%s\n' % (src[1:i], src2, src[i+1:]))
 
-    src3 = py.code.Source('%s\n%s\n%s\n' % (src[:i], src2, src[i+1:]))
+    src3 = src3.putaround(
+                  "def maker(BYTECODE_TRACE_ENABLED):\n" # no comma here
+                  "  def dispatch_jit(self, co_code, next_instr, ec):\n",
+                  "#\n" # for indentation :-(
+                  "  return dispatch_jit")
+  
     #print src3
     d = {}
     exec src3.compile() in super_dispatch.func_globals, d
-    PyFrame.dispatch_jit = func_with_new_name(d['dispatch'], 'dispatch_jit')
+    PyFrame.dispatch_jit = d['maker'](BYTECODE_TRACE_ENABLED=False)
 
     class __extend__(PyFrame):
 



More information about the Pypy-commit mailing list