Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
Final fix for X86
Browse files Browse the repository at this point in the history
  • Loading branch information
redstar committed Jun 2, 2013
1 parent d62580e commit 04415d1
Showing 1 changed file with 52 additions and 6 deletions.
58 changes: 52 additions & 6 deletions src/core/thread.di
Expand Up @@ -768,6 +768,50 @@ private:
// Fiber Platform Detection and Memory Allocation
///////////////////////////////////////////////////////////////////////////////

private
{
// These must be kept in sync with core/thread.d
version( D_InlineAsm_X86 )
{
version( Windows )
version = NoUcontext;
else version( Posix )
version = NoUcontext;
}
else version( D_InlineAsm_X86_64 )
{
version( Windows )
version = NoUcontext;
else version( Posix )
version = NoUcontext;
}
else version( PPC )
{
version( Posix )
version = NoUcontext;
}
else version( PPC64 )
{
version( Posix )
{
// uses ucontext_t.
}
}
else version( MIPS_O32 )
{
version( Posix )
version = NoUcontext;
}

version( Posix )
{
version( NoUcontext ) {} else
{
import core.sys.posix.ucontext;
}
}
}

private extern __gshared const size_t PAGESIZE;

shared static this();
Expand All @@ -777,7 +821,6 @@ shared static this();
// Fiber
///////////////////////////////////////////////////////////////////////////////


/**
* This class provides a cooperative concurrency mechanism integrated with the
* threading and garbage collection functionality. Calling a fiber may be
Expand Down Expand Up @@ -999,16 +1042,17 @@ class Fiber
}

private:

// These must be kept in sync with core/thread.d
version (D_LP64)
{
version (Windows) enum FiberSize = 88;
else version (OSX) enum FiberSize = 88;
else version (Posix)
{
import core.sys.posix.ucontext;
enum FiberSize = 88 + ucontext_t.sizeof + 8;
static if( __traits( compiles, ucontext_t ) )
enum FiberSize = 88 + ucontext_t.sizeof + 8;
else
enum FiberSize = 88;
}
else static assert(0, "Platform not supported.");
}
Expand All @@ -1020,8 +1064,10 @@ private:
else version (OSX) enum FiberSize = 44;
else version (Posix)
{
import core.sys.posix.ucontext;
enum FiberSize = 44 + ucontext_t.sizeof + 4;
static if( __traits( compiles, ucontext_t ) )
enum FiberSize = 44 + ucontext_t.sizeof + 4;
else
enum FiberSize = 44;
}
else static assert(0, "Platform not supported.");
}
Expand Down

0 comments on commit 04415d1

Please sign in to comment.