Skip to content

Commit b76c08a

Browse files
committed
Merge branch 'maint'
* maint: beam_core_to_ssa: Eliminate bottleneck when there are many clauses erl_lint: Eliminate bottleneck when there are many clauses Fix formatting typo in Appup Cookbook
2 parents 348940b + 2920d74 commit b76c08a

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

lib/compiler/src/beam_core_to_ssa.erl

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2664,8 +2664,14 @@ select_val_cg(Type, R, Vls, Tf, Vf, Sis, St0) ->
26642664
{TypeIs++[#b_switch{arg=R,fail=Vf,list=Vls}|Sis],St1}
26652665
end.
26662666

2667-
combine([{Is,Vs1},{Is,Vs2}|Vis]) -> combine([{Is,Vs1 ++ Vs2}|Vis]);
2668-
combine([V|Vis]) -> [V|combine(Vis)];
2667+
2668+
combine([V|Vis0]) ->
2669+
case {V, combine(Vis0)} of
2670+
{{Is,Vs1}, [{Is,Vs2}|Vis]} ->
2671+
[{Is,Vs1 ++ Vs2}|Vis];
2672+
{_,Vis} ->
2673+
[V|Vis]
2674+
end;
26692675
combine([]) -> [].
26702676

26712677
select_labels([{Is,Vs}|Vis], St0, Vls, Sis) ->

lib/stdlib/src/erl_lint.erl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3988,7 +3988,7 @@ icrt_export([{V,{{export,_},_,_}}|Vs0], [{V,{{export,_}=S0,_,As}}|Vt],
39883988
%% V was an exported variable and has been used in an expression in at least
39893989
%% one clause. Its state needs to be merged from all clauses to silence any
39903990
%% exported var warning already emitted.
3991-
{VVs,Vs} = lists:partition(fun ({K,_}) -> K =:= V end, Vs0),
3991+
{VVs,Vs} = lists:splitwith(fun ({K,_}) -> K =:= V end, Vs0),
39923992
S = foldl(fun ({_,{S1,_,_}}, AccS) -> merge_state(AccS, S1) end, S0, VVs),
39933993
icrt_export(Vs, Vt, In, I, [{V,{S,used,As}}|Acc]);
39943994
icrt_export([{V,_}|Vs0], [{V,{_,_,As}}|Vt], In, I, Acc) ->
@@ -4003,7 +4003,7 @@ icrt_export([{V1,_}|_]=Vs, [{V2,_}|Vt], In, I, Acc) when V1 > V2 ->
40034003
icrt_export(Vs, Vt, In, I, Acc);
40044004
icrt_export([{V,_}|_]=Vs0, Vt, In, I, Acc) ->
40054005
%% V is a new variable.
4006-
{VVs,Vs} = lists:partition(fun ({K,_}) -> K =:= V end, Vs0),
4006+
{VVs,Vs} = lists:splitwith(fun ({K,_}) -> K =:= V end, Vs0),
40074007
F = fun ({_,{S,U,As}}, {AccI,AccS0,AccAs0}) ->
40084008
AccS = case {S,AccS0} of
40094009
{{unsafe,_},{unsafe,_}} ->

system/doc/design_principles/appup_cookbook.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,9 +388,9 @@ terminated before the child specification is changed and the module is deleted.
388388

389389
## Adding or Deleting a Module
390390

391-
_Example
391+
_Example_
392392

393-
_ A new functional module `m` is added to `ch_app`:
393+
A new functional module `m` is added to `ch_app`:
394394

395395
```erlang
396396
{"2",

0 commit comments

Comments
 (0)