@@ -52,7 +52,7 @@ defmodule Module.ParallelChecker do
5252 # we discard their module map on purpose and start from file.
5353 info =
5454 if beam_location != [ ] and Keyword . has_key? ( module_map . attributes , :__protocol__ ) do
55- List . to_string ( beam_location )
55+ { module , List . to_string ( beam_location ) }
5656 else
5757 cache_from_module_map ( table , module_map )
5858 end
@@ -72,19 +72,25 @@ defmodule Module.ParallelChecker do
7272 Process . link ( pid )
7373
7474 module_tuple =
75- cond do
76- is_tuple ( info ) ->
77- info
78-
79- is_binary ( info ) ->
80- with { :ok , binary } <- File . read ( info ) ,
75+ case info do
76+ { module , location } ->
77+ location =
78+ case :code . which ( module ) do
79+ [ _ | _ ] = path -> path
80+ _ -> location
81+ end
82+
83+ with { :ok , binary } <- File . read ( location ) ,
8184 { :ok , { _ , [ debug_info: chunk ] } } <- :beam_lib . chunks ( binary , [ :debug_info ] ) ,
8285 { :debug_info_v1 , backend , data } = chunk ,
8386 { :ok , module_map } <- backend . debug_info ( :elixir_v1 , module , data , [ ] ) do
8487 cache_from_module_map ( table , module_map )
8588 else
8689 _ -> nil
8790 end
91+
92+ _ ->
93+ info
8894 end
8995
9096 send ( checker , { ref , :cached } )
@@ -557,9 +563,7 @@ defmodule Module.ParallelChecker do
557563 end
558564
559565 def handle_call ( :start , _from , % { modules: modules , protocols: protocols , table: table } = state ) do
560- for protocol <- protocols do
561- :ets . delete ( table , protocol )
562- end
566+ :ets . insert ( table , Enum . map ( protocols , & { & 1 , :uncached } ) )
563567
564568 for { pid , ref } <- modules do
565569 send ( pid , { ref , :cache } )
0 commit comments