summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac18
-rw-r--r--cont.c6
2 files changed, 15 insertions, 9 deletions
diff --git a/configure.ac b/configure.ac
index 03d3cf4aea..1f2d7d7ad9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2274,12 +2274,6 @@ AS_IF([test x"$target_cpu" = xia64], [
])
])
-AS_CASE(["$target_cpu-$target_os"],
- [*-darwin*], [
- AC_LIBOBJ([coroutine/amd64/Context])
- ],
-)
-
AC_CACHE_CHECK(whether right shift preserve sign bit, rb_cv_rshift_sign,
[AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([], [(-1==(-1>>1))])],
rb_cv_rshift_sign=yes,
@@ -2331,6 +2325,18 @@ AS_IF([test "${universal_binary-no}" = yes ], [
AC_DEFINE_UNQUOTED(STACK_GROW_DIRECTION, $dir)
])
+AC_MSG_CHECKING(native fiber implementation)
+AS_CASE(["$target_cpu-$target_os"],
+ [x*64-*], [
+ AC_MSG_RESULT(amd64)
+ AC_DEFINE(FIBER_USE_COROUTINE, "coroutine/amd64/Context.h")
+ AC_LIBOBJ([coroutine/amd64/Context])
+ ],
+ [*], [
+ AC_MSG_RESULT(no)
+ ]
+)
+
AS_IF([test x"$enable_pthread" = xyes], [
for pthread_lib in thr pthread pthreads c c_r root; do
AC_CHECK_LIB($pthread_lib, pthread_create,
diff --git a/cont.c b/cont.c
index 1d736f8c27..d7680faf5d 100644
--- a/cont.c
+++ b/cont.c
@@ -29,6 +29,8 @@
/*
Enable this include to make fiber yield/resume about twice as fast.
+ rvm install ruby-head-ioquatix-native-fiber --url https://github.com/ioquatix/ruby --branch native-fiber
+
# Without libcoro
koyoko% ./build/bin/ruby ./fiber_benchmark.rb 10000 1000
setup time for 10000 fibers: 0.099961
@@ -40,10 +42,8 @@
execution time for 1000 messages: 8.491746
*/
-#define FIBER_USE_COROUTINE
-
#ifdef FIBER_USE_COROUTINE
-#include "coroutine/amd64/Context.h"
+#include FIBER_USE_COROUTINE
#define FIBER_USE_NATIVE 1
#endif