From 001f187ed6539f320421d8893d2f3c8f584cc3a5 Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Tue, 16 Jul 2019 16:11:55 +1200 Subject: 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. --- coroutine/arm32/Context.h | 1 + coroutine/copy/Context.h | 4 ++++ coroutine/ucontext/Context.h | 4 ++++ coroutine/win32/Context.h | 1 + coroutine/x86/Context.h | 1 + 5 files changed, 11 insertions(+) (limited to 'coroutine') 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 #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 #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 #define COROUTINE __attribute__((noreturn, fastcall)) void +#define COROUTINE_LIMITED_ADDRESS_SPACE enum {COROUTINE_REGISTERS = 4}; -- cgit v1.2.3