[pypy-commit] pypy default: fixes
arigo
noreply at buildbot.pypy.org
Tue Oct 6 15:19:30 CEST 2015
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r80002:43e04ba55c9c
Date: 2015-10-06 15:19 +0200
http://bitbucket.org/pypy/pypy/changeset/43e04ba55c9c/
Log: fixes
diff --git a/rpython/translator/c/src/stacklet/Makefile b/rpython/translator/c/src/stacklet/Makefile
--- a/rpython/translator/c/src/stacklet/Makefile
+++ b/rpython/translator/c/src/stacklet/Makefile
@@ -28,19 +28,19 @@
tests-static-g: stacklet.c stacklet.h tests.c
gcc ${INC} -Wall -g -o run_tests_static_g stacklet.c tests.c ${DEBUG}
- run_tests_static_g
+ ./run_tests_static_g
tests-static-o: stacklet.c stacklet.h tests.c
gcc ${INC} -Wall -g -O2 -o run_tests_static_o stacklet.c tests.c ${DEBUG}
- run_tests_static_o
+ ./run_tests_static_o
tests-dynamic-g: stacklet_g.so tests.c
gcc ${INC} -Wall -g -o run_tests_dynamic_g stacklet_g.so tests.c ${DEBUG}
- LD_LIBRARY_PATH=. run_tests_dynamic_g
+ LD_LIBRARY_PATH=. ./run_tests_dynamic_g
tests-dynamic-o: stacklet.so tests.c
gcc ${INC} -Wall -g -O2 -o run_tests_dynamic_o stacklet.so tests.c ${DEBUG}
- LD_LIBRARY_PATH=. run_tests_dynamic_o
+ LD_LIBRARY_PATH=. ./run_tests_dynamic_o
tests-repeat: tests
python runtests.py run_tests_static_g > /dev/null
diff --git a/rpython/translator/c/src/stacklet/switch_arm_gcc.h b/rpython/translator/c/src/stacklet/switch_arm_gcc.h
--- a/rpython/translator/c/src/stacklet/switch_arm_gcc.h
+++ b/rpython/translator/c/src/stacklet/switch_arm_gcc.h
@@ -10,11 +10,24 @@
void *extra)
{
void *result;
+ /*
+ seven registers to preserve: r2, r3, r7, r8, r9, r10, r11
+ registers marked as clobbered: r0, r1, r4, r5, r6, r12, lr
+ others: r13 is sp; r14 is lr; r15 is pc
+ */
+
__asm__ volatile (
- "ldr r3, %[save_state]\n"
+
+ /* align the stack and save 7 more registers explicitly */
+ "mov r0, sp\n"
+ "and r1, r0, #-16\n"
+ "mov sp, r1\n"
+ "push {r0, r2, r3, r7, r8, r9, r10, r11}\n" /* total 8, still aligned */
+
/* save values in callee saved registers for later */
- "ldr r4, %[restore_state]\n"
- "ldr r5, %[extra]\n"
+ "mov r4, %[restore_state]\n" /* can't be r0 or r1: marked clobbered */
+ "mov r5, %[extra]\n" /* can't be r0 or r1 or r4: marked clob. */
+ "mov r3, %[save_state]\n" /* can't be r0, r1, r4, r5: marked clob. */
"mov r0, sp\n" /* arg 1: current (old) stack pointer */
"mov r1, r5\n" /* arg 2: extra */
call_reg(r3) /* call save_state() */
@@ -28,20 +41,22 @@
/* 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*/
+ /* arg 1: current (new) stack pointer is already in r0*/
call_reg(r4) /* call restore_state() */
/* The stack's content is now restored. */
"zero:\n"
- "str r0, %[result]\n"
- : [result]"=m"(result) /* output variables */
+ "pop {r1, r2, r3, r7, r8, r9, r10, r11}\n"
+ "mov sp, r1\n"
+ "mov %[result], r0\n"
+
+ : [result]"=r"(result) /* output variables */
/* input variables */
- : [restore_state]"m"(restore_state),
- [save_state]"m"(save_state),
- [extra]"m"(extra)
- : "lr", "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9",
- "r10", "r11", "r12", /* r13 is sp, r14 is lr, and r15 is pc */
+ : [restore_state]"r"(restore_state),
+ [save_state]"r"(save_state),
+ [extra]"r"(extra)
+ : "r0", "r1", "r4", "r5", "r6", "r12", "lr",
"memory", "cc", "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7"
);
return result;
More information about the pypy-commit
mailing list