use assmebly code instead alloca to change stack pointer for Mac OS
authorGengbin Zheng <gzheng@illinois.edu>
Thu, 30 Aug 2012 21:36:14 +0000 (16:36 -0500)
committerGengbin Zheng <gzheng@illinois.edu>
Thu, 30 Aug 2012 21:36:14 +0000 (16:36 -0500)
src/util/uJcontext.c

index 29eed1653844771216c9047055564b9c7ac5f5bd..e166c56f918bb3b05390cc970861bbad661a7d5f 100644 (file)
@@ -116,12 +116,15 @@ int setJcontext (const uJcontext_t *u)
                        __asm { mov esp, new_sp };
 #elif defined(__CYGWIN__)
                        asm ( "mov %0, %%esp\n"::"m"(new_sp));
+#elif defined(__APPLE__) && CMK_64BIT
+                       asm ( "mov %0, %%rsp\n"::"m"(new_sp));
 #elif 0 /* Blue Gene/Light gcc PPC assembly version: */
                        asm __volatile__ ("mr 1,%0" :: "r"(new_sp));
 #else /* Portable alloca version */
                        char *old_sp=(char *)&old_sp; /* address of any local variable */
                        register CmiInt8 allocLen=old_sp-new_sp;
                   
+                       VERBOSE( printf("calling alloca with %lld", allocLen); printStack(); )
                        _dummyAllocaSetJcontext = alloca(allocLen);  /* defeat the compiler optimization! */
 #endif
                }