diff options
author | Daniel Gröber <dxld@darkboxed.org> | 2019-06-17 11:46:07 +0200 |
---|---|---|
committer | Daniel Gröber <dxld@darkboxed.org> | 2019-09-22 15:18:10 +0200 |
commit | 48e816f0d754120029ab65b90f3ff42827a8e907 (patch) | |
tree | 74d1ba36be5bd40963ccd79631eec2f37af990ca /validate | |
parent | b03db9da54beded54d97e30453346efeeb36cb06 (diff) | |
download | haskell-48e816f0d754120029ab65b90f3ff42827a8e907.tar.gz |
rts: retainer: simplify pop() control flow
Instead of breaking out of the switch-in-while construct using `return` this
uses `goto out` which makes it possible to share a lot of the out-variable
assignment code in all the cases.
I also replaced the nasty `while(true)` business by the real loop
condition: `while(*c == NULL)`. All `break` calls inside the switch aready
have either a check for NULL or an assignment of `c` to NULL so this should
not change any behaviour.
Using `goto out` also allowed me to remove another minor wart: In the
MVAR_*/WEAK cases the popOff() call used to happen before reading the
stackElement. This looked like a use-after-free hazard to me as the stack
is allocated in blocks and depletion of a block could mean it getting freed
and possibly overwritten by zero or garbage, depending on the block
allocator's behaviour.
Diffstat (limited to 'validate')
0 files changed, 0 insertions, 0 deletions