template <typename T>

struct PerBlock

Defined at line 198 of file ../../sdk/lib/c/startup/../threads/thread-storage.h

Each of the different blocks is allocated as a GuardedPageBlock. That

object has nice destructor semantics and it's used during Allocate(). But

for storage, it's suboptimal to just use separate GuardedPageBlock objects

here. GuardedPageBlock records the base address and size of the sub-VMAR,

and the (parent) VMAR handle through which to unmap it; struct alignment

means that's three whole words though half of one is unused. Moreover,

the size is actually redundant between the different stack blocks since

they are all controlled by the ThreadAttributes stack and guard sizes. On

the other hand, GuardedPageBlock just records the address and size of the

whole region (including guards), while ThreadStorage needs to record the

stack and guard sizes separately for pthread_getattr_np to recover. So

what's most compact is to store the sizes separately, and then store the

address and VMAR handle for each block in parallel structs that don't

waste any space for alignment. So a Perblock

<T

> struct is used in the

separate address_ and vmar_ members to cover all the blocks. The sizes

are stored separately since the thread block has a single size while the

others are all computed from the same one pair of stack and guard sizes.

Public Members

T thread_block
MachineStack<T> machine_stack
IfShadowCallStack<T> shadow_call_stack
IfSafeStack<T> unsafe_stack