[pypy-svn] r68893 - in pypy/branch/logging2/pypy: jit/backend/test rlib translator/cli

arigo at codespeak.net arigo at codespeak.net
Sun Nov 1 17:12:32 CET 2009


Author: arigo
Date: Sun Nov  1 17:12:32 2009
New Revision: 68893

Modified:
   pypy/branch/logging2/pypy/jit/backend/test/support.py
   pypy/branch/logging2/pypy/rlib/debug.py
   pypy/branch/logging2/pypy/translator/cli/metavm.py
   pypy/branch/logging2/pypy/translator/cli/opcodes.py
Log:
Tweaks to appear to make the CLI JIT tests pass.


Modified: pypy/branch/logging2/pypy/jit/backend/test/support.py
==============================================================================
--- pypy/branch/logging2/pypy/jit/backend/test/support.py	(original)
+++ pypy/branch/logging2/pypy/jit/backend/test/support.py	Sun Nov  1 17:12:32 2009
@@ -1,6 +1,6 @@
 import py
 import sys
-from pypy.jit.metainterp.history import log
+from pypy.rlib.debug import debug_print
 from pypy.translator.translator import TranslationContext
 
 class BaseCompiledMixin(object):
@@ -119,10 +119,10 @@
         cbuilder = CBuilder(t, entry_point, config=t.config)
         cbuilder.generate_source()
         exe_name = cbuilder.compile()
-        log('---------- Test starting ----------')
+        debug_print('---------- Test starting ----------')
         stdout = cbuilder.cmdexec(" ".join([str(arg) for arg in args]))
         res = int(stdout)
-        log('---------- Test done (%d) ----------' % (res,))
+        debug_print('---------- Test done (%d) ----------' % (res,))
         return res
 
 class CliCompiledMixin(BaseCompiledMixin):

Modified: pypy/branch/logging2/pypy/rlib/debug.py
==============================================================================
--- pypy/branch/logging2/pypy/rlib/debug.py	(original)
+++ pypy/branch/logging2/pypy/rlib/debug.py	Sun Nov  1 17:12:32 2009
@@ -45,11 +45,13 @@
 
 _log = None       # patched from tests to be an object of class DebugLog
                   # or compatible
+_stderr = sys.stderr   # alternatively, this is patched from tests
+                       # (redirects debug_print(), but not debug_start/stop)
 
 def debug_print(*args):
     for arg in args:
-        print >> sys.stderr, arg,
-    print >> sys.stderr
+        print >> _stderr, arg,
+    print >> _stderr
     if _log is not None:
         _log.debug_print(*args)
 

Modified: pypy/branch/logging2/pypy/translator/cli/metavm.py
==============================================================================
--- pypy/branch/logging2/pypy/translator/cli/metavm.py	(original)
+++ pypy/branch/logging2/pypy/translator/cli/metavm.py	Sun Nov  1 17:12:32 2009
@@ -270,6 +270,10 @@
 
         generator.ilasm.call('void [pypylib]pypy.runtime.Utils::debug_print(%s)' % signature)
 
+class _HaveDebugPrints(MicroInstruction):
+    def render(self, generator, op):
+        generator.ilasm.load_const(ootype.Bool, True)
+
 
 OOTYPE_TO_MNEMONIC = {
     ootype.Bool: 'i1', 
@@ -306,3 +310,4 @@
 SetStaticField = _SetStaticField()
 CastPrimitive = _CastPrimitive()
 DebugPrint = _DebugPrint()
+HaveDebugPrints = _HaveDebugPrints()

Modified: pypy/branch/logging2/pypy/translator/cli/opcodes.py
==============================================================================
--- pypy/branch/logging2/pypy/translator/cli/opcodes.py	(original)
+++ pypy/branch/logging2/pypy/translator/cli/opcodes.py	Sun Nov  1 17:12:32 2009
@@ -1,7 +1,8 @@
 from pypy.translator.cli.metavm import  Call, CallMethod, \
      IndirectCall, GetField, SetField, DownCast, NewCustomDict,\
      MapException, Box, Unbox, NewArray, GetArrayElem, SetArrayElem,\
-     TypeOf, CastPrimitive, EventHandler, GetStaticField, SetStaticField, DebugPrint
+     TypeOf, CastPrimitive, EventHandler, GetStaticField, SetStaticField, \
+     DebugPrint, HaveDebugPrints
 from pypy.translator.oosupport.metavm import PushArg, PushAllArgs, StoreResult, InstructionList,\
     New, RuntimeNew, CastTo, PushPrimitive, OOString, OOUnicode, OONewArray
 from pypy.translator.cli.cts import WEAKREF
@@ -77,6 +78,9 @@
     'resume_point':             Ignore,
     'debug_assert':             Ignore,
     'debug_print':              [DebugPrint],
+    'debug_start':              Ignore,
+    'debug_stop':               Ignore,
+    'have_debug_prints':        [HaveDebugPrints],
     'debug_fatalerror':         [PushAllArgs, 'call void [pypylib]pypy.runtime.Utils::debug_fatalerror(string)'],
     'keepalive':                Ignore,
     'jit_marker':               Ignore,



More information about the Pypy-commit mailing list