[pypy-svn] r28743 - in pypy/dist/pypy: rpython rpython/lltypesystem translator/c translator/c/src
pedronis at codespeak.net
pedronis at codespeak.net
Tue Jun 13 13:55:20 CEST 2006
Author: pedronis
Date: Tue Jun 13 13:55:18 2006
New Revision: 28743
Modified:
pypy/dist/pypy/rpython/llinterp.py
pypy/dist/pypy/rpython/lltypesystem/lloperation.py
pypy/dist/pypy/translator/c/exceptiontransform.py
pypy/dist/pypy/translator/c/funcgen.py
pypy/dist/pypy/translator/c/src/exception.h
Log:
support for tracking trough logging exception progatation in transled rpython, define DO_LOG_EXC to get enable
it (works on gcc)
Modified: pypy/dist/pypy/rpython/llinterp.py
==============================================================================
--- pypy/dist/pypy/rpython/llinterp.py (original)
+++ pypy/dist/pypy/rpython/llinterp.py Tue Jun 13 13:55:18 2006
@@ -421,6 +421,10 @@
import pdb
pdb.set_trace()
+ def op_debug_log_exc(self, exc_type):
+ # do nothing, this is useful in compiled code
+ pass
+
def op_keepalive(self, value):
pass
Modified: pypy/dist/pypy/rpython/lltypesystem/lloperation.py
==============================================================================
--- pypy/dist/pypy/rpython/lltypesystem/lloperation.py (original)
+++ pypy/dist/pypy/rpython/lltypesystem/lloperation.py Tue Jun 13 13:55:18 2006
@@ -365,6 +365,7 @@
'debug_view': LLOp(),
'debug_print': LLOp(),
'debug_pdb': LLOp(),
+ 'debug_log_exc': LLOp()
}
# __________ operations on PyObjects __________
Modified: pypy/dist/pypy/translator/c/exceptiontransform.py
==============================================================================
--- pypy/dist/pypy/translator/c/exceptiontransform.py (original)
+++ pypy/dist/pypy/translator/c/exceptiontransform.py Tue Jun 13 13:55:18 2006
@@ -4,6 +4,7 @@
from pypy.objspace.flow.model import Block, Constant, Variable, Link, \
c_last_exception, SpaceOperation, checkgraph, FunctionGraph
from pypy.rpython.lltypesystem import lltype, llmemory
+from pypy.rpython.lltypesystem import lloperation
from pypy.rpython.memory.lladdress import NULL
from pypy.rpython.memory.gctransform import varoftype
from pypy.rpython import rtyper
@@ -51,7 +52,9 @@
null_value = lltype.nullptr(self.lltype_of_exception_value.TO)
def rpyexc_occured():
- return exc_data.exc_type is not null_type
+ exc_type = exc_data.exc_type
+ lloperation.llop.debug_log_exc(lltype.Void, exc_type)
+ return exc_type is not null_type
def rpyexc_fetch_type():
return exc_data.exc_type
@@ -275,6 +278,7 @@
llops = rtyper.LowLevelOpList(None)
v_exc_type = self.ExcData_repr.getfield(self.cexcdata, 'exc_type', llops)
+ llops.genop('debug_log_exc', [v_exc_type], lltype.Void)
var_exc_occured = llops.genop('ptr_ne', [v_exc_type, self.cnulltype], lltype.Bool)
block.operations.extend(llops)
Modified: pypy/dist/pypy/translator/c/funcgen.py
==============================================================================
--- pypy/dist/pypy/translator/c/funcgen.py (original)
+++ pypy/dist/pypy/translator/c/funcgen.py Tue Jun 13 13:55:18 2006
@@ -702,5 +702,8 @@
c_string_constant(' '.join(format) + '\n'),
''.join([', ' + s for s in argv]))
+ def OP_DEBUG_LOG_EXC(self, op):
+ exc_type = self.expr(op.args[0])
+ return 'RPY_LOG_EXC(%s);' % exc_type
assert not USESLOTS or '__dict__' not in dir(FunctionCodeGenerator)
Modified: pypy/dist/pypy/translator/c/src/exception.h
==============================================================================
--- pypy/dist/pypy/translator/c/src/exception.h (original)
+++ pypy/dist/pypy/translator/c/src/exception.h Tue Jun 13 13:55:18 2006
@@ -6,10 +6,22 @@
PyObject *RPythonError;
#endif
+#define RPY_LOG_EXC(exc_type)
+
+
/******************************************************************/
#ifdef HAVE_RTYPER /* RPython version of exceptions */
/******************************************************************/
+#ifdef DO_LOG_EXC
+#undef RPY_LOG_EXC
+#define RPY_LOG_EXC(exc_type) if(exc_type) { \
+ fprintf(stderr, "propagating %s:%ld %s %s\n", \
+ __FILE__, __LINE__, __FUNCTION__, \
+ exc_type->ov_name->items); \
+}
+#endif
+
/* Hint: functions and macros not defined here, like RPyRaiseException,
come from exctransformer via the table in extfunc.py. */
More information about the Pypy-commit
mailing list