aboutsummaryrefslogtreecommitdiffstats
path: root/coroutine
diff options
context:
space:
mode:
authorSamuel Williams <samuel.williams@oriontransfer.co.nz>2019-07-16 16:11:55 +1200
committerSamuel Williams <samuel.williams@oriontransfer.co.nz>2019-07-18 20:54:55 +1200
commit001f187ed6539f320421d8893d2f3c8f584cc3a5 (patch)
treece525733ca95a920083874cc50ee47084f1e687a /coroutine
parent385ea910fc28f0e46c72669a260e44d4f3f37d9e (diff)
downloadruby-001f187ed6539f320421d8893d2f3c8f584cc3a5.tar.gz
Make fiber_pool more conservative on platforms with limited address space.
We use COROUTINE_LIMITED_ADDRESS_SPACE to select platforms where address space is 32-bits or less. Fiber pool implementation enables more book keeping, and reduces upper limits, in order to minimise address space utilisation.
Diffstat (limited to 'coroutine')
-rw-r--r--coroutine/arm32/Context.h1
-rw-r--r--coroutine/copy/Context.h4
-rw-r--r--coroutine/ucontext/Context.h4
-rw-r--r--coroutine/win32/Context.h1
-rw-r--r--coroutine/x86/Context.h1
5 files changed, 11 insertions, 0 deletions
diff --git a/coroutine/arm32/Context.h b/coroutine/arm32/Context.h
index 27f97908bc..e29fe1bb63 100644
--- a/coroutine/arm32/Context.h
+++ b/coroutine/arm32/Context.h
@@ -11,6 +11,7 @@
#include <string.h>
#define COROUTINE __attribute__((noreturn)) void
+#define COROUTINE_LIMITED_ADDRESS_SPACE
enum {COROUTINE_REGISTERS = 8};
diff --git a/coroutine/copy/Context.h b/coroutine/copy/Context.h
index a62efa4e8a..0b6e3a9be0 100644
--- a/coroutine/copy/Context.h
+++ b/coroutine/copy/Context.h
@@ -16,6 +16,10 @@
#define COROUTINE __attribute__((noreturn)) void
+#if INTPTR_MAX <= INT32_MAX
+#define COROUTINE_LIMITED_ADDRESS_SPACE
+#endif
+
// This stack copying implementation which uses a private stack for each coroutine, including the main one.
#define COROUTINE_PRIVATE_STACK
diff --git a/coroutine/ucontext/Context.h b/coroutine/ucontext/Context.h
index bde9be302a..6cf16c8604 100644
--- a/coroutine/ucontext/Context.h
+++ b/coroutine/ucontext/Context.h
@@ -13,6 +13,10 @@
#define COROUTINE __attribute__((noreturn)) void
+#if INTPTR_MAX <= INT32_MAX
+#define COROUTINE_LIMITED_ADDRESS_SPACE
+#endif
+
struct coroutine_context
{
ucontext_t state;
diff --git a/coroutine/win32/Context.h b/coroutine/win32/Context.h
index fe1a8a3648..c70b65cd2f 100644
--- a/coroutine/win32/Context.h
+++ b/coroutine/win32/Context.h
@@ -11,6 +11,7 @@
#include <string.h>
#define COROUTINE __declspec(noreturn) void __fastcall
+#define COROUTINE_LIMITED_ADDRESS_SPACE
/* This doesn't include thread information block */
enum {COROUTINE_REGISTERS = 4};
diff --git a/coroutine/x86/Context.h b/coroutine/x86/Context.h
index a783dd296f..6d3a56eaa6 100644
--- a/coroutine/x86/Context.h
+++ b/coroutine/x86/Context.h
@@ -11,6 +11,7 @@
#include <string.h>
#define COROUTINE __attribute__((noreturn, fastcall)) void
+#define COROUTINE_LIMITED_ADDRESS_SPACE
enum {COROUTINE_REGISTERS = 4};