Commit 60b5d300 authored by Armin Rigo's avatar Armin Rigo

From stmgc-c7: put the "# Loop" and "# bridge" header in more dumped

logs than just the "jit-log-opt" one.
parent a2bd5197
...@@ -15,10 +15,14 @@ class Logger(object): ...@@ -15,10 +15,14 @@ class Logger(object):
def log_loop(self, inputargs, operations, number=0, type=None, ops_offset=None, name=''): def log_loop(self, inputargs, operations, number=0, type=None, ops_offset=None, name=''):
if type is None: if type is None:
debug_start("jit-log-noopt-loop") debug_start("jit-log-noopt-loop")
debug_print("# Loop", number, '(%s)' % name, ":", "noopt",
"with", len(operations), "ops")
logops = self._log_operations(inputargs, operations, ops_offset) logops = self._log_operations(inputargs, operations, ops_offset)
debug_stop("jit-log-noopt-loop") debug_stop("jit-log-noopt-loop")
elif type == "rewritten": elif type == "rewritten":
debug_start("jit-log-rewritten-loop") debug_start("jit-log-rewritten-loop")
debug_print("# Loop", number, '(%s)' % name, ":", type,
"with", len(operations), "ops")
logops = self._log_operations(inputargs, operations, ops_offset) logops = self._log_operations(inputargs, operations, ops_offset)
debug_stop("jit-log-rewritten-loop") debug_stop("jit-log-rewritten-loop")
elif number == -2: elif number == -2:
...@@ -37,12 +41,18 @@ class Logger(object): ...@@ -37,12 +41,18 @@ class Logger(object):
descr=None, ops_offset=None): descr=None, ops_offset=None):
if extra == "noopt": if extra == "noopt":
debug_start("jit-log-noopt-bridge") debug_start("jit-log-noopt-bridge")
debug_print("# bridge out of Guard",
"0x%x" % compute_unique_id(descr),
"with", len(operations), "ops")
logops = self._log_operations(inputargs, operations, ops_offset) logops = self._log_operations(inputargs, operations, ops_offset)
debug_stop("jit-log-noopt-bridge") debug_stop("jit-log-noopt-bridge")
elif extra == "rewritten": elif extra == "rewritten":
debug_start("jit-log-rewritten-bridge") debug_start("jit-log-rewritten-bridge")
debug_print("# bridge out of Guard",
"0x%x" % compute_unique_id(descr),
"with", len(operations), "ops")
logops = self._log_operations(inputargs, operations, ops_offset) logops = self._log_operations(inputargs, operations, ops_offset)
debug_stop("jit-log-rewritten-bridge") debug_stop("jit-log-rewritten-bridge")
elif extra == "compiling": elif extra == "compiling":
debug_start("jit-log-compiling-bridge") debug_start("jit-log-compiling-bridge")
logops = self._log_operations(inputargs, operations, ops_offset) logops = self._log_operations(inputargs, operations, ops_offset)
......
...@@ -32,10 +32,11 @@ def capturing(func, *args, **kwds): ...@@ -32,10 +32,11 @@ def capturing(func, *args, **kwds):
return log_stream.getvalue() return log_stream.getvalue()
class Logger(logger.Logger): class Logger(logger.Logger):
def log_loop(self, loop, namespace={}, ops_offset=None): def log_loop(self, loop, namespace={}, ops_offset=None, name=''):
self.namespace = namespace self.namespace = namespace
return capturing(logger.Logger.log_loop, self, return capturing(logger.Logger.log_loop, self,
loop.inputargs, loop.operations, ops_offset=ops_offset) loop.inputargs, loop.operations, ops_offset=ops_offset,
name=name)
def _make_log_operations(self1): def _make_log_operations(self1):
class LogOperations(logger.LogOperations): class LogOperations(logger.LogOperations):
...@@ -230,8 +231,9 @@ class TestLogger(object): ...@@ -230,8 +231,9 @@ class TestLogger(object):
None: 40 None: 40
} }
logger = Logger(self.make_metainterp_sd()) logger = Logger(self.make_metainterp_sd())
output = logger.log_loop(loop, ops_offset=ops_offset) output = logger.log_loop(loop, ops_offset=ops_offset, name="foo")
assert output.strip() == """ assert output.strip() == """
# Loop 0 (foo) : noopt with 3 ops
[i0] [i0]
+10: i2 = int_add(i0, 1) +10: i2 = int_add(i0, 1)
i4 = int_mul(i2, 2) i4 = int_mul(i2, 2)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment