Static locals (Was: Updated mangling specs)
Martin von Loewis
loewis at informatik.hu-berlin.de
Thu Feb 10 18:31:37 UTC 2000
> - Mangling of static data in inline functions or templates
> - Mangling of strings constants in inline functions
In relation to issue G-3, we then also need to specify how
initialisation of static data happens. The standard says that
initialization of those data can fail (with an exception), in which
case it must be "re-tried" the next time the same block is entered.
To achieve this, g++ adds an implicit variable, which indicates
whether the static has been initialized. We need to specify
- the type of that variable
- the meaning of its possible values
- the mangling of that variable
If compilers want thread-aware initialization of such a variable, a
simple two-state value does not suffice, as there are at least three
possible states:
- variable is uninitialized
- initialization is in progress (so other threads should block when
the reach the variable declaration)
- variable is fully initialized
Whether or not thread-safe initialization is part of the ABI or an
extension is another issue, IMHO; if it was, the mechanism would need
to be specified (along with the mangling for the mutexes and so on).
However, I think the ABI should support the three-state approach in
any case: this will also allow to detect recursive entering of
initializations (which has undefined behaviour).
Regards,
Martin
More information about the cxx-abi-dev
mailing list