AngouriMath
AngouriMath.Core.FastExpression
Classes within the AngouriMath.Core.FastExpression namespace
Compiler
Summary
Scratch
Summary
The working stack and the cache of repeated subexpressions, one set per thread
rather than one per compiled expression.
Remarks
They used to be instance fields, which made a compiled expression unsafe to call
from more than one thread at a time: two calls interleaved their pushes and pops
and the second to finish found the stack in a state it did not put it in. Worse,
the damage was permanent -- the count check throws before anything is popped, so
one racing call left the leftovers behind and every later call failed too, on one
thread or many. See https://github.com/asc-community/AngouriMath/issues/637.
Per thread rather than per call so that calling a compiled expression still
allocates nothing, which is the point of compiling it. Neither buffer carries
anything from one call to the next: the stack is emptied on the way in, and the
cache is only ever read at a slot the same call has already written.
Angouri © 2019-2023 · Project's repo · Site's repo · Octicons · Transparency · 1953 pages online