/* ---------------------------------------------------------------------------- * * (c) The GHC Team, 1998-2009 * * Constants * * NOTE: this information is used by both the compiler and the RTS. * Some of it is tweakable, and some of it must be kept up to date * with various other parts of the system. * * Constants which are derived automatically from other definitions in * the system (eg. structure sizes) are generated into the file * DerivedConstants.h by a C program (mkDerivedConstantsHdr). * * To understand the structure of the RTS headers, see the wiki: * https://gitlab.haskell.org/ghc/ghc/wikis/commentary/source-tree/includes * * -------------------------------------------------------------------------- */ #pragma once /* ----------------------------------------------------------------------------- Minimum closure sizes This is the minimum number of words in the payload of a heap-allocated closure, so that the closure has enough room to be overwritten with a forwarding pointer during garbage collection. -------------------------------------------------------------------------- */ #define MIN_PAYLOAD_SIZE 1 /* ----------------------------------------------------------------------------- Constants to do with specialised closure types. -------------------------------------------------------------------------- */ /* We have some pre-compiled selector thunks defined in rts/StgStdThunks.hc. * This constant defines the highest selectee index that we can replace with a * reference to the pre-compiled code. */ #define MAX_SPEC_SELECTEE_SIZE 15 /* Vector-apply thunks. These thunks just push their free variables * on the stack and enter the first one. They're a bit like PAPs, but * don't have a dynamic size. We've pre-compiled a few to save * space. */ #define MAX_SPEC_AP_SIZE 7 /* Specialised FUN/THUNK/CONSTR closure types */ #define MAX_SPEC_THUNK_SIZE 2 #define MAX_SPEC_FUN_SIZE 2 #define MAX_SPEC_CONSTR_SIZE 2 /* Range of built-in table of static small int-like and char-like closures. * * NB. This corresponds with the number of actual INTLIKE/CHARLIKE * closures defined in rts/StgMiscClosures.cmm. */ #define MAX_INTLIKE 16 #define MIN_INTLIKE (-16) #define MAX_CHARLIKE 255 #define MIN_CHARLIKE 0 /* Each byte in the card table for an StgMutaArrPtrs covers * (1<msg_cap */ #define BlockedOnMsgThrowTo 12 /* The thread is not on any run queues, but can be woken up by tryWakeupThread() */ #define ThreadMigrating 13 /* WARNING WARNING top number is BlockedOnMVarRead 14, not 13!! */ /* * These constants are returned to the scheduler by a thread that has * stopped for one reason or another. See typedef StgThreadReturnCode * in TSO.h. */ #define HeapOverflow 1 /* might also be StackOverflow */ #define StackOverflow 2 #define ThreadYielding 3 #define ThreadBlocked 4 #define ThreadFinished 5 /* * Flags for the tso->flags field. */ /* * TSO_LOCKED is set when a TSO is locked to a particular Capability. */ #define TSO_LOCKED 2 /* * TSO_BLOCKEX: the TSO is blocking exceptions * * TSO_INTERRUPTIBLE: the TSO can be interrupted if it blocks * interruptibly (eg. with BlockedOnMVar). * * TSO_STOPPED_ON_BREAKPOINT: the thread is currently stopped in a breakpoint */ #define TSO_BLOCKEX 4 #define TSO_INTERRUPTIBLE 8 #define TSO_STOPPED_ON_BREAKPOINT 16 /* * Used by the sanity checker to check whether TSOs are on the correct * mutable list. */ #define TSO_MARKED 64 /* * Used to communicate between stackSqueeze() and * threadStackOverflow() that a thread's stack was squeezed and the * stack may not need to be expanded. */ #define TSO_SQUEEZED 128 /* * Enables the AllocationLimitExceeded exception when the thread's * allocation limit goes negative. */ #define TSO_ALLOC_LIMIT 256 /* * The number of times we spin in a spin lock before yielding (see * #3758). To tune this value, use the benchmark in #3758: run the * server with -N2 and the client both on a dual-core. Also make sure * that the chosen value doesn't slow down any of the parallel * benchmarks in nofib/parallel. */ #define SPIN_COUNT 1000 /* ----------------------------------------------------------------------------- Spare workers per Capability in the threaded RTS No more than MAX_SPARE_WORKERS will be kept in the thread pool associated with each Capability. -------------------------------------------------------------------------- */ #define MAX_SPARE_WORKERS 6 /* * The maximum number of NUMA nodes we support. This is a fixed limit so that * we can have static arrays of this size in the RTS for speed. */ #define MAX_NUMA_NODES 16