diff options
author | Iain Buclaw <ibuclaw@gcc.gnu.org> | 2019-01-18 01:51:36 +0000 |
---|---|---|
committer | Iain Buclaw <ibuclaw@gcc.gnu.org> | 2019-01-18 01:51:36 +0000 |
commit | 151a199f292c8978bf3d5d2123e65af224ed45c2 (patch) | |
tree | 822f0d5536f9248f97780d35a20360a40dca7649 | |
parent | 50deb97073424cb746e08408d3f10f3b5e16be98 (diff) | |
download | gcc-151a199f292c8978bf3d5d2123e65af224ed45c2.zip gcc-151a199f292c8978bf3d5d2123e65af224ed45c2.tar.gz gcc-151a199f292c8978bf3d5d2123e65af224ed45c2.tar.bz2 |
libphobos: Add Fiber/Thread support for StackGrowsUp.
The StackGrowsDown version being turned off for hppa targets.
After other fixes in the compiler, this allows core.thread unittests to
all pass, as well as the garbage collector to work correctly.
Backported from upstream druntime 2.084.
Reviewed-on: https://github.com/dlang/druntime/pull/2410
From-SVN: r268056
-rw-r--r-- | libphobos/libdruntime/core/thread.d | 16 | ||||
-rw-r--r-- | libphobos/libdruntime/gc/impl/conservative/gc.d | 6 |
2 files changed, 12 insertions, 10 deletions
diff --git a/libphobos/libdruntime/core/thread.d b/libphobos/libdruntime/core/thread.d index 98a8142..e502072 100644 --- a/libphobos/libdruntime/core/thread.d +++ b/libphobos/libdruntime/core/thread.d @@ -3254,7 +3254,9 @@ private void* getStackBottom() nothrow @nogc pthread_getattr_np(pthread_self(), &attr); pthread_attr_getstack(&attr, &addr, &size); pthread_attr_destroy(&attr); - return addr + size; + version (StackGrowsDown) + addr += size; + return addr; } else version (FreeBSD) { @@ -3265,7 +3267,9 @@ private void* getStackBottom() nothrow @nogc pthread_attr_get_np(pthread_self(), &attr); pthread_attr_getstack(&attr, &addr, &size); pthread_attr_destroy(&attr); - return addr + size; + version (StackGrowsDown) + addr += size; + return addr; } else version (NetBSD) { @@ -3276,7 +3280,9 @@ private void* getStackBottom() nothrow @nogc pthread_attr_get_np(pthread_self(), &attr); pthread_attr_getstack(&attr, &addr, &size); pthread_attr_destroy(&attr); - return addr + size; + version (StackGrowsDown) + addr += size; + return addr; } else version (Solaris) { @@ -3293,7 +3299,9 @@ private void* getStackBottom() nothrow @nogc pthread_getattr_np(pthread_self(), &attr); pthread_attr_getstack(&attr, &addr, &size); pthread_attr_destroy(&attr); - return addr + size; + version (StackGrowsDown) + addr += size; + return addr; } else static assert(false, "Platform not supported."); diff --git a/libphobos/libdruntime/gc/impl/conservative/gc.d b/libphobos/libdruntime/gc/impl/conservative/gc.d index 1437846..b7bb9b0 100644 --- a/libphobos/libdruntime/gc/impl/conservative/gc.d +++ b/libphobos/libdruntime/gc/impl/conservative/gc.d @@ -30,12 +30,6 @@ module gc.impl.conservative.gc; //debug = INVARIANT; // enable invariants //debug = PROFILE_API; // profile API calls for config.profile > 1 -/*************** Configuration *********************/ - -version = STACKGROWSDOWN; // growing the stack means subtracting from the stack pointer - // (use for Intel X86 CPUs) - // else growing the stack means adding to the stack pointer - /***************************************************/ import gc.bits; |