Author: Richard Plangger <[email protected]>
Branch:
Changeset: r85965:a5b71ba0fa6e
Date: 2016-08-01 19:09 +0200
http://bitbucket.org/pypy/pypy/changeset/a5b71ba0fa6e/
Log: merged branch jitlog-exact-source-lines
diff --git a/pypy/module/pypyjit/interp_jit.py
b/pypy/module/pypyjit/interp_jit.py
--- a/pypy/module/pypyjit/interp_jit.py
+++ b/pypy/module/pypyjit/interp_jit.py
@@ -46,6 +46,7 @@
jl.MP_SCOPE, jl.MP_INDEX, jl.MP_OPCODE)
def get_location(next_instr, is_being_profiled, bytecode):
from pypy.tool.stdlib_opcode import opcode_method_names
+ from pypy.tool.error import offset2lineno
bcindex = ord(bytecode.co_code[next_instr])
opname = ""
if 0 <= bcindex < len(opcode_method_names):
@@ -53,7 +54,8 @@
name = bytecode.co_name
if not name:
name = ""
- return (bytecode.co_filename, bytecode.co_firstlineno,
+ line = offset2lineno(bytecode, next_instr)
+ return (bytecode.co_filename, line,
name, intmask(next_instr), opname)
def should_unroll_one_iteration(next_instr, is_being_profiled, bytecode):
diff --git a/rpython/tool/error.py b/rpython/tool/error.py
--- a/rpython/tool/error.py
+++ b/rpython/tool/error.py
@@ -158,6 +158,8 @@
@jit.elidable
def offset2lineno(c, stopat):
+ # even position in lnotab denote byte increments, odd line increments.
+ # see dis.findlinestarts in the python std. library for more details
tab = c.co_lnotab
line = c.co_firstlineno
addr = 0
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit