[pypy-commit] pypy stmgc-c7-rewindjmp: import stmgc/3bfb99304c6d

arigo noreply at buildbot.pypy.org
Mon Aug 18 10:42:18 CEST 2014


Author: Armin Rigo <arigo at tunes.org>
Branch: stmgc-c7-rewindjmp
Changeset: r72867:a674757895ed
Date: 2014-08-18 10:11 +0200
http://bitbucket.org/pypy/pypy/changeset/a674757895ed/

Log:	import stmgc/3bfb99304c6d

diff --git a/rpython/translator/stm/src_stm/revision b/rpython/translator/stm/src_stm/revision
--- a/rpython/translator/stm/src_stm/revision
+++ b/rpython/translator/stm/src_stm/revision
@@ -1,1 +1,1 @@
-29376f500349
+e85ce411f190
diff --git a/rpython/translator/stm/src_stm/stm/rewind_setjmp.c b/rpython/translator/stm/src_stm/stm/rewind_setjmp.c
--- a/rpython/translator/stm/src_stm/stm/rewind_setjmp.c
+++ b/rpython/translator/stm/src_stm/stm/rewind_setjmp.c
@@ -38,8 +38,17 @@
     size_t stack_size, ssstack_size;
 
     assert(rjthread->head != NULL);
-    stop = rjthread->head->frame_base;
     ssstop = rjthread->head->shadowstack_base;
+    if (((long)ssstop) & 1) {
+        /* PyPy's JIT: 'head->frame_base' is missing; use directly 'head',
+           which should be at the end of the frame (and doesn't need itself
+           to be copied because it contains immutable data only) */
+        ssstop = ((char *)ssstop) - 1;
+        stop = (char *)rjthread->head;
+    }
+    else {
+        stop = rjthread->head->frame_base;
+    }
     assert(stop >= base);
     assert(ssstop <= ssbase);
     stack_size = stop - base;
diff --git a/rpython/translator/stm/src_stm/stm/rewind_setjmp.h b/rpython/translator/stm/src_stm/stm/rewind_setjmp.h
--- a/rpython/translator/stm/src_stm/stm/rewind_setjmp.h
+++ b/rpython/translator/stm/src_stm/stm/rewind_setjmp.h
@@ -54,9 +54,12 @@
 ************************************************************/
 
 typedef struct _rewind_jmp_buf {
-    char *frame_base;
     char *shadowstack_base;
     struct _rewind_jmp_buf *prev;
+    char *frame_base;
+    /* NB: PyPy's JIT has got details of this structure hard-coded,
+       as follows: it uses 2 words only (so frame_base is invalid)
+       and sets the lowest bit of 'shadowstack_base' to tell this */
 } rewind_jmp_buf;
 
 typedef struct {
@@ -72,6 +75,7 @@
 
 /* remember the current stack and ss_stack positions */
 #define rewind_jmp_enterframe(rjthread, rjbuf, ss)   do {  \
+    assert((((long)(ss)) & 1) == 0);                       \
     (rjbuf)->frame_base = __builtin_frame_address(0);      \
     (rjbuf)->shadowstack_base = (char *)(ss);              \
     (rjbuf)->prev = (rjthread)->head;                      \


More information about the pypy-commit mailing list