aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src/v3_codegen.erl
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2015-05-14 13:44:19 +0200
committerBjörn-Egil Dahlberg <[email protected]>2015-05-21 15:44:02 +0200
commitaaefdd4fc60c94dffe1512324a54a7177211e932 (patch)
treeee9e663d8a2232b7976a2c83ff49fdb8935b09bd /lib/compiler/src/v3_codegen.erl
parentecb596c47674045c29890074269e25eb753a3b69 (diff)
downloadotp-aaefdd4fc60c94dffe1512324a54a7177211e932.tar.gz
otp-aaefdd4fc60c94dffe1512324a54a7177211e932.tar.bz2
otp-aaefdd4fc60c94dffe1512324a54a7177211e932.zip
v3_codegen: Use Maps to map local functions
Diffstat (limited to 'lib/compiler/src/v3_codegen.erl')
-rw-r--r--lib/compiler/src/v3_codegen.erl14
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/compiler/src/v3_codegen.erl b/lib/compiler/src/v3_codegen.erl
index 0b2119f157..c9b1a45cfc 100644
--- a/lib/compiler/src/v3_codegen.erl
+++ b/lib/compiler/src/v3_codegen.erl
@@ -57,8 +57,7 @@
break, %Break label
recv, %Receive label
is_top_block, %Boolean: top block or not
- functable=gb_trees:empty(), %Gb tree of local functions:
- % {{Name,Arity},Label}
+ functable=#{}, %Map of local functions: {Name,Arity}=>Label
in_catch=false, %Inside a catch or not.
need_frame, %Need a stack frame.
ultimate_failure %Label for ultimate match failure.
@@ -1261,13 +1260,12 @@ enter_line(_, _, _) ->
local_func_label(Name, Arity, St) ->
local_func_label({Name,Arity}, St).
-local_func_label(Key, #cg{functable=Tab}=St0) ->
- case gb_trees:lookup(Key, Tab) of
- {value,Label} ->
- {Label,St0};
- none ->
+local_func_label(Key, #cg{functable=Map}=St0) ->
+ case Map of
+ #{Key := Label} -> {Label,St0};
+ _ ->
{Label,St} = new_label(St0),
- {Label,St#cg{functable=gb_trees:insert(Key, Label, Tab)}}
+ {Label,St#cg{functable=Map#{Key => Label}}}
end.
%% need_stack_frame(State) -> State'