3 ms·
This can be implemented many different ways without losing a register (/ other parameter storage). It’s called dynamic scoping or thread local variables.
by astrange 4y ago
This can be implemented many different ways without losing a register (/ other parameter storage). It’s called dynamic scoping or thread local variables.
- _0w8t 4y agoThread-local variables are implemented using a reserved register. Essentially thread-locals in C++ are the hidden context.
- astrange 4y agoThat doesn't "lose" a register because the program already wasn't using it.
- LegionMammal978 4y agoTo be fair, they're implemented with one of the segment registers, at least on x86-64. So there isn't much else that programs could have used it for, since it takes a syscall just to set the value.