[pypy-svn] r23449 - in pypy/dist/pypy/translator/c: . src
ericvrp at codespeak.net
ericvrp at codespeak.net
Fri Feb 17 12:00:05 CET 2006
Author: ericvrp
Date: Fri Feb 17 12:00:04 2006
New Revision: 23449
Modified:
pypy/dist/pypy/translator/c/genc.py
pypy/dist/pypy/translator/c/src/exception.h
pypy/dist/pypy/translator/c/src/ll_stackless.h
pypy/dist/pypy/translator/c/stackless.py
Log:
Move stackess unwind test into RPythonExceptionOccured-test block for
performance improvement.
Modified: pypy/dist/pypy/translator/c/genc.py
==============================================================================
--- pypy/dist/pypy/translator/c/genc.py (original)
+++ pypy/dist/pypy/translator/c/genc.py Fri Feb 17 12:00:04 2006
@@ -82,8 +82,7 @@
defines['USE_STACKLESS'] = '1'
if self.use_stackless_transformation: #set in test_stackless.py
from pypy.translator.backendopt.stackless import stackless
- from pypy.translator.c.stackless import StacklessData
- stackless(translator, StacklessData(db))
+ stackless(translator, db.stacklessdata)
cfile, extra = gen_source_standalone(db, modulename, targetdir,
entrypointname = pfname,
defines = defines)
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 Fri Feb 17 12:00:04 2006
@@ -20,6 +20,10 @@
#define RPyExceptionOccurred() (rpython_exc_type != NULL)
+#define RPyRaisePseudoException() rpython_exc_type = (RPYTHON_EXCEPTION_VTABLE)&rpython_exc_type
+
+#define RPyExceptionClear() rpython_exc_type = NULL
+
#define RPyRaiseException(etype, evalue) do { \
assert(!RPyExceptionOccurred()); \
rpython_exc_type = etype; \
Modified: pypy/dist/pypy/translator/c/src/ll_stackless.h
==============================================================================
--- pypy/dist/pypy/translator/c/src/ll_stackless.h (original)
+++ pypy/dist/pypy/translator/c/src/ll_stackless.h Fri Feb 17 12:00:04 2006
@@ -77,6 +77,7 @@
slp_frame_stack_top = slp_frame_stack_bottom =
slp_new_frame(sizeof(slp_frame_t), 0);
+ RPyRaisePseudoException();
return ;
resume:
@@ -90,6 +91,7 @@
assert(slp_frame_stack_bottom != NULL);
slp_frame_stack_bottom->f_back = slp_new_frame(sizeof(slp_frame_t), 3);
slp_frame_stack_top = slp_frame_stack_bottom = NULL; /* stop unwinding */
+ RPyExceptionClear();
return (struct RPyOpaque_frame_stack_top *) result;
}
@@ -114,6 +116,7 @@
f = slp_new_frame(sizeof(slp_frame_1ptr_t), 2);
((slp_frame_1ptr_t *) f)->p0 = c;
slp_frame_stack_top = slp_frame_stack_bottom = f;
+ RPyRaisePseudoException();
return NULL;
resume:
@@ -138,6 +141,7 @@
slp_frame_stack_top = slp_frame_stack_bottom =
slp_new_frame(sizeof(slp_frame_t), 1);
+ RPyRaisePseudoException();
return -1;
resume:
@@ -167,6 +171,7 @@
while (1)
{
slp_frame_stack_bottom = NULL;
+ RPyExceptionClear();
pending = slp_frame_stack_top;
while (1)
Modified: pypy/dist/pypy/translator/c/stackless.py
==============================================================================
--- pypy/dist/pypy/translator/c/stackless.py (original)
+++ pypy/dist/pypy/translator/c/stackless.py Fri Feb 17 12:00:04 2006
@@ -331,12 +331,8 @@
# add the checks for the unwinding case just after the directcall
# in the source
- unwind_check = "if (slp_frame_stack_bottom)\n\tgoto %s;" % (savelabel,)
- exception_check = (super(SlpFunctionCodeGenerator, self)
- .check_directcall_result(op, err))
- return '%s\n %s:\n%s' % (unwind_check,
- resumelabel,
- exception_check)
+ return 'if (RPyExceptionOccurred()) {\n\tif (slp_frame_stack_bottom)\n\t\tgoto %s;\n\tFAIL(%s);\n}\n %s:' %\
+ (savelabel, err, resumelabel)
def OP_YIELD_CURRENT_FRAME_TO_CALLER(self, op, err):
# special handling of this operation: call stack_unwind() to force the
More information about the Pypy-commit
mailing list