diff --git a/Makefile b/Makefile index e3651bddee..9e263cf30b 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,7 @@ SHARE_PREFIX ?= $(PREFIX)/share MAN_PREFIX ?= $(SHARE_PREFIX)/man CANONICAL := main/ ELIXIRC := bin/elixirc --ignore-module-conflict $(ELIXIRC_OPTS) +ELIXIRC_MIN_SIG := $(ELIXIRC) -e 'Code.put_compiler_option :infer_signatures, []' ERLC := erlc -I lib/elixir/include ERL_MAKE := erl -make ERL := erl -I lib/elixir/include -noshell -pa lib/elixir/ebin @@ -97,7 +98,7 @@ $(KERNEL): lib/elixir/src/* lib/elixir/lib/*.ex lib/elixir/lib/*/*.ex lib/elixir "$(MAKE)" unicode; \ fi @ echo "==> elixir (compile)"; - $(Q) cd lib/elixir && ../../$(ELIXIRC) "lib/**/*.ex" -o ebin; + $(Q) cd lib/elixir && ../../$(ELIXIRC_MIN_SIG) "lib/**/*.ex" -o ebin; $(APP): lib/elixir/src/elixir.app.src lib/elixir/ebin VERSION $(GENERATE_APP) $(Q) $(GENERATE_APP) $(VERSION) @@ -105,9 +106,9 @@ $(APP): lib/elixir/src/elixir.app.src lib/elixir/ebin VERSION $(GENERATE_APP) unicode: $(UNICODE) $(UNICODE): lib/elixir/unicode/* @ echo "==> unicode (compile)"; - $(Q) $(ELIXIRC) lib/elixir/unicode/unicode.ex -o lib/elixir/ebin; - $(Q) $(ELIXIRC) lib/elixir/unicode/tokenizer.ex -o lib/elixir/ebin; - $(Q) $(ELIXIRC) lib/elixir/unicode/security.ex -o lib/elixir/ebin; + $(Q) $(ELIXIRC_MIN_SIG) lib/elixir/unicode/unicode.ex -o lib/elixir/ebin; + $(Q) $(ELIXIRC_MIN_SIG) lib/elixir/unicode/tokenizer.ex -o lib/elixir/ebin; + $(Q) $(ELIXIRC_MIN_SIG) lib/elixir/unicode/security.ex -o lib/elixir/ebin; $(eval $(call APP_TEMPLATE,ex_unit,ExUnit)) $(eval $(call APP_TEMPLATE,logger,Logger)) diff --git a/lib/elixir/lib/module/parallel_checker.ex b/lib/elixir/lib/module/parallel_checker.ex index 894051f09f..8e8e4d9d04 100644 --- a/lib/elixir/lib/module/parallel_checker.ex +++ b/lib/elixir/lib/module/parallel_checker.ex @@ -71,7 +71,7 @@ defmodule Module.ParallelChecker do {^ref, :cache} -> Process.link(pid) - module_tuple = + {mode, module_tuple} = cond do is_binary(info) -> location = @@ -86,13 +86,15 @@ defmodule Module.ParallelChecker do {:ok, module_map} <- backend.debug_info(:elixir_v1, module, data, []) do cache_from_module_map(table, module_map) else - _ -> nil + _ -> {:not_found, nil} end is_tuple(info) -> info end + # We only make the module available now, so they are not visible during inference + :ets.insert(table, {module, mode}) send(checker, {ref, :cached}) receive do @@ -416,21 +418,22 @@ defmodule Module.ParallelChecker do true -> {mode, exports} = info_exports(module) deprecated = info_deprecated(module) - cache_info(table, module, exports, deprecated, %{}, mode) + cache_info(table, module, exports, deprecated, %{}) + mode false -> # Or load exports from chunk with {^module, binary, _filename} <- object_code, {:ok, {^module, [exports: exports]}} <- :beam_lib.chunks(binary, [:exports]) do - cache_info(table, module, exports, %{}, %{}, :erlang) + cache_info(table, module, exports, %{}, %{}) + :erlang else - _ -> - :ets.insert(table, {module, :not_found}) - nil + _ -> :not_found end end end + :ets.insert(table, {module, mode}) unlock(checker, module, mode) end end @@ -461,26 +464,15 @@ defmodule Module.ParallelChecker do behaviour_exports(map) ++ for({function, :def, _meta, _clauses} <- map.definitions, do: function) - cache_info( - table, - map.module, - exports, - Map.new(map.deprecated), - map.signatures, - elixir_mode(map.attributes) - ) - - module_map_to_module_tuple(map) + cache_info(table, map.module, exports, Map.new(map.deprecated), map.signatures) + {elixir_mode(map.attributes), module_map_to_module_tuple(map)} end - defp cache_info(table, module, exports, deprecated, sigs, mode) do + defp cache_info(table, module, exports, deprecated, sigs) do Enum.each(exports, fn fa -> reason = Map.get(deprecated, fa) :ets.insert(table, {{module, fa}, reason, Map.get(sigs, fa, :none)}) end) - - :ets.insert(table, {module, mode}) - mode end defp cache_chunk(table, module, contents) do @@ -497,9 +489,7 @@ defmodule Module.ParallelChecker do ) end) - mode = Map.get(contents, :mode, :elixir) - :ets.insert(table, {module, mode}) - mode + Map.get(contents, :mode, :elixir) end defp behaviour_exports(%{defines_behaviour: true}), do: [{:behaviour_info, 1}]