@@ -18,16 +18,15 @@ f(x, y) = x + y
18
18
19
19
# Cthulhu's inner loop
20
20
function cthulhu (ref:: Reflection )
21
- callsites = Callsite[]
22
21
23
- invokes = filter ((c)-> lookthrough (identify_invoke, c), ref. CI. code)
24
- calls = filter ((c)-> lookthrough (identify_call, c), ref. CI. code)
22
+ invokes = filter ((c)-> lookthrough (identify_invoke, c), ref. CI. code)
23
+ calls = filter ((c)-> lookthrough (identify_call, c), ref. CI. code)
25
24
26
25
invokes = map ((arg) -> process_invoke (DefaultConsumer (), ref, arg... ), invokes)
27
- append! (callsites, invokes )
28
- calls = map ((arg) -> process_call ( DefaultConsumer (), ref, arg ... ), calls)
29
- append! (callsites , calls)
30
-
26
+ calls = map ((arg) -> process_call ( DefaultConsumer (), ref, arg ... ), calls )
27
+
28
+ callsites = append! (invokes , calls)
29
+ @show callsites
31
30
sort! (callsites, by= (c)-> c. id)
32
31
return callsites
33
32
end
@@ -50,3 +49,24 @@ ref = reflect(h, Tuple{Int}, params=params)
50
49
calls = cthulhu (ref)
51
50
nextrefs = collect (reflect (c) for c in calls if TypedCodeUtils. canreflect (c))
52
51
52
+ if VERSION >= v " 1.1.0-DEV.215" && Base. JLOptions (). check_bounds == 0
53
+ Base. @propagate_inbounds function f (x)
54
+ @boundscheck error ()
55
+ end
56
+ g (x) = @inbounds f (x)
57
+
58
+ params = TypedCodeUtils. current_params ()
59
+ ref = reflect (g, Tuple{Vector{Float64}}, params= params)
60
+ @show ref. CI. code
61
+ calls = cthulhu (ref)
62
+ @test ! isempty (calls)
63
+
64
+ TypedCodeUtils. preprocess! (DefaultConsumer (), ref, true )
65
+ calls = cthulhu (ref)
66
+ @test isempty (calls)
67
+
68
+ end
69
+
70
+
71
+
72
+
0 commit comments