[pypy-svn] r68691 - pypy/trunk/pypy/jit/metainterp

fijal at codespeak.net fijal at codespeak.net
Wed Oct 21 18:18:06 CEST 2009


Author: fijal
Date: Wed Oct 21 18:18:05 2009
New Revision: 68691

Modified:
   pypy/trunk/pypy/jit/metainterp/optimizeopt.py
   pypy/trunk/pypy/jit/metainterp/pyjitpl.py
   pypy/trunk/pypy/jit/metainterp/resume.py
   pypy/trunk/pypy/jit/metainterp/simple_optimize.py
Log:
Move checking environment up to initializing of global data


Modified: pypy/trunk/pypy/jit/metainterp/optimizeopt.py
==============================================================================
--- pypy/trunk/pypy/jit/metainterp/optimizeopt.py	(original)
+++ pypy/trunk/pypy/jit/metainterp/optimizeopt.py	Wed Oct 21 18:18:05 2009
@@ -518,7 +518,8 @@
     def store_final_boxes_in_guard(self, op):
         descr = op.descr
         assert isinstance(descr, compile.ResumeGuardDescr)
-        modifier = resume.ResumeDataVirtualAdder(descr, self.resumedata_memo)
+        modifier = resume.ResumeDataVirtualAdder(descr, self.resumedata_memo,
+                               self.metainterp_sd.globaldata.storedebug)
         newboxes = modifier.finish(self.values)
         if len(newboxes) > self.metainterp_sd.options.failargs_limit:
             raise compile.GiveUp

Modified: pypy/trunk/pypy/jit/metainterp/pyjitpl.py
==============================================================================
--- pypy/trunk/pypy/jit/metainterp/pyjitpl.py	(original)
+++ pypy/trunk/pypy/jit/metainterp/pyjitpl.py	Wed Oct 21 18:18:05 2009
@@ -1,4 +1,4 @@
-import py
+import py, os
 from pypy.rpython.lltypesystem import llmemory
 from pypy.rpython.ootypesystem import ootype
 from pypy.rlib.objectmodel import we_are_translated, r_dict
@@ -1029,6 +1029,7 @@
             self.globaldata.initialized = True
             self.logger_noopt.create_log('.noopt')
             self.logger_ops.create_log('.ops')
+            self.globaldata.storedebug = os.environ.get('PYPYJITRESUMELOG')
 
     def _setup_class_sizes(self):
         class_sizes = {}

Modified: pypy/trunk/pypy/jit/metainterp/resume.py
==============================================================================
--- pypy/trunk/pypy/jit/metainterp/resume.py	(original)
+++ pypy/trunk/pypy/jit/metainterp/resume.py	Wed Oct 21 18:18:05 2009
@@ -179,9 +179,10 @@
 
 class ResumeDataVirtualAdder(object):
 
-    def __init__(self, storage, memo):
+    def __init__(self, storage, memo, debug_storage=None):
         self.storage = storage
         self.memo = memo
+        self.debug_storage = debug_storage
         #self.virtuals = []
         #self.vfieldboxes = []
 
@@ -257,9 +258,8 @@
         self._number_virtuals(liveboxes)
 
         storage.rd_consts = self.memo.consts
-        logname = os.environ.get('PYPYJITRESUMELOG')
-        if logname:
-            dump_storage(logname, storage, liveboxes)
+        if self.debug_storage:
+            dump_storage(self.debug_storage, storage, liveboxes)
         return liveboxes[:]
 
     def _number_virtuals(self, liveboxes):
@@ -433,8 +433,9 @@
     os.write(fd, 'Log(%d, [\n' % objectmodel.compute_unique_id(storage))
     frameinfo = storage.rd_frame_info_list
     while True:
-        os.write(fd, '\t("%s", %d, %d),\n' % (
-            frameinfo.jitcode, frameinfo.pc, frameinfo.exception_target))
+        os.write(fd, '\t("%s", %d, %d, %xd),\n' % (
+            frameinfo.jitcode, frameinfo.pc, frameinfo.exception_target,
+            objectmodel.compute_unique_id(frameinfo)))
         frameinfo = frameinfo.prev
         if frameinfo is None:
             break

Modified: pypy/trunk/pypy/jit/metainterp/simple_optimize.py
==============================================================================
--- pypy/trunk/pypy/jit/metainterp/simple_optimize.py	(original)
+++ pypy/trunk/pypy/jit/metainterp/simple_optimize.py	Wed Oct 21 18:18:05 2009
@@ -22,7 +22,8 @@
             if op.is_guard():
                 descr = op.descr
                 assert isinstance(descr, compile.ResumeGuardDescr)
-                modifier = resume.ResumeDataVirtualAdder(descr, memo)
+                modifier = resume.ResumeDataVirtualAdder(descr, memo,
+                                            metainterp_sd.globaldata.storedebug)
                 newboxes = modifier.finish(EMPTY_VALUES)
                 descr.store_final_boxes(op, newboxes)
             newoperations.append(op)



More information about the Pypy-commit mailing list