From 9f9bf4a6db455575d68eba4850c76341b08614d6 Mon Sep 17 00:00:00 2001 From: Hans Bolinder Date: Mon, 4 Jul 2016 09:37:45 +0200 Subject: stdlib: Correct a bug regarding records in the shell See also ERL-182. --- lib/stdlib/src/shell.erl | 4 +++- lib/stdlib/test/shell_SUITE.erl | 17 +++++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/stdlib/src/shell.erl b/lib/stdlib/src/shell.erl index 82a3a2be4f..28f37ef8bf 100644 --- a/lib/stdlib/src/shell.erl +++ b/lib/stdlib/src/shell.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2015. All Rights Reserved. +%% Copyright Ericsson AB 1996-2016. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. @@ -768,6 +768,8 @@ used_records({call,_,{atom,_,record_info},[A,{atom,_,Name}]}) -> {name, Name, A}; used_records({call,Line,{tuple,_,[M,F]},As}) -> used_records({call,Line,{remote,Line,M,F},As}); +used_records({type,_,record,[{atom,_,Name}|Fs]}) -> + {name, Name, Fs}; used_records(T) when is_tuple(T) -> {expr, tuple_to_list(T)}; used_records(E) -> diff --git a/lib/stdlib/test/shell_SUITE.erl b/lib/stdlib/test/shell_SUITE.erl index dc82e92876..c409a6949b 100644 --- a/lib/stdlib/test/shell_SUITE.erl +++ b/lib/stdlib/test/shell_SUITE.erl @@ -30,7 +30,7 @@ progex_bit_syntax/1, progex_records/1, progex_lc/1, progex_funs/1, otp_5990/1, otp_6166/1, otp_6554/1, - otp_7184/1, otp_7232/1, otp_8393/1, otp_10302/1]). + otp_7184/1, otp_7232/1, otp_8393/1, otp_10302/1, otp_13719/1]). -export([ start_restricted_from_shell/1, start_restricted_on_command_line/1,restricted_local/1]). @@ -91,7 +91,7 @@ groups() -> progex_funs]}, {tickets, [], [otp_5990, otp_6166, otp_6554, otp_7184, - otp_7232, otp_8393, otp_10302]}]. + otp_7232, otp_8393, otp_10302, otp_13719]}]. init_per_suite(Config) -> Config. @@ -2810,6 +2810,19 @@ otp_10302(Config) when is_list(Config) -> test_server:stop_node(Node), ok. +otp_13719(Config) when is_list(Config) -> + Test = <<"-module(otp_13719). + -record(bar, {}). + -record(foo, {bar :: #bar{}}).">>, + File = filename("otp_13719.erl", Config), + Beam = filename("otp_13719.beam", Config), + ok = compile_file(Config, File, Test, []), + RR = "rr(\"" ++ Beam ++ "\"). #foo{}.", + "[bar,foo]\n#foo{bar = undefined}.\n" = t(RR), + file:delete(filename("test.beam", Config)), + file:delete(File), + ok. + scan(B) -> F = fun(Ts) -> case erl_parse:parse_term(Ts) of -- cgit v1.2.3 From 30cb490ed08d358d584a90aac4819c85ddf6fcce Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Fri, 8 Jul 2016 14:51:59 +0200 Subject: erts: Add test ets_SUITE:update_counter_table_growth --- lib/stdlib/test/ets_SUITE.erl | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'lib') diff --git a/lib/stdlib/test/ets_SUITE.erl b/lib/stdlib/test/ets_SUITE.erl index 8c1c625676..b02d17bdb6 100644 --- a/lib/stdlib/test/ets_SUITE.erl +++ b/lib/stdlib/test/ets_SUITE.erl @@ -47,6 +47,7 @@ fixtable_next/1, fixtable_insert/1, rename/1, rename_unnamed/1, evil_rename/1, update_element/1, update_counter/1, evil_update_counter/1, partly_bound/1, match_heavy/1]). -export([update_counter_with_default/1]). +-export([update_counter_table_growth/1]). -export([member/1]). -export([memory/1]). -export([select_fail/1]). @@ -100,6 +101,7 @@ heavy_lookup_element_do/1, member_do/1, otp_5340_do/1, otp_7665_do/1, meta_wb_do/1, do_heavy_concurrent/1, tab2file2_do/2, exit_large_table_owner_do/2, types_do/1, sleeper/0, memory_do/1, update_counter_with_default_do/1, + update_counter_table_growth_do/1, ms_tracee_dummy/1, ms_tracee_dummy/2, ms_tracee_dummy/3, ms_tracee_dummy/4 ]). @@ -137,6 +139,7 @@ all() -> rename, rename_unnamed, evil_rename, update_element, update_counter, evil_update_counter, update_counter_with_default, partly_bound, + update_counter_table_growth, match_heavy, {group, fold}, member, t_delete_object, t_init_table, t_whitebox, t_delete_all_objects, t_insert_list, t_test_ms, t_select_delete, t_ets_dets, @@ -1955,6 +1958,16 @@ update_counter_with_default_do(Opts) -> ok. +update_counter_table_growth(_Config) -> + repeat_for_opts(update_counter_table_growth_do). + +update_counter_table_growth_do(Opts) -> + Set = ets_new(b, [set | Opts]), + [ets:update_counter(Set, N, {2, 1}, {N, 1}) || N <- lists:seq(1,10000)], + OrderedSet = ets_new(b, [ordered_set | Opts]), + [ets:update_counter(OrderedSet, N, {2, 1}, {N, 1}) || N <- lists:seq(1,10000)], + ok. + %% Check that a first-next sequence always works on a fixed table. fixtable_next(Config) when is_list(Config) -> repeat_for_opts(fixtable_next_do, [write_concurrency,all_types]). -- cgit v1.2.3 From 8b83bc0b54b728cf9179ef3fa0e7610f99f7a6a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn-Egil=20Dahlberg?= Date: Tue, 12 Jul 2016 16:08:38 +0200 Subject: compiler: Test literal binary matching The following regression was introduced in 19.0: foo(bar, <<"x">>) -> 1; foo(_, <<"x">>) -> 2; foo(_, <<"y">>) -> 3; foo(_, _) -> fail. The call foo(bar,<<"y">>) would errorneous return 'fail' instead of 3. A testcase in match_SUITE has been added to verify this. --- lib/compiler/test/match_SUITE.erl | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/compiler/test/match_SUITE.erl b/lib/compiler/test/match_SUITE.erl index 31402ac717..127679ba69 100644 --- a/lib/compiler/test/match_SUITE.erl +++ b/lib/compiler/test/match_SUITE.erl @@ -24,7 +24,7 @@ pmatch/1,mixed/1,aliases/1,non_matching_aliases/1, match_in_call/1,untuplify/1,shortcut_boolean/1,letify_guard/1, selectify/1,underscore/1,match_map/1,map_vars_used/1, - coverage/1,grab_bag/1]). + coverage/1,grab_bag/1,literal_binary/1]). -include_lib("common_test/include/ct.hrl"). @@ -40,7 +40,7 @@ groups() -> match_in_call,untuplify, shortcut_boolean,letify_guard,selectify, underscore,match_map,map_vars_used,coverage, - grab_bag]}]. + grab_bag,literal_binary]}]. init_per_suite(Config) -> @@ -574,6 +574,15 @@ grab_bag_remove_failure([{stretch,_,Mi}=Stretch | Specs], Unit, _MaxFailure) -> ok end. +%% Regression in 19.0, reported by Alexei Sholik +literal_binary(_Config) -> + 3 = literal_binary_match(bar,<<"y">>), + ok. + +literal_binary_match(bar, <<"x">>) -> 1; +literal_binary_match(_, <<"x">>) -> 2; +literal_binary_match(_, <<"y">>) -> 3; +literal_binary_match(_, _) -> fail. id(I) -> I. -- cgit v1.2.3 From dd1162846eb7942243ea285310cf100b6959a845 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn-Egil=20Dahlberg?= Date: Tue, 12 Jul 2016 16:12:50 +0200 Subject: Revert "beam_dead: Improve optimization of literal binary matching" This reverts commit 105c5b0071056dc062797e58772e098d2a3a4627. --- lib/compiler/src/beam_dead.erl | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/lib/compiler/src/beam_dead.erl b/lib/compiler/src/beam_dead.erl index b01f58f683..6f6d742293 100644 --- a/lib/compiler/src/beam_dead.erl +++ b/lib/compiler/src/beam_dead.erl @@ -272,17 +272,14 @@ backward([{jump,{f,To}}=J|[{bif,Op,_,Ops,Reg}|Is]=Is0], D, Acc) -> catch throw:not_possible -> backward(Is0, D, [J|Acc]) end; -backward([{test,bs_start_match2,F,Live,[R,_]=Args,Ctxt}|Is], D, +backward([{test,bs_start_match2,F,_,[R,_],Ctxt}=I|Is], D, [{test,bs_match_string,F,[Ctxt,Bs]}, {test,bs_test_tail2,F,[Ctxt,0]}|Acc0]=Acc) -> - {f,To0} = F, - To = shortcut_bs_start_match(To0, R, D), case beam_utils:is_killed(Ctxt, Acc0, D) of true -> - Eq = {test,is_eq_exact,{f,To},[R,{literal,Bs}]}, + Eq = {test,is_eq_exact,F,[R,{literal,Bs}]}, backward(Is, D, [Eq|Acc0]); false -> - I = {test,bs_start_match2,{f,To},Live,Args,Ctxt}, backward(Is, D, [I|Acc]) end; backward([{test,bs_start_match2,{f,To0},Live,[Src|_]=Info,Dst}|Is], D, Acc) -> -- cgit v1.2.3 From e35e6a94e57a651e4837c2391d5b1d3ac57c978b Mon Sep 17 00:00:00 2001 From: Erlang/OTP Date: Thu, 14 Jul 2016 11:22:49 +0200 Subject: Prepare release --- lib/compiler/doc/src/notes.xml | 17 +++++++++++++++++ lib/compiler/vsn.mk | 2 +- lib/stdlib/doc/src/notes.xml | 15 +++++++++++++++ lib/stdlib/vsn.mk | 2 +- 4 files changed, 34 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/compiler/doc/src/notes.xml b/lib/compiler/doc/src/notes.xml index e25cdc580c..92b3d809fc 100644 --- a/lib/compiler/doc/src/notes.xml +++ b/lib/compiler/doc/src/notes.xml @@ -32,6 +32,23 @@

This document describes the changes made to the Compiler application.

+
Compiler 7.0.1 + +
Fixed Bugs and Malfunctions + + +

+ A literal binary matching regression was introduced in + 19.0 where a match could fail to resolve to the right + clause. This has now been fixed.

+

+ Own Id: OTP-13738

+
+
+
+ +
+
Compiler 7.0
Fixed Bugs and Malfunctions diff --git a/lib/compiler/vsn.mk b/lib/compiler/vsn.mk index 23dd4bd4b1..334784657e 100644 --- a/lib/compiler/vsn.mk +++ b/lib/compiler/vsn.mk @@ -1 +1 @@ -COMPILER_VSN = 7.0 +COMPILER_VSN = 7.0.1 diff --git a/lib/stdlib/doc/src/notes.xml b/lib/stdlib/doc/src/notes.xml index ad2599c5a0..d8fec1147f 100644 --- a/lib/stdlib/doc/src/notes.xml +++ b/lib/stdlib/doc/src/notes.xml @@ -31,6 +31,21 @@

This document describes the changes made to the STDLIB application.

+
STDLIB 3.0.1 + +
Fixed Bugs and Malfunctions + + +

Correct a bug regarding typed records in the Erlang + shell. The bug was introduced in OTP-19.0.

+

+ Own Id: OTP-13719 Aux Id: ERL-182

+
+
+
+ +
+
STDLIB 3.0
Fixed Bugs and Malfunctions diff --git a/lib/stdlib/vsn.mk b/lib/stdlib/vsn.mk index 46e3ceac03..41037b8f53 100644 --- a/lib/stdlib/vsn.mk +++ b/lib/stdlib/vsn.mk @@ -1 +1 @@ -STDLIB_VSN = 3.0 +STDLIB_VSN = 3.0.1 -- cgit v1.2.3