[pypy-svn] r62944 - pypy/branch/pyjitpl5/pypy/jit/backend/x86
fijal at codespeak.net
fijal at codespeak.net
Fri Mar 13 20:23:05 CET 2009
Author: fijal
Date: Fri Mar 13 20:23:00 2009
New Revision: 62944
Modified:
pypy/branch/pyjitpl5/pypy/jit/backend/x86/assembler.py
pypy/branch/pyjitpl5/pypy/jit/backend/x86/inp
pypy/branch/pyjitpl5/pypy/jit/backend/x86/runner.py
Log:
try to put logging into one place and also make it write to file
(only if env var is set). This sorts out logging of x86 backend,
parser needs adoption though
Modified: pypy/branch/pyjitpl5/pypy/jit/backend/x86/assembler.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/backend/x86/assembler.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/backend/x86/assembler.py Fri Mar 13 20:23:00 2009
@@ -44,6 +44,7 @@
MC_SIZE = 1024*1024 # 1MB, but assumed infinite for now
generic_return_addr = 0
position = -1
+ log_fd = -1
def __init__(self, cpu, translate_support_code=False):
self.cpu = cpu
@@ -54,8 +55,7 @@
self.malloc_func_addr = 0
self._exception_data = lltype.nullptr(rffi.CArray(lltype.Signed))
self._exception_addr = 0
- self._log_fd = self._get_log()
-
+
def _get_log(self):
s = os.environ.get('PYPYJITLOG')
if not s:
@@ -71,6 +71,7 @@
def make_sure_mc_exists(self):
if self.mc is None:
+ self._log_fd = self._get_log()
# we generate the loop body in 'mc'
# 'mc2' is for guard recovery code
if we_are_translated():
@@ -131,6 +132,14 @@
",".join(reprs)))
os.write(self._log_fd, 'xxxxxxxxxx\n')
+ def log_call(self, name, valueboxes):
+ if self._log_fd == -1:
+ return
+ memo = {}
+ args_s = ','.join([repr_of_arg(memo, box) for box in valueboxes])
+ os.write(self._log_fd, "CALL\n")
+ os.write(self._log_fd, "%s %s\n" % (name, args_s))
+
def assemble(self, operations, guard_op, verbose=False):
self.verbose = verbose
# the last operation can be 'jump', 'return' or 'guard_pause';
Modified: pypy/branch/pyjitpl5/pypy/jit/backend/x86/inp
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/backend/x86/inp (original)
+++ pypy/branch/pyjitpl5/pypy/jit/backend/x86/inp Fri Mar 13 20:23:00 2009
@@ -18,9 +18,13 @@
.. bi(11,6),bi(10,134),ci(8,0),ci(8,0)
jump bi(11,6),ci(8,0),bi(10,134)
>>>>>>>>>>
+CALL
+run_this_loop bi(0,6),bi(1,0),bi(2,134)
xxxxxxxxxx
0 -1342111720 bi(0,6),bi(1,140),bi(2,1)
xxxxxxxxxx
+CALL
+run_this_loop bi(0,3),bi(1,3),bi(2,149)
xxxxxxxxxx
0 -1342111720 bi(0,2),bi(1,254),bi(2,1)
xxxxxxxxxx
Modified: pypy/branch/pyjitpl5/pypy/jit/backend/x86/runner.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/backend/x86/runner.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/backend/x86/runner.py Fri Mar 13 20:23:00 2009
@@ -141,19 +141,19 @@
try:
del self.keepalives[self.keepalives_index:]
guard_op = self._guard_list[guard_index]
- if self.debug:
- llop.debug_print(lltype.Void, '.. calling back from',
- guard_op, 'to the jit')
+ #if self.debug:
+ # llop.debug_print(lltype.Void, '.. calling back from',
+ # guard_op, 'to the jit')
gf = GuardFailed(self, frame_addr, guard_op)
self.assembler.log_failure_recovery(gf, guard_index)
self.metainterp.handle_guard_failure(gf)
self.return_value_type = gf.return_value_type
- if self.debug:
- if gf.return_addr == self.assembler.generic_return_addr:
- llop.debug_print(lltype.Void, 'continuing at generic return address')
- else:
- llop.debug_print(lltype.Void, 'continuing at',
- uhex(gf.return_addr))
+ #if self.debug:
+ #if gf.return_addr == self.assembler.generic_return_addr:
+ # llop.debug_print(lltype.Void, 'continuing at generic return address')
+ #else:
+ # llop.debug_print(lltype.Void, 'continuing at',
+ # uhex(gf.return_addr))
return gf.return_addr
except Exception, e:
if not we_are_translated():
@@ -325,20 +325,19 @@
v = self.get_box_value_as_int(box)
values_as_int[i] = v
# debug info
- if self.debug:
- values_repr = ", ".join([str(values_as_int[i]) for i in
- range(len(valueboxes))])
- llop.debug_print(lltype.Void, 'exec:', name, values_repr)
+ #if self.debug and not we_are_translated():
+ # values_repr = ", ".join([str(values_as_int[i]) for i in
+ # range(len(valueboxes))])
+ # llop.debug_print(lltype.Void, 'exec:', name, values_repr)
+ self.assembler.log_call(name, valueboxes)
self.keepalives_index = len(self.keepalives)
res = self.execute_call(startmp, func, values_as_int)
if self.return_value_type == VOID:
- if self.debug:
- llop.debug_print(lltype.Void, " => void result")
+ #self.assembler.log_void_result()
res = None
else:
- if self.debug:
- llop.debug_print(lltype.Void, " => ", res)
+ #self.assembler.log_result(res)
res = self.get_valuebox_from_int(self.return_value_type, res)
keepalive_until_here(valueboxes)
self.keepalives_index = oldindex
More information about the Pypy-commit
mailing list