threads are the bug

Matthew Fluet mfluet@intertrust.com
Thu, 5 Jul 2001 18:23:32 -0700 (PDT)


> > The rule is that if you don't declare a variable volatile, then if a function
> > looks at it and then grinds for a while, and then looks at it again,  it  can
> > assume  that it didn't change during the grinding.

So, what constitutes "grinding for a while?"  If something is declared
volatile and a signal can interrupt at any given point in the instruction
sequence, how does the compiler do anything useful with the volatile
variable?

> OK.  I now have the following in gc.h
>
> 	volatile int canHandle;
> 	volatile bool signalIsPending;

Does this impact the assembly version of thread_SwitchTo?  For reasons
completely independent of their volatility, the register allocator should
manipulate those two variables directly in memory (in each basic block
where they are used, there is exactly one use, so the allocator shouldn't
bother pulling them into a register).