diff options
author | Sverker Eriksson <[email protected]> | 2018-07-20 14:25:22 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2018-07-20 14:25:22 +0200 |
commit | 70b445f29153ef6f043676692c3d67be5141bab6 (patch) | |
tree | 47ec50423cc734fde395fde94cbd4fb1cecb548a | |
parent | c4865b2b0b4d71a062cdd8fd091e3e5d43187231 (diff) | |
parent | 29eced05732b65f7663766014f1457dfc456eae8 (diff) | |
download | otp-70b445f29153ef6f043676692c3d67be5141bab6.tar.gz otp-70b445f29153ef6f043676692c3d67be5141bab6.tar.bz2 otp-70b445f29153ef6f043676692c3d67be5141bab6.zip |
Merge PR-1878 from michalmuskala/mm/map-new-bif-2 OTP-15200
maps:new/0 is no longer a BIF
-rw-r--r-- | bootstrap/lib/stdlib/ebin/maps.beam | bin | 3520 -> 3552 bytes | |||
-rw-r--r-- | erts/emulator/beam/bif.tab | 1 | ||||
-rw-r--r-- | erts/emulator/beam/erl_map.c | 19 | ||||
-rw-r--r-- | lib/stdlib/src/maps.erl | 16 |
4 files changed, 7 insertions, 29 deletions
diff --git a/bootstrap/lib/stdlib/ebin/maps.beam b/bootstrap/lib/stdlib/ebin/maps.beam Binary files differindex ec0ebce58a..e24b5955d5 100644 --- a/bootstrap/lib/stdlib/ebin/maps.beam +++ b/bootstrap/lib/stdlib/ebin/maps.beam diff --git a/erts/emulator/beam/bif.tab b/erts/emulator/beam/bif.tab index 7548924178..a770524221 100644 --- a/erts/emulator/beam/bif.tab +++ b/erts/emulator/beam/bif.tab @@ -629,7 +629,6 @@ bif maps:from_list/1 bif maps:is_key/2 bif maps:keys/1 bif maps:merge/2 -bif maps:new/0 bif maps:put/3 bif maps:remove/2 bif maps:update/3 diff --git a/erts/emulator/beam/erl_map.c b/erts/emulator/beam/erl_map.c index cba17d3e6a..4a1fe4470e 100644 --- a/erts/emulator/beam/erl_map.c +++ b/erts/emulator/beam/erl_map.c @@ -1505,25 +1505,6 @@ int hashmap_key_hash_cmp(Eterm* ap, Eterm* bp) return ap ? -1 : 1; } -/* maps:new/0 */ - -BIF_RETTYPE maps_new_0(BIF_ALIST_0) { - Eterm* hp; - Eterm tup; - flatmap_t *mp; - - hp = HAlloc(BIF_P, (MAP_HEADER_FLATMAP_SZ + 1)); - tup = make_tuple(hp); - *hp++ = make_arityval(0); - - mp = (flatmap_t*)hp; - mp->thing_word = MAP_HEADER_FLATMAP; - mp->size = 0; - mp->keys = tup; - - BIF_RET(make_flatmap(mp)); -} - /* maps:put/3 */ BIF_RETTYPE maps_put_3(BIF_ALIST_3) { diff --git a/lib/stdlib/src/maps.erl b/lib/stdlib/src/maps.erl index 60463feec2..6f5553c769 100644 --- a/lib/stdlib/src/maps.erl +++ b/lib/stdlib/src/maps.erl @@ -21,7 +21,7 @@ -module(maps). -export([get/3, filter/2,fold/3, - map/2, size/1, + map/2, size/1, new/0, update_with/3, update_with/4, without/2, with/2, iterator/1, next/1]). @@ -29,7 +29,7 @@ %% BIFs -export([get/2, find/2, from_list/1, is_key/2, keys/1, merge/2, - new/0, put/3, remove/2, take/2, + put/3, remove/2, take/2, to_list/1, update/3, values/1]). -opaque iterator() :: {term(), term(), iterator()} @@ -91,13 +91,6 @@ keys(_) -> erlang:nif_error(undef). merge(_,_) -> erlang:nif_error(undef). - --spec new() -> Map when - Map :: map(). - -new() -> erlang:nif_error(undef). - - %% Shadowed by erl_bif_types: maps:put/3 -spec put(Key,Value,Map1) -> Map2 when Key :: term(), @@ -157,6 +150,11 @@ values(_) -> erlang:nif_error(undef). %% End of BIFs +-spec new() -> Map when + Map :: #{}. + +new() -> #{}. + -spec update_with(Key,Fun,Map1) -> Map2 when Key :: term(), Map1 :: map(), |