diff options
author | Björn-Egil Dahlberg <[email protected]> | 2015-05-26 15:27:57 +0200 |
---|---|---|
committer | Björn-Egil Dahlberg <[email protected]> | 2015-05-26 15:27:57 +0200 |
commit | 791f0695fd2b2551b79bf114a7cefd5c4d07b7ee (patch) | |
tree | 6db054e4e668aae6e12c28c1fdcdda159b375d24 /lib/compiler/src/v3_life.erl | |
parent | 42dd87320c1197501b7f1ca864eb5515a2c9ba41 (diff) | |
parent | 5c11e739da22157aa0bf80671babf21ed37b30d7 (diff) | |
download | otp-791f0695fd2b2551b79bf114a7cefd5c4d07b7ee.tar.gz otp-791f0695fd2b2551b79bf114a7cefd5c4d07b7ee.tar.bz2 otp-791f0695fd2b2551b79bf114a7cefd5c4d07b7ee.zip |
Merge branch 'egil/opt-compile-time/OTP-12774'
* egil/opt-compile-time/OTP-12774:
stdlib: Relax erl_anno_SUITE:is_anno/1 test
Update primary bootstrap
compiler: Use Maps as type information
compiler: Use Maps instead of dict in beam_jump
compiler: Use cerl_sets instead of gb_sets in beam_type
compiler: Use Maps instead of gb_trees in beam_dead
compiler: Use cerl_sets instead of gb_sets in beam_jump
compiler: Use cerl_sets instead of sets in v3_kernel
compiler: Use cerl_sets instead of gb_sets in sys_core_fold
compiler: Add cerl_sets module
compiler: Scope uses gb_sets not gb_trees
beam_dict: Use Maps to map function name indices
beam_dict: Use Maps to map line indices
beam_dict: Use Maps to map atom indices
v3_codegen: Use Maps to map local functions
v3_life: Refactor variable db
compiler: Use lc instead of map/1 in v3_codegen
stdlib: Optimize erl_anno:is_string/1
Conflicts:
bootstrap/lib/kernel/ebin/inet_dns.beam
bootstrap/lib/stdlib/ebin/erl_anno.beam
bootstrap/lib/stdlib/ebin/erl_lint.beam
Diffstat (limited to 'lib/compiler/src/v3_life.erl')
-rw-r--r-- | lib/compiler/src/v3_life.erl | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/compiler/src/v3_life.erl b/lib/compiler/src/v3_life.erl index 4b1f1c3f71..ee0565efb6 100644 --- a/lib/compiler/src/v3_life.erl +++ b/lib/compiler/src/v3_life.erl @@ -411,7 +411,7 @@ is_gc_bif(Bif, Arity) -> %% must be sorted. init_vars(Vs) -> - sort([{V,0,0} || {var,V} <- Vs]). + vdb_new(Vs). new_vars([], _, Vdb) -> Vdb; new_vars([V], I, Vdb) -> vdb_store_new(V, {V,I,I}, Vdb); @@ -430,6 +430,16 @@ use_vars(Vs, I, Vdb) -> vdb_update_vars(Vs, Vdb, I). add_var(V, F, L, Vdb) -> vdb_store_new(V, {V,F,L}, Vdb). +%% is_in_guard() -> true|false. + +is_in_guard() -> + get(guard_refc) > 0. + +%% vdb + +vdb_new(Vs) -> + sort([{V,0,0} || {var,V} <- Vs]). + vdb_find(V, Vdb) -> case lists:keyfind(V, 1, Vdb) of false -> error; @@ -471,8 +481,3 @@ vdb_sub(Min, Max, Vdb) -> [ if L >= Max -> {V,F,locked}; true -> Vd end || {V,F,L}=Vd <- Vdb, F < Min, L >= Min ]. - -%% is_in_guard() -> true|false. - -is_in_guard() -> - get(guard_refc) > 0. |