@@ -198,14 +198,14 @@ const silence_pkgs = Set{Symbol}()
198198const  depsdir =  joinpath (dirname (@__DIR__ ), " deps" 
199199const  silencefile =  Ref (joinpath (depsdir, " silence.txt" #  Ref so that tests don't clobber
200200
201- # """
202- #     Revise.worldage
203- # 
204- # The world age Revise was started in. Needed so that Revise doesn't delete methods
205- # from under itself.
206- # """
207- # const worldage = Ref{Union{Nothing,UInt}}(nothing)
208- using  CodeTracking:  worldage
201+ """ 
202+     Revise.worldage 
203+ 
204+ The world age Revise was started in. Needed so that Revise doesn't delete methods 
205+ from under itself. 
206+ """ 
207+ const  worldage =  Ref {Union{Nothing,UInt}} (nothing )
208+ # using CodeTracking: worldage
209209
210210# #
211211# # The inputs are sets of expressions found in each file.
@@ -639,6 +639,7 @@ function handle_deletions(pkgdata, file)
639639    topmod =  first (keys (mexsold))
640640    fileok =  file_exists (filep)
641641    mexsnew =  fileok ?  parse_source (filep, topmod) :  ModuleExprsSigs (topmod)
642+     worldage[] =  Base. get_world_counter ()
642643    if  mexsnew != =  nothing 
643644        delete_missing! (mexsold, mexsnew)
644645    end 
@@ -732,6 +733,7 @@ function revise(; throw=false)
732733
733734    #  Do all the deletion first. This ensures that a method that moved from one file to another
734735    #  won't get redefined first and deleted second.
736+     @show  worldage[] =  Base. get_world_counter ()
735737    revision_errors =  []
736738    queue =  sort! (collect (revision_queue); lt= pkgfileless)
737739    finished =  eltype (revision_queue)[]
@@ -764,6 +766,7 @@ function revise(; throw=false)
764766                mode ∈  (:sigs , :eval , :evalmeth , :evalassign ) ||  error (" unsupported mode " 
765767                exsold =  get (fi. modexsigs, mod, empty_exs_sigs)
766768                for  rex in  keys (exsnew)
769+                     @show  Base. get_world_counter ()
767770                    sigs, includes =  eval_rex (rex, exsold, mod; mode= mode)
768771                    if  sigs != =  nothing 
769772                        exsnew[rex] =  sigs
@@ -1191,13 +1194,17 @@ if VERSION < v"1.6.0-DEV.1162"
11911194    const  lower_in_reviseworld =  Meta. lower
11921195else 
11931196    function  invoke_revisefunc (f, args... ; kwargs... )
1194-         @show  worldage[]
1195-         Base. show_backtrace (backtrace[1 : 2 ])
1197+         # @show worldage[]
1198+         # @show Base.get_world_counter()
1199+         # Base.show_backtrace(stdout, backtrace()[1:4])
1200+         # println()
11961201        return  Base. invoke_in_world (worldage[], f, args... ; kwargs... )
11971202    end 
11981203    function  lower_in_reviseworld (m:: Module , @nospecialize (ex))
1199-         @show  worldage[]
1200-         Base. show_backtrace (backtrace[1 : 2 ])
1204+         # @show worldage[]
1205+         # @show Base.get_world_counter()
1206+         # Base.show_backtrace(stdout, backtrace()[1:1])
1207+         # println()
12011208        return  ccall (:jl_expand_in_world , Any,
12021209            (Any, Ref{Module}, Cstring, Cint, Csize_t),
12031210            ex, m, " none" 0 , worldage[],
@@ -1209,7 +1216,7 @@ end
12091216#  This uses invokelatest not for reasons of world age but to ensure that the call is made at runtime.
12101217#  This allows `revise_first` to be compiled without compiling `revise` itself, and greatly
12111218#  reduces the overhead of using Revise.
1212- revise_first (ex) =  Expr (:toplevel , :(isempty ($ revision_queue) ||  (worldage[] =  Base. get_world_counter (); invoke_revisefunc ($ revise))), ex)
1219+ revise_first (ex) =  Expr (:toplevel , :(isempty ($ revision_queue) ||  (#= worldage[] = Base.get_world_counter(); =# invoke_revisefunc ($ revise))), ex)
12131220
12141221@noinline  function  run_backend (backend)
12151222    while  true 
@@ -1362,6 +1369,8 @@ function __init__()
13621369    #  Set the lookup callbacks
13631370    CodeTracking. method_lookup_callback[] =  x ->  (worldage[] =  Base. get_world_counter (); invoke_revisefunc (get_def, x))
13641371    CodeTracking. expressions_callback[] =  x ->  (worldage[] =  Base. get_world_counter (); invoke_revisefunc (get_expressions, x))
1372+     CodeTracking. method_lookup_callback[] =  get_def
1373+     CodeTracking. expressions_callback[] =  get_expressions
13651374
13661375    #  Watch the manifest file for changes
13671376    mfile =  manifest_file ()
0 commit comments