1
- isassign (frame) = isassign (frame, frame. pc)
2
- isassign (frame, pc) = (pc in frame. framecode. used)
1
+ isassign (frame:: Frame ) = isassign (frame, frame. pc)
2
+ isassign (frame:: Frame , pc:: Int ) = (pc in frame. framecode. used)
3
3
4
- lookup_var (frame, val:: SSAValue ) = frame. framedata. ssavalues[val. id]
5
- lookup_var (frame, ref:: GlobalRef ) = getfield (ref. mod, ref. name)
6
- function lookup_var (frame, slot:: SlotNumber )
4
+ lookup_var (frame:: Frame , val:: SSAValue ) = frame. framedata. ssavalues[val. id]
5
+ lookup_var (frame:: Frame , ref:: GlobalRef ) = getfield (ref. mod, ref. name)
6
+ function lookup_var (frame:: Frame , slot:: SlotNumber )
7
7
val = frame. framedata. locals[slot. id]
8
8
val != = nothing && return val. value
9
9
throw (UndefVarError (frame. framecode. src. slotnames[slot. id]))
@@ -51,7 +51,7 @@ macro lookup(args...)
51
51
end
52
52
end
53
53
54
- function lookup_expr (frame, e:: Expr )
54
+ function lookup_expr (frame:: Frame , e:: Expr )
55
55
head = e. head
56
56
head === :the_exception && return frame. framedata. last_exception[]
57
57
if head === :static_parameter
82
82
# and hence our re-use of the `callargs` field of Frame would introduce
83
83
# bugs. Since these nodes use a very limited repertoire of calls, we can special-case
84
84
# this quite easily.
85
- function lookup_or_eval (@nospecialize (recurse), frame, @nospecialize (node))
85
+ function lookup_or_eval (@nospecialize (recurse), frame:: Frame , @nospecialize (node))
86
86
if isa (node, SSAValue)
87
87
return lookup_var (frame, node)
88
88
elseif isa (node, SlotNumber)
@@ -130,7 +130,7 @@ function lookup_or_eval(@nospecialize(recurse), frame, @nospecialize(node))
130
130
return eval_rhs (recurse, frame, node)
131
131
end
132
132
133
- function resolvefc (frame, @nospecialize (expr))
133
+ function resolvefc (frame:: Frame , @nospecialize (expr))
134
134
if isa (expr, SlotNumber)
135
135
expr = lookup_var (frame, expr)
136
136
elseif isa (expr, SSAValue)
@@ -200,7 +200,7 @@ function evaluate_foreigncall(@nospecialize(recurse), frame::Frame, call_expr::E
200
200
end
201
201
202
202
# We have to intercept ccalls / llvmcalls before we try it as a builtin
203
- function bypass_builtins (@nospecialize (recurse), frame, call_expr, pc)
203
+ function bypass_builtins (@nospecialize (recurse), frame:: Frame , call_expr:: Expr , pc:: Int )
204
204
if isassigned (frame. framecode. methodtables, pc)
205
205
tme = frame. framecode. methodtables[pc]
206
206
if isa (tme, Compiled)
@@ -311,7 +311,7 @@ evaluate_call!(@nospecialize(recurse), frame::Frame, call_expr::Expr; kwargs...)
311
311
evaluate_call! (frame:: Frame , call_expr:: Expr ; kwargs... ) = evaluate_call! (finish_and_return!, frame, call_expr; kwargs... )
312
312
313
313
# The following come up only when evaluating toplevel code
314
- function evaluate_methoddef (frame, node)
314
+ function evaluate_methoddef (frame:: Frame , node:: Expr )
315
315
f = node. args[1 ]
316
316
if f isa Symbol || f isa GlobalRef
317
317
mod = f isa Symbol ? moduleof (frame) : f. mod
@@ -334,36 +334,7 @@ function evaluate_methoddef(frame, node)
334
334
return f
335
335
end
336
336
337
- function structname (frame, node)
338
- name = node. args[1 ]
339
- if isa (name, GlobalRef)
340
- mod = name. mod
341
- name = name. name
342
- else
343
- mod = moduleof (frame)
344
- name = name:: Symbol
345
- end
346
- return name, mod
347
- end
348
-
349
- function set_structtype_const (mod:: Module , name:: Symbol )
350
- dt = Base. unwrap_unionall (getfield (mod, name)):: DataType
351
- ccall (:jl_set_const , Cvoid, (Any, Any, Any), mod, dt. name. name:: Symbol , dt. name. wrapper)
352
- end
353
-
354
- function inplace_lookup! (ex, i, frame)
355
- a = ex. args[i]
356
- if isa (a, SSAValue) || isa (a, SlotNumber)
357
- ex. args[i] = lookup_var (frame, a)
358
- elseif isexpr (a, :call )
359
- for j = 1 : length ((a:: Expr ). args)
360
- inplace_lookup! (a, j, frame)
361
- end
362
- end
363
- return ex
364
- end
365
-
366
- function do_assignment! (frame, @nospecialize (lhs), @nospecialize (rhs))
337
+ function do_assignment! (frame:: Frame , @nospecialize (lhs), @nospecialize (rhs))
367
338
code, data = frame. framecode, frame. framedata
368
339
if isa (lhs, SSAValue)
369
340
data. ssavalues[lhs. id] = rhs
@@ -383,7 +354,7 @@ function do_assignment!(frame, @nospecialize(lhs), @nospecialize(rhs))
383
354
end
384
355
end
385
356
386
- function maybe_assign! (frame, @nospecialize (stmt), @nospecialize (val))
357
+ function maybe_assign! (frame:: Frame , @nospecialize (stmt), @nospecialize (val))
387
358
pc = frame. pc
388
359
if isexpr (stmt, :(= ))
389
360
lhs = stmt. args[1 ]
@@ -394,9 +365,9 @@ function maybe_assign!(frame, @nospecialize(stmt), @nospecialize(val))
394
365
end
395
366
return nothing
396
367
end
397
- maybe_assign! (frame, @nospecialize (val)) = maybe_assign! (frame, pc_expr (frame), val)
368
+ maybe_assign! (frame:: Frame , @nospecialize (val)) = maybe_assign! (frame, pc_expr (frame), val)
398
369
399
- function eval_rhs (@nospecialize (recurse), frame, node:: Expr )
370
+ function eval_rhs (@nospecialize (recurse), frame:: Frame , node:: Expr )
400
371
head = node. head
401
372
if head === :new
402
373
mod = moduleof (frame)
@@ -435,7 +406,7 @@ function eval_rhs(@nospecialize(recurse), frame, node::Expr)
435
406
return lookup_expr (frame, node)
436
407
end
437
408
438
- function check_isdefined (frame, @nospecialize (node))
409
+ function check_isdefined (frame:: Frame , @nospecialize (node))
439
410
data = frame. framedata
440
411
if isa (node, SlotNumber)
441
412
return data. locals[node. id] != = nothing
483
454
# in `step_expr!`
484
455
const _location = Dict {Tuple{Method,Int},Int} ()
485
456
486
- function step_expr! (@nospecialize (recurse), frame, @nospecialize (node), istoplevel:: Bool )
457
+ function step_expr! (@nospecialize (recurse), frame:: Frame , @nospecialize (node), istoplevel:: Bool )
487
458
pc, code, data = frame. pc, frame. framecode, frame. framedata
488
459
# if !is_leaf(frame)
489
460
# show_stackloc(frame)
@@ -657,7 +628,7 @@ behaviors:
657
628
`loc` is a `BreakpointRef`;
658
629
- otherwise, `err` gets rethrown.
659
630
"""
660
- function handle_err (@nospecialize (recurse), frame, err)
631
+ function handle_err (@nospecialize (recurse), frame:: Frame , @nospecialize ( err) )
661
632
data = frame. framedata
662
633
err_will_be_thrown_to_top_level = isempty (data. exception_frames) && ! data. caller_will_catch_err
663
634
if break_on_throw[] || (break_on_error[] && err_will_be_thrown_to_top_level)
0 commit comments