dmd/druntime/test/allocations
Martin Kinkelin a54fbab882
[stable] druntime: Fix InvalidMemoryOperation error on Windows when throwing exceptions from finalizers (#14901)
* Fix Issue 23731 - InvalidMemoryOperation error on Windows when throwing exceptions from finalizers

A v2.102 regression, which newly enabled `StackTrace` constructions
from within GC finalizers. The construction is `@nogc`, but
apparently depends on the `typeid(StackTrace)` monitor having been
allocated already, i.e., a previous `StackTrace` construction.

So pre-allocate a dedicated `Mutex` in the module constructor to
make the `StackTrace` construction really `@nogc`.
`druntime/test/allocations/src/alloc_from_assert.d` then passes on
Windows again (not tested by DMD, but by LDC).

While at it, also prevent `InvalidMemoryOperation` errors when trying
to print exceptions within finalizers - by not resolving anything
(=> empty printed trace), as resolving currently heavily depends on
the GC.

* [work around cyclic modules dependency...]

* druntime: Test test/allocations/src/alloc_from_assert.d on Windows too

As it regressed with v2.102.
2023-02-22 11:17:24 +02:00
..
src
Makefile
win64.mak [stable] druntime: Fix InvalidMemoryOperation error on Windows when throwing exceptions from finalizers (#14901) 2023-02-22 11:17:24 +02:00