From 83cfc8c8414edc956d7e8e3a1402c17bf35421a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Wed, 29 Aug 2012 13:07:27 +0200 Subject: beam_receive: Optimize receives using refs created by spawn_monitor/{1,3} --- lib/compiler/test/receive_SUITE_data/ref_opt/no_4.erl | 12 ++++++++++++ lib/compiler/test/receive_SUITE_data/ref_opt/yes_12.erl | 12 ++++++++++++ lib/compiler/test/receive_SUITE_data/ref_opt/yes_13.erl | 12 ++++++++++++ 3 files changed, 36 insertions(+) create mode 100644 lib/compiler/test/receive_SUITE_data/ref_opt/no_4.erl create mode 100644 lib/compiler/test/receive_SUITE_data/ref_opt/yes_12.erl create mode 100644 lib/compiler/test/receive_SUITE_data/ref_opt/yes_13.erl (limited to 'lib/compiler/test') diff --git a/lib/compiler/test/receive_SUITE_data/ref_opt/no_4.erl b/lib/compiler/test/receive_SUITE_data/ref_opt/no_4.erl new file mode 100644 index 0000000000..3ce222176b --- /dev/null +++ b/lib/compiler/test/receive_SUITE_data/ref_opt/no_4.erl @@ -0,0 +1,12 @@ +-module(no_4). +-compile(export_all). + +?MODULE() -> + ok. + +f(X) -> + {Pid,Ref} = spawn_monitor(fun() -> ok end), + r(Pid, Ref). + +r(_, _) -> + ok. diff --git a/lib/compiler/test/receive_SUITE_data/ref_opt/yes_12.erl b/lib/compiler/test/receive_SUITE_data/ref_opt/yes_12.erl new file mode 100644 index 0000000000..efcfed6059 --- /dev/null +++ b/lib/compiler/test/receive_SUITE_data/ref_opt/yes_12.erl @@ -0,0 +1,12 @@ +-module(yes_12). +-compile(export_all). + +?MODULE() -> + ok. + +f() -> + {_,Ref} = spawn_monitor(fun() -> ok end), + receive + {'DOWN',Ref,_,_,Reason} -> + Reason + end. diff --git a/lib/compiler/test/receive_SUITE_data/ref_opt/yes_13.erl b/lib/compiler/test/receive_SUITE_data/ref_opt/yes_13.erl new file mode 100644 index 0000000000..9e93d12ed6 --- /dev/null +++ b/lib/compiler/test/receive_SUITE_data/ref_opt/yes_13.erl @@ -0,0 +1,12 @@ +-module(yes_13). +-compile(export_all). + +?MODULE() -> + ok. + +f() -> + {Pid,Ref} = spawn_monitor(fun() -> ok end), + receive + {'DOWN',Ref,process,Pid,Reason} -> + Reason + end. -- cgit v1.2.3