summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsamuel <samuel@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-11-20 09:59:14 +0000
committersamuel <samuel@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-11-20 09:59:14 +0000
commit990ddcfccf7b234960bf953ca8cf453d4b397d11 (patch)
tree1971132d08c8ab05357f7027aa2aa01819fceacc
parent07a324a0f6464f31765ee4bc5cfc23a99d426705 (diff)
Better support for amd64 platforms
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65835 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-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 03d3cf4..1f2d7d7 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 1d736f8..d7680fa 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