aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src/beam_utils.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2016-10-05 15:06:09 +0200
committerBjörn Gustavsson <[email protected]>2016-10-05 15:06:09 +0200
commit7af3910bb06433f7c9182db11d853823f202c2b6 (patch)
tree5fd0b1fe04e670123f9b31381e195ed5ce55d1cf /lib/compiler/src/beam_utils.erl
parentef6f8da5d027055a36c70196df69dfbb7b464800 (diff)
parent497330a828089b465ac026551edf33fb947ae2f6 (diff)
downloadotp-7af3910bb06433f7c9182db11d853823f202c2b6.tar.gz
otp-7af3910bb06433f7c9182db11d853823f202c2b6.tar.bz2
otp-7af3910bb06433f7c9182db11d853823f202c2b6.zip
Merge branch 'maint'
* maint: Update primary bootstrap beam_block: Avoid unsafe inclusion of get_map_elements in blocks
Diffstat (limited to 'lib/compiler/src/beam_utils.erl')
-rw-r--r--lib/compiler/src/beam_utils.erl12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/compiler/src/beam_utils.erl b/lib/compiler/src/beam_utils.erl
index c91256f6bc..564a62a7f2 100644
--- a/lib/compiler/src/beam_utils.erl
+++ b/lib/compiler/src/beam_utils.erl
@@ -26,7 +26,7 @@
empty_label_index/0,index_label/3,index_labels/1,
code_at/2,bif_to_test/3,is_pure_test/1,
live_opt/1,delete_live_annos/1,combine_heap_needs/2,
- join_even/2,split_even/1]).
+ split_even/1]).
-import(lists, [member/2,sort/1,reverse/1,splitwith/2]).
@@ -236,11 +236,6 @@ combine_heap_needs(H1, H2) when is_integer(H1), is_integer(H2) ->
split_even(Rs) -> split_even(Rs, [], []).
-%% join_even/1
-%% {[1,3,5],[2,4,6]} -> [1,2,3,4,5,6]
-
-join_even([], []) -> [];
-join_even([S|Ss], [D|Ds]) -> [S,D|join_even(Ss, Ds)].
%%%
%%% Local functions.
@@ -723,6 +718,11 @@ live_opt([timeout=I|Is], _, D, Acc) ->
live_opt(Is, 0, D, [I|Acc]);
live_opt([{wait,_}=I|Is], _, D, Acc) ->
live_opt(Is, 0, D, [I|Acc]);
+live_opt([{get_map_elements,Fail,Src,{list,List}}=I|Is], Regs0, D, Acc) ->
+ {Ss,Ds} = split_even(List),
+ Regs1 = x_live([Src|Ss], x_dead(Ds, Regs0)),
+ Regs = live_join_label(Fail, D, Regs1),
+ live_opt(Is, Regs, D, [I|Acc]);
%% Transparent instructions - they neither use nor modify x registers.
live_opt([{deallocate,_}=I|Is], Regs, D, Acc) ->