From f928756b2b7f26b90d962cc038d4ba68619c1bf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Mon, 13 Feb 2012 09:45:22 +0100 Subject: compiler: Teach the inliner to preserve on_load functions The inliner was ignorant of on_load functions and would discard them (unless they were exported or referenced). Noticed-by: Yiannis Tsiouris --- .../test/compilation_SUITE_data/on_load_inline.erl | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 lib/compiler/test/compilation_SUITE_data/on_load_inline.erl (limited to 'lib/compiler/test/compilation_SUITE_data/on_load_inline.erl') diff --git a/lib/compiler/test/compilation_SUITE_data/on_load_inline.erl b/lib/compiler/test/compilation_SUITE_data/on_load_inline.erl new file mode 100644 index 0000000000..322843b61e --- /dev/null +++ b/lib/compiler/test/compilation_SUITE_data/on_load_inline.erl @@ -0,0 +1,23 @@ +-module(on_load_inline). +-export([?MODULE/0]). +-on_load(on_load/0). +-compile(inline). + +?MODULE() -> + [{pid,Pid}] = ets:lookup(on_load_executed, pid), + exit(Pid, kill), + ok. + +on_load() -> + Parent = self(), + spawn(fun() -> + T = ets:new(on_load_executed, [named_table]), + ets:insert(T, {pid,self()}), + Parent ! done, + receive + wait_forever -> ok + end + end), + receive + done -> ok + end. -- cgit v1.2.3