[pypy-svn] r35325 - in pypy/branch/jit-real-world/pypy/jit: codegen codegen/i386 timeshifter
arigo at codespeak.net
arigo at codespeak.net
Tue Dec 5 19:23:06 CET 2006
Author: arigo
Date: Tue Dec 5 19:23:03 2006
New Revision: 35325
Modified:
pypy/branch/jit-real-world/pypy/jit/codegen/i386/codebuf.py
pypy/branch/jit-real-world/pypy/jit/codegen/i386/rgenop.py
pypy/branch/jit-real-world/pypy/jit/codegen/model.py
pypy/branch/jit-real-world/pypy/jit/timeshifter/rtimeshift.py
Log:
(pedronis, arigo)
Log the start_new_blocks of global merge points, for debugging.
Modified: pypy/branch/jit-real-world/pypy/jit/codegen/i386/codebuf.py
==============================================================================
--- pypy/branch/jit-real-world/pypy/jit/codegen/i386/codebuf.py (original)
+++ pypy/branch/jit-real-world/pypy/jit/codegen/i386/codebuf.py Tue Dec 5 19:23:03 2006
@@ -49,30 +49,41 @@
def done(self):
# normally, no special action is needed here
if machine_code_dumper.enabled:
- machine_code_dumper.dump(self)
+ machine_code_dumper.dump_range(self, self._last_dump_start,
+ self._pos)
+ self._last_dump_start = self._pos
+
+ def log(self, msg):
+ if machine_code_dumper.enabled:
+ machine_code_dumper.dump(self, 'LOG', self._pos, msg)
class MachineCodeDumper:
enabled = True
log_fd = -1
- def dump(self, cb):
+ def open(self):
if self.log_fd < 0:
# check the environment for a file name
from pypy.rlib.ros import getenv
s = getenv('PYPYJITLOG')
if not s:
self.enabled = False
- return
+ return False
try:
flags = os.O_WRONLY|os.O_CREAT|os.O_TRUNC
self.log_fd = os.open(s, flags, 0666)
except OSError:
os.write(2, "could not create log file\n")
self.enabled = False
- return
- self.dump_range(cb, cb._last_dump_start, cb._pos)
- cb._last_dump_start = cb._pos
+ return False
+ return True
+
+ def dump(self, cb, tag, pos, msg):
+ if not self.open():
+ return
+ line = '%s @%x +%d %s\n' % (tag, cb.tell() - cb._pos, pos, msg)
+ os.write(self.log_fd, line)
def dump_range(self, cb, start, end):
HEX = '0123456789ABCDEF'
@@ -83,9 +94,7 @@
dump.append(HEX[o & 15])
if (p & 3) == 3:
dump.append(':')
- line = 'CODE_DUMP @%x +%d %s\n' % (cb.tell() - cb._pos,
- start, ''.join(dump))
- os.write(self.log_fd, line)
+ self.dump(cb, 'CODE_DUMP', start, ''.join(dump))
machine_code_dumper = MachineCodeDumper()
Modified: pypy/branch/jit-real-world/pypy/jit/codegen/i386/rgenop.py
==============================================================================
--- pypy/branch/jit-real-world/pypy/jit/codegen/i386/rgenop.py (original)
+++ pypy/branch/jit-real-world/pypy/jit/codegen/i386/rgenop.py Tue Dec 5 19:23:03 2006
@@ -422,6 +422,9 @@
def show_incremental_progress(self):
pass
+ def log(self, msg):
+ self.mc.log(msg)
+
# ____________________________________________________________
def stack_access(self, stackpos):
Modified: pypy/branch/jit-real-world/pypy/jit/codegen/model.py
==============================================================================
--- pypy/branch/jit-real-world/pypy/jit/codegen/model.py (original)
+++ pypy/branch/jit-real-world/pypy/jit/codegen/model.py Tue Dec 5 19:23:03 2006
@@ -138,6 +138,11 @@
So far, the machine code backends don\'t actually do anything for this.
'''
+ def log(self, msg):
+ '''Optional method: prints or logs the position of the generated code
+ along with the given msg.
+ '''
+
class GenLabel(object):
'''A "smart" label. Represents an address of the start of a basic
block and the location of the inputargs on entry to that block.'''
Modified: pypy/branch/jit-real-world/pypy/jit/timeshifter/rtimeshift.py
==============================================================================
--- pypy/branch/jit-real-world/pypy/jit/timeshifter/rtimeshift.py (original)
+++ pypy/branch/jit-real-world/pypy/jit/timeshifter/rtimeshift.py Tue Dec 5 19:23:03 2006
@@ -221,12 +221,13 @@
assert res, "exactmatch() failed"
cleanup_partial_data(memo.partialdatamatch)
newblock = enter_next_block(jitstate, outgoingvarboxes)
- if index == -1:
+ if index < 0:
states_dic[key].append((frozen, newblock))
else:
states_dic[key][index] = (frozen, newblock)
if global_resumer is not None and global_resumer is not return_marker:
+ jitstate.curbuilder.log('start_new_block %s' % (key,))
greens_gv = jitstate.greens
rgenop = jitstate.curbuilder.rgenop
node = PromotionPathRoot(greens_gv, rgenop,
More information about the Pypy-commit
mailing list