Author: David Schneider <david.schnei...@picle.org> Branch: Changeset: r64437:fc98eb924881 Date: 2013-05-22 05:04 -0500 http://bitbucket.org/pypy/pypy/changeset/fc98eb924881/
Log: merge arm-stacklet diff --git a/pypy/config/pypyoption.py b/pypy/config/pypyoption.py --- a/pypy/config/pypyoption.py +++ b/pypy/config/pypyoption.py @@ -364,8 +364,6 @@ # may not be present in config.objspace.usemodules at all modules = [name for name in modules if name not in essential_modules] - if config.translation.platform == 'arm' and '_continuation' in modules: - modules.remove('_continuation') config.objspace.usemodules.suggest(**dict.fromkeys(modules, True)) def enable_translationmodules(config): diff --git a/rpython/translator/c/src/stacklet/slp_platformselect.h b/rpython/translator/c/src/stacklet/slp_platformselect.h --- a/rpython/translator/c/src/stacklet/slp_platformselect.h +++ b/rpython/translator/c/src/stacklet/slp_platformselect.h @@ -8,6 +8,8 @@ #include "switch_x86_64_gcc.h" /* gcc on amd64 */ #elif defined(__GNUC__) && defined(__i386__) #include "switch_x86_gcc.h" /* gcc on X86 */ +#elif defined(__GNUC__) && defined(__arm__) +#include "switch_arm_gcc.h" /* gcc on arm */ #else #error "Unsupported platform!" #endif diff --git a/rpython/translator/c/src/stacklet/switch_arm_gcc.h b/rpython/translator/c/src/stacklet/switch_arm_gcc.h new file mode 100644 --- /dev/null +++ b/rpython/translator/c/src/stacklet/switch_arm_gcc.h @@ -0,0 +1,40 @@ + +static void __attribute__((optimize("O3"))) *slp_switch(void *(*save_state)(void*, void*), + void *(*restore_state)(void*, void*), + void *extra) +{ + void *result; + __asm__ volatile ( + "mov r3, %[save_state]\n" + /* save values in calee saved registers for later */ + "mov r4, %[restore_state]\n" + "mov r5, %[extra]\n" + "mov r0, sp\n" /* arg 1: current (old) stack pointer */ + "mov r1, r5\n" /* arg 2: extra */ + "blx r3\n" /* call save_state() */ + + /* skip the rest if the return value is null */ + "cmp r0, #0\n" + "beq zero\n" + + "mov sp, r0\n" /* change the stack pointer */ + + /* From now on, the stack pointer is modified, but the content of the + stack is not restored yet. It contains only garbage here. */ + "mov r1, r5\n" /* arg 2: extra */ + /* arg 1: current (new) stack pointer is already in r0*/ + "blx r4\n" /* call restore_state() */ + + /* The stack's content is now restored. */ + "zero:\n" + "mov %[result], r0\n" + + : [result]"=r"(result) /* output variables */ + /* input variables */ + : [restore_state]"r"(restore_state), + [save_state]"r"(save_state), + [extra]"r"(extra) + : "lr", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r13" + ); + return result; +} _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit