Commit 4757741e authored by Sam Rushing's avatar Sam Rushing

use SHRAP_STACK_PAD to get correct 16-byte alignment (x86,osx)

parent c0f4ba01
...@@ -195,6 +195,7 @@ cdef extern int __swap (void * ts, void * fs) ...@@ -195,6 +195,7 @@ cdef extern int __swap (void * ts, void * fs)
cdef extern object void_as_object (void * p) cdef extern object void_as_object (void * p)
cdef extern int frame_getlineno (object frame) cdef extern int frame_getlineno (object frame)
cdef extern int coro_breakpoint() cdef extern int coro_breakpoint()
cdef extern int SHRAP_STACK_PAD
# forward # forward
cdef public class sched [ object sched_object, type sched_type ] cdef public class sched [ object sched_object, type sched_type ]
...@@ -320,13 +321,13 @@ cdef public class coro [ object _coro_object, type _coro_type ]: ...@@ -320,13 +321,13 @@ cdef public class coro [ object _coro_object, type _coro_type ]:
# a requirement on the amd64. [Normally the compiler would take # a requirement on the amd64. [Normally the compiler would take
# care of this for us...] # care of this for us...]
# #
stack_top = <void**> (the_scheduler.stack_base + the_scheduler.stack_size) stack_top = <void**> (the_scheduler.stack_base + (the_scheduler.stack_size - SHRAP_STACK_PAD))
# bogus return address # bogus return address
stack_top[-3] = <void*>NULL stack_top[-2] = <void*>NULL
# simulate "_wrap0 (<co>)" # simulate "_wrap0 (<co>)"
stack_top[-2] = <void*>self stack_top[-1] = <void*>self
self.state.stack_pointer = <void*> stack_top - (4 * sizeof(void*)) self.state.stack_pointer = &(stack_top[-3])
self.state.frame_pointer = <void*> stack_top - (3 * sizeof(void*)) self.state.frame_pointer = &(stack_top[-2])
self.state.insn_pointer = <void*> _wrap0 self.state.insn_pointer = <void*> _wrap0
cdef __destroy (self): cdef __destroy (self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment