aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2016-12-15 09:20:47 +0100
committerBjörn Gustavsson <[email protected]>2017-01-12 12:10:11 +0100
commitcccda0664fa8ba98e718838a0b9d0bc857ea8948 (patch)
treea4e0407c6c7dbef05720c729378cd70e4cd5eb70 /lib/compiler/src
parent7d3502edc002ecf8c02eeacd313bf9353067ba0d (diff)
downloadotp-cccda0664fa8ba98e718838a0b9d0bc857ea8948.tar.gz
otp-cccda0664fa8ba98e718838a0b9d0bc857ea8948.tar.bz2
otp-cccda0664fa8ba98e718838a0b9d0bc857ea8948.zip
beam_dict: Add missing types and specs
Diffstat (limited to 'lib/compiler/src')
-rw-r--r--lib/compiler/src/beam_dict.erl10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/compiler/src/beam_dict.erl b/lib/compiler/src/beam_dict.erl
index 98e0506ba0..719d799fd7 100644
--- a/lib/compiler/src/beam_dict.erl
+++ b/lib/compiler/src/beam_dict.erl
@@ -28,7 +28,7 @@
string_table/1,lambda_table/1,literal_table/1,
line_table/1]).
--type label() :: non_neg_integer().
+-type label() :: beam_asm:label().
-type index() :: non_neg_integer().
@@ -38,13 +38,16 @@
-type line_tab() :: #{{Fname :: index(), Line :: term()} => index()}.
-type literal_tab() :: dict:dict(Literal :: term(), index()).
+-type lambda_info() :: {label(),{index(),label(),non_neg_integer()}}.
+-type lambda_tab() :: {non_neg_integer(),[lambda_info()]}.
+
-record(asm,
{atoms = #{} :: atom_tab(),
exports = [] :: [{label(), arity(), label()}],
locals = [] :: [{label(), arity(), label()}],
imports = gb_trees:empty() :: import_tab(),
strings = <<>> :: binary(), %String pool
- lambdas = {0,[]}, %[{...}]
+ lambdas = {0,[]} :: lambda_tab(),
literals = dict:new() :: literal_tab(),
fnames = #{} :: fname_tab(),
lines = #{} :: line_tab(),
@@ -182,6 +185,9 @@ line([{location,Name,Line}], #asm{lines=Lines,num_lines=N}=Dict0) ->
{Index, Dict1#asm{lines=Lines#{Key=>Index},num_lines=N+1}}
end.
+-spec fname(nonempty_string(), bdict()) ->
+ {non_neg_integer(), bdict()}.
+
fname(Name, #asm{fnames=Fnames}=Dict) ->
case Fnames of
#{Name := Index} -> {Index,Dict};