@@ -52,7 +52,7 @@ defmodule Module.ParallelChecker do
52
52
# we discard their module map on purpose and start from file.
53
53
info =
54
54
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 ) }
56
56
else
57
57
cache_from_module_map ( table , module_map )
58
58
end
@@ -72,19 +72,25 @@ defmodule Module.ParallelChecker do
72
72
Process . link ( pid )
73
73
74
74
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 ) ,
81
84
{ :ok , { _ , [ debug_info: chunk ] } } <- :beam_lib . chunks ( binary , [ :debug_info ] ) ,
82
85
{ :debug_info_v1 , backend , data } = chunk ,
83
86
{ :ok , module_map } <- backend . debug_info ( :elixir_v1 , module , data , [ ] ) do
84
87
cache_from_module_map ( table , module_map )
85
88
else
86
89
_ -> nil
87
90
end
91
+
92
+ _ ->
93
+ info
88
94
end
89
95
90
96
send ( checker , { ref , :cached } )
@@ -557,9 +563,7 @@ defmodule Module.ParallelChecker do
557
563
end
558
564
559
565
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 } ) )
563
567
564
568
for { pid , ref } <- modules do
565
569
send ( pid , { ref , :cache } )
0 commit comments