diff options
author | Björn Gustavsson <[email protected]> | 2019-01-25 17:36:24 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2019-01-28 05:34:58 +0100 |
commit | d479269f2805aba973d1ff3dd7cc7387908cb3ed (patch) | |
tree | 5ccaa2706c8cc45ab68adafbd05e8a5a0844d853 /lib/compiler/src/beam_ssa_opt.erl | |
parent | 6fe596c68b0b7c5df6b2dff83747c279b9c7e884 (diff) | |
download | otp-d479269f2805aba973d1ff3dd7cc7387908cb3ed.tar.gz otp-d479269f2805aba973d1ff3dd7cc7387908cb3ed.tar.bz2 otp-d479269f2805aba973d1ff3dd7cc7387908cb3ed.zip |
beam_ssa_opt: Make phase/4 tail-recursive
If compilation failed, the name of the current function *and*
all previously compiled functions would be printed because
phase/4 was not tail-recursive.
https://bugs.erlang.org/browse/ERL-840
Diffstat (limited to 'lib/compiler/src/beam_ssa_opt.erl')
-rw-r--r-- | lib/compiler/src/beam_ssa_opt.erl | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/compiler/src/beam_ssa_opt.erl b/lib/compiler/src/beam_ssa_opt.erl index 2c898ba6f8..f99993522a 100644 --- a/lib/compiler/src/beam_ssa_opt.erl +++ b/lib/compiler/src/beam_ssa_opt.erl @@ -79,11 +79,9 @@ module(Module, Opts) -> {ok, finish(Module, StMap)}. phase([FuncId | Ids], Ps, StMap, FuncDb0) -> - try - {St, FuncDb} = - compile:run_sub_passes(Ps, {map_get(FuncId, StMap), FuncDb0}), - - phase(Ids, Ps, StMap#{ FuncId => St }, FuncDb) + try compile:run_sub_passes(Ps, {map_get(FuncId, StMap), FuncDb0}) of + {St, FuncDb} -> + phase(Ids, Ps, StMap#{ FuncId => St }, FuncDb) catch Class:Error:Stack -> #b_local{name=Name,arity=Arity} = FuncId, |