# std.debug.SelfInfo: remove shared logic · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/1120546f72405ac263dce7414eb71ca4e6c96fc8)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 1120546f72405ac263dce7414eb71ca4e6c96fc8

Requested commit: 1120546f72405ac263dce7414eb71ca4e6c96fc8

Commit: 1120546f72405ac263dce7414eb71ca4e6c96fc8

Tree: 4a6f90029d8feff983889a133326fbe2a4e3465d

Author: mlugg

Committer: mlugg

## Message

```
std.debug.SelfInfo: remove shared logic

There were only a few dozen lines of common logic, and they frankly
introduced more complexity than they eliminated. Instead, let's accept
that the implementations of `SelfInfo` are all pretty different and want
to track different state. This probably fixes some synchronization and
memory bugs by simplifying a bunch of stuff. It also improves the DWARF
unwind cache, making it around twice as fast in a debug build with the
self-hosted x86_64 backend, because we no longer have to redundantly go
through the hashmap lookup logic to find the module. Unwinding on
Windows will also see a slight performance boost from this change,
because `RtlVirtualUnwind` does not need to know the module whatsoever,
so the old `SelfInfo` implementation was doing redundant work. Lastly,
this makes it even easier to implement `SelfInfo` on freestanding
targets; there is no longer a need to emulate a real module system,
since the user controls the whole implementation!

There are various other small refactors here in the `SelfInfo`
implementations as well as in the DWARF unwinding logic. This change
turned out to make a lot of stuff simpler!

```

## Parents

- [12ceb896faebf25195d8b360e4972dd2bf23ede1](https://git.cafe/gitcafe/zig/commit/12ceb896faebf25195d8b360e4972dd2bf23ede1?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/1120546f72405ac263dce7414eb71ca4e6c96fc8?format=markdown)
