Skip to content

Commit

Permalink
Merge branch 'copy_on_write' into caller_for_all_threads
Browse files Browse the repository at this point in the history
  • Loading branch information
FooBarWidget committed Dec 30, 2011
2 parents 2e95d94 + 00b2e69 commit 57c90f2
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 2 deletions.
37 changes: 36 additions & 1 deletion configure.in
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@ if test $frame_address = yes; then
fi fi
AC_ARG_ENABLE(mbari-api, AC_ARG_ENABLE(mbari-api,
[ --enable-mbari-api enable API changes from the MBARI patches. ], [ --enable-mbari-api enable API changes from the MBARI patches. ],
[mbari_api=$enableval]) [mbari_api=$enableval],
[mbari_api=yes])
if test "$mbari_api" = yes; then if test "$mbari_api" = yes; then
AC_DEFINE(MBARI_API) AC_DEFINE(MBARI_API)
fi fi
Expand Down Expand Up @@ -620,6 +621,40 @@ powerpc-darwin*)
;; ;;
*) *)
AC_FUNC_ALLOCA AC_FUNC_ALLOCA
if test $ac_cv_func_alloca_works = yes; then
# On Apple uses llvm-gcc since Xcode 4. llvm-gcc has this nice bug
# where __builtin_alloca(0) would return non-NULL with -O0, but NULL
# with -O2...
AC_CACHE_CHECK(whether alloca(0) returns the stack pointer, rb_cv_alloca_0_returns_stack_pointer,
[AC_TRY_RUN([
#ifdef HAVE_ALLOCA_H_
# include <alloca.h>
#endif
#include <stdlib.h>
int
main()
{
/* It's important that we assign the result of alloca to a variable!
* If we put it in the if-statement then the compiler's -O2 optimizations
* will optimize it away to "if (true)", thereby bypassing our
* llvm-gcc bug detection! Let's put 'volatile' in there too,
* just in case.
*/
volatile void *addr = alloca(0);
if (addr != NULL) {
return 0;
} else {
return 1;
}
}
],
rb_cv_alloca_0_returns_stack_pointer=yes,
rb_cv_alloca_0_returns_stack_pointer=no,
rb_cv_alloca_0_returns_stack_pointer=no)])
if test $rb_cv_alloca_0_returns_stack_pointer = yes; then
AC_DEFINE(ALLOCA_0_RETURNS_STACK_POINTER, 1)
fi
fi
;; ;;
esac esac
AC_FUNC_MEMCMP AC_FUNC_MEMCMP
Expand Down
6 changes: 5 additions & 1 deletion rubysig.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -234,7 +234,11 @@ __defspfn("mov %0, sp": "=r"(sp))
# warning No assembly version of __sp() defined for this CPU. # warning No assembly version of __sp() defined for this CPU.
# endif # endif
# else # else
# define __sp() ((VALUE *)__builtin_alloca(0)) # if ALLOCA_0_RETURNS_STACK_POINTER
# define __sp() ((VALUE *)__builtin_alloca(0))
# else
# define __sp() ((VALUE *)__builtin_alloca(sizeof(void *)))
# endif /* ALLOCA_0_RETURNS_STACK_POINTER */
# endif # endif


#else // not GNUC #else // not GNUC
Expand Down

0 comments on commit 57c90f2

Please sign in to comment.