summaryrefslogtreecommitdiff
path: root/rts/RtsMain.c
diff options
context:
space:
mode:
authorDaniel Gröber <dxld@darkboxed.org>2019-06-17 11:46:07 +0200
committerDaniel Gröber <dxld@darkboxed.org>2019-09-22 15:18:10 +0200
commit48e816f0d754120029ab65b90f3ff42827a8e907 (patch)
tree74d1ba36be5bd40963ccd79631eec2f37af990ca /rts/RtsMain.c
parentb03db9da54beded54d97e30453346efeeb36cb06 (diff)
downloadhaskell-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 'rts/RtsMain.c')
0 files changed, 0 insertions, 0 deletions