@@ -100,36 +100,29 @@ end
100100
101101function decode (raw_results:: RawAllocResults ):: AllocResults
102102 cache = BacktraceCache ()
103+ @info " ALLOCS"
103104 allocs = [
104105 decode_alloc (cache, unsafe_load (raw_results. allocs, i))
105106 for i in 1 : raw_results. num_allocs
106107 ]
107108
109+ @info " FREES"
108110 frees = Dict {Type,UInt} ()
109111 for i in 1 : raw_results. num_frees
110112 free = unsafe_load (raw_results. frees, i)
111113 type = load_type (free. type)
112114 frees[type] = free. count
113115 end
114-
116+
115117 return AllocResults (
116118 allocs,
117119 frees
118120 )
119121end
120122
121- const f = Ref {IOStream} ()
122-
123- function __init__ ()
124- f[] = open (" debug.log" , " w" )
125- end
126-
127123function load_backtrace (trace:: RawBacktrace ):: Vector{Ptr{Cvoid}}
128- println (f[], " load_backtrace: trace.data: $(trace. data) " )
129- println (f[], " load_backtrace: trace.size: $(trace. size) " )
130124 out = Vector {Ptr{Cvoid}} ()
131125 for i in 1 : trace. size
132- println (f[], " $i " )
133126 push! (out, unsafe_load (trace. data, i))
134127 end
135128
@@ -158,4 +151,18 @@ function stacktrace_memoized(
158151 return stack
159152end
160153
154+ # Precompile once for the package cache,
155+ precompile (start, ())
156+ precompile (stop, ())
157+
158+ function __init__ ()
159+ # And once when loading the package, to get the full machine code precompiled.
160+ # TOOD: Although actually, we probably don't need this since this package will be
161+ # precompiled into the sysimg, so the top-level statements will be enough to get the
162+ # machine code codegen precompiled as well. :)
163+ # We can delete this function once we make this package a stdlib.
164+ precompile (start, ())
165+ precompile (stop, ())
166+ end
167+
161168end
0 commit comments