[pypy-svn] pypy default: Optimize frame creation by the JIT by making the default value
arigo
commits-noreply at bitbucket.org
Fri Apr 8 12:22:57 CEST 2011
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r43213:a7a6d25abf34
Date: 2011-04-08 12:22 +0200
http://bitbucket.org/pypy/pypy/changeset/a7a6d25abf34/
Log: Optimize frame creation by the JIT by making the default value of
these two fields be 0 instead of -1.
diff --git a/pypy/interpreter/executioncontext.py b/pypy/interpreter/executioncontext.py
--- a/pypy/interpreter/executioncontext.py
+++ b/pypy/interpreter/executioncontext.py
@@ -519,7 +519,7 @@
return
code = frame.pycode
if frame.instr_lb <= frame.last_instr < frame.instr_ub:
- if frame.last_instr <= frame.instr_prev:
+ if frame.last_instr < frame.instr_prev_plus_one:
# We jumped backwards in the same line.
executioncontext._trace(frame, 'line', self.space.w_None)
else:
@@ -557,5 +557,5 @@
frame.f_lineno = line
executioncontext._trace(frame, 'line', self.space.w_None)
- frame.instr_prev = frame.last_instr
+ frame.instr_prev_plus_one = frame.last_instr + 1
self.space.frame_trace_action.fire() # continue tracing
diff --git a/pypy/interpreter/pyframe.py b/pypy/interpreter/pyframe.py
--- a/pypy/interpreter/pyframe.py
+++ b/pypy/interpreter/pyframe.py
@@ -46,8 +46,8 @@
w_f_trace = None
# For tracing
instr_lb = 0
- instr_ub = -1
- instr_prev = -1
+ instr_ub = 0
+ instr_prev_plus_one = 0
is_being_profiled = False
def __init__(self, space, code, w_globals, closure):
@@ -335,7 +335,7 @@
w(self.instr_lb), #do we need these three (that are for tracing)
w(self.instr_ub),
- w(self.instr_prev),
+ w(self.instr_prev_plus_one),
w_cells,
]
@@ -349,7 +349,7 @@
args_w = space.unpackiterable(w_args)
w_f_back, w_builtin, w_pycode, w_valuestack, w_blockstack, w_exc_value, w_tb,\
w_globals, w_last_instr, w_finished, w_f_lineno, w_fastlocals, w_f_locals, \
- w_f_trace, w_instr_lb, w_instr_ub, w_instr_prev, w_cells = args_w
+ w_f_trace, w_instr_lb, w_instr_ub, w_instr_prev_plus_one, w_cells = args_w
new_frame = self
pycode = space.interp_w(PyCode, w_pycode)
@@ -397,7 +397,7 @@
new_frame.instr_lb = space.int_w(w_instr_lb) #the three for tracing
new_frame.instr_ub = space.int_w(w_instr_ub)
- new_frame.instr_prev = space.int_w(w_instr_prev)
+ new_frame.instr_prev_plus_one = space.int_w(w_instr_prev_plus_one)
self._setcellvars(cellvars)
# XXX what if the frame is in another thread??
More information about the Pypy-commit
mailing list