Author: Richard Plangger <planri...@gmail.com> Branch: new-jit-log Changeset: r83118:df3f2f49084a Date: 2016-03-18 08:18 +0100 http://bitbucket.org/pypy/pypy/changeset/df3f2f49084a/
Log: added jitlog to the existing call sites of the old logger diff --git a/rpython/jit/backend/x86/assembler.py b/rpython/jit/backend/x86/assembler.py --- a/rpython/jit/backend/x86/assembler.py +++ b/rpython/jit/backend/x86/assembler.py @@ -532,7 +532,7 @@ looptoken._x86_ops_offset = ops_offset looptoken._ll_function_addr = rawstart if logger: - logger.log_trace(logger.MARK_ASM, inputargs, operations, + logger.log_trace(logger.MARK_TRACE_ASM, inputargs, operations, ops_offset=ops_offset, self.mc) self.fixup_target_tokens(rawstart) diff --git a/rpython/jit/metainterp/compile.py b/rpython/jit/metainterp/compile.py --- a/rpython/jit/metainterp/compile.py +++ b/rpython/jit/metainterp/compile.py @@ -480,22 +480,28 @@ def do_compile_loop(jd_id, unique_id, metainterp_sd, inputargs, operations, looptoken, log=True, name='', memo=None): + mark = VMProfJitLogger.MARK_TRACE_OPT + metainterp_sd.jitlog.log_trace(mark, inputargs, operations) + # TODO remove old metainterp_sd.logger_ops.log_loop(inputargs, operations, -2, 'compiling', None, name, memo) return metainterp_sd.cpu.compile_loop(inputargs, operations, looptoken, jd_id=jd_id, unique_id=unique_id, log=log, name=name, - logger=metainterp_sd.logger_ops) + logger=metainterp_sd.jitlog) def do_compile_bridge(metainterp_sd, faildescr, inputargs, operations, original_loop_token, log=True, memo=None): + mark = VMProfJitLogger.MARK_TRACE_OPT + metainterp_sd.jitlog.log_trace(mark, inputargs, operations, faildescr=faildescr) + # TODO remove old metainterp_sd.logger_ops.log_bridge(inputargs, operations, "compiling", memo=memo) assert isinstance(faildescr, AbstractFailDescr) return metainterp_sd.cpu.compile_bridge(faildescr, inputargs, operations, original_loop_token, log=log, - logger=metainterp_sd.logger_ops) + logger=metainterp_sd.jitlog) def forget_optimization_info(lst, reset_values=False): for item in lst: diff --git a/rpython/jit/metainterp/jitlog.py b/rpython/jit/metainterp/jitlog.py --- a/rpython/jit/metainterp/jitlog.py +++ b/rpython/jit/metainterp/jitlog.py @@ -19,18 +19,24 @@ class VMProfJitLogger(JitLogMarshall): - MARK_TRACED = 0x10 - MARK_INPUT_ARGS = 0x12 + MARK_INPUT_ARGS = 0x10 + MARK_RESOP_META = 0x11 + MARK_RESOP = 0x12 + MARK_RESOP_DESCR = 0x13 + MARK_ASM_ADDR = 0x14 + MARK_ASM = 0x15 - MARK_RESOP_META = 0x13 - MARK_RESOP = 0x14 - MARK_RESOP_DESCR = 0x15 - MARK_ASM_ADDR = 0x16 - MARK_ASM = 0x17 + # which type of trace is logged after this + # the trace as it is recorded by the tracer + MARK_TRACE = 0x16 + # the trace that has passed the optimizer + MARK_TRACE_OPT = 0x17 + # the trace assembled to machine code (after rewritten) + MARK_TRACE_ASM = 0x18 - # the ones as parameter to log_trace - MARK_TRACE_ASM = 0x18 + # the machine code was patched (e.g. guard) + MARK_ASM_PATCH = 0x19 def __init__(self): self.cintf = cintf.setup() @@ -70,8 +76,11 @@ # assembler address (to not duplicate it in write_code_dump) if mc is not None: - lendian_addr = struct.pack('<l', mc.absolute_addr()) - self.write_marked(self.MARK_ASM_ADDR, lendian_addr) + absaddr = mc.absolute_addr() + rel = mc.get_relative_pos() + # packs <start addr> <end addr> as two unsigend longs + lendian_addrs = struct.pack('<LL', absaddr, absaddr + rel) + self.write_marked(self.MARK_ASM_ADDR, lendian_addrs) for i,op in enumerate(ops): mark, line = self.encode(op) diff --git a/rpython/jit/metainterp/optimizeopt/__init__.py b/rpython/jit/metainterp/optimizeopt/__init__.py --- a/rpython/jit/metainterp/optimizeopt/__init__.py +++ b/rpython/jit/metainterp/optimizeopt/__init__.py @@ -7,6 +7,7 @@ from rpython.jit.metainterp.optimizeopt.simplify import OptSimplify from rpython.jit.metainterp.optimizeopt.pure import OptPure from rpython.jit.metainterp.optimizeopt.earlyforce import OptEarlyForce +from rpython.jit.metainterp.jitlog import VMProfJitLogger from rpython.rlib.jit import PARAMETERS, ENABLE_ALL_OPTS from rpython.rlib.unroll import unrolling_iterable from rpython.rlib.debug import debug_start, debug_stop, debug_print @@ -54,6 +55,9 @@ debug_start("jit-optimize") inputargs = compile_data.start_label.getarglist() try: + mark = VMProfJitLogger.MARK_TRACE + metainterp_sd.jitlog.log_trace(mark, inputargs, compile_data.operations) + # metainterp_sd.logger_noopt.log_loop(inputargs, compile_data.operations, memo=memo) _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit