Author: Armin Rigo <ar...@tunes.org> Branch: Changeset: r74432:a5e7edf73a08 Date: 2014-11-10 21:24 +0100 http://bitbucket.org/pypy/pypy/changeset/a5e7edf73a08/
Log: Test and fix: produce a user-readable jit_debug() output in the logs too, not just when tracing it the first time. It was half-pointless to record the jit_debug operation. diff --git a/rpython/jit/metainterp/logger.py b/rpython/jit/metainterp/logger.py --- a/rpython/jit/metainterp/logger.py +++ b/rpython/jit/metainterp/logger.py @@ -137,6 +137,14 @@ s = jd_sd.warmstate.get_location_str(op.getarglist()[3:]) s = s.replace(',', '.') # we use comma for argument splitting return "debug_merge_point(%d, %d, '%s')" % (op.getarg(1).getint(), op.getarg(2).getint(), s) + if op.getopnum() == rop.JIT_DEBUG: + args = op.getarglist() + s = args[0]._get_str() + s = s.replace(',', '.') # we use comma for argument splitting + s2 = '' + for box in args[1:]: + s2 += ', %d' % box.getint() + return "jit_debug('%s'%s)" % (s, s2) if ops_offset is None: offset = -1 else: 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 @@ -1178,10 +1178,7 @@ @arguments("box", "box", "box", "box", "box") def opimpl_jit_debug(self, stringbox, arg1box, arg2box, arg3box, arg4box): - from rpython.rtyper.lltypesystem import rstr - from rpython.rtyper.annlowlevel import hlstr - msg = stringbox.getref(lltype.Ptr(rstr.STR)) - debug_print('jit_debug:', hlstr(msg), + debug_print('jit_debug:', stringbox._get_str(), arg1box.getint(), arg2box.getint(), arg3box.getint(), arg4box.getint()) args = [stringbox, arg1box, arg2box, arg3box, arg4box] diff --git a/rpython/jit/metainterp/test/test_logger.py b/rpython/jit/metainterp/test/test_logger.py --- a/rpython/jit/metainterp/test/test_logger.py +++ b/rpython/jit/metainterp/test/test_logger.py @@ -137,6 +137,17 @@ assert loop.operations[0].getarg(2).getint() == 0 assert oloop.operations[0].getarg(2)._get_str() == "dupa" + def test_jit_debug(self): + inp = ''' + [] + jit_debug('foobar', -1, 5) + ''' + _, loop, oloop = self.reparse(inp) + assert loop.operations[0].getarg(0)._get_str() == "foobar" + assert loop.operations[0].getarg(1).getint() == -1 + assert oloop.operations[0].getarg(0)._get_str() == "foobar" + assert oloop.operations[0].getarg(1).getint() == -1 + def test_floats(self): inp = ''' [f0] _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit