diff options
author | John Högberg <[email protected]> | 2018-07-18 12:21:42 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2018-07-18 12:21:42 +0200 |
commit | 64d7d7ab81e3c2163301a77969c75c6b73804d8b (patch) | |
tree | 88edc95a533a22ae5bf19a707c50817aa26de39c /erts/emulator/test/fun_SUITE.erl | |
parent | 0e9c319480d9cfb778b654bf2cd71e7bd31464f9 (diff) | |
parent | f31db22102bde44c6ee17bc756bdeb109855acea (diff) | |
download | otp-64d7d7ab81e3c2163301a77969c75c6b73804d8b.tar.gz otp-64d7d7ab81e3c2163301a77969c75c6b73804d8b.tar.bz2 otp-64d7d7ab81e3c2163301a77969c75c6b73804d8b.zip |
Merge pull request #1812 from michalmuskala/mm/make-fun-loader
Optimise creation of anonymous functions
Diffstat (limited to 'erts/emulator/test/fun_SUITE.erl')
-rw-r--r-- | erts/emulator/test/fun_SUITE.erl | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/erts/emulator/test/fun_SUITE.erl b/erts/emulator/test/fun_SUITE.erl index 73fe9b0d8f..f8a879182e 100644 --- a/erts/emulator/test/fun_SUITE.erl +++ b/erts/emulator/test/fun_SUITE.erl @@ -576,7 +576,7 @@ refc_dist(Config) when is_list(Config) -> process_flag(trap_exit, true), Pid = spawn_link(Node, fun() -> receive Fun when is_function(Fun) -> - 2 = fun_refc(Fun), + 3 = fun_refc(Fun), exit({normal,Fun}) end end), F = fun() -> 42 end, @@ -598,7 +598,7 @@ refc_dist_send(Node, F) -> Pid = spawn_link(Node, fun() -> receive {To,Fun} when is_function(Fun) -> wait_until(fun () -> - 2 =:= fun_refc(Fun) + 3 =:= fun_refc(Fun) end), To ! Fun end @@ -626,7 +626,7 @@ refc_dist_reg_send(Node, F) -> Me ! Ref, receive {Me,Fun} when is_function(Fun) -> - 2 = fun_refc(Fun), + 3 = fun_refc(Fun), Me ! Fun end end), @@ -806,11 +806,13 @@ verify_not_undef(Fun, Tag) -> ct:fail("tag ~w not defined in fun_info", [Tag]); {Tag,_} -> ok end. - + id(X) -> X. spawn_call(Node, AFun) -> + Parent = self(), + Init = erlang:whereis(init), Pid = spawn_link(Node, fun() -> receive @@ -821,8 +823,10 @@ spawn_call(Node, AFun) -> _ -> lists:seq(0, Arity-1) end, Res = apply(Fun, Args), - {pid,Creator} = erlang:fun_info(Fun, pid), - Creator ! {result,Res} + case erlang:fun_info(Fun, pid) of + {pid,Init} -> Parent ! {result,Res}; + {pid,Creator} -> Creator ! {result,Res} + end end end), Pid ! {AFun,AFun,AFun}, |