anchor.diff:  %% stacktraces.
   %% ---------------------------------------------------
   
  -try_dispatch({'$gen_cast', Msg}, Mod, State) ->
  -    try_dispatch(Mod, handle_cast, Msg, State);
  -try_dispatch(Info, Mod, State) ->
  -    try_dispatch(Mod, handle_info, Info, State).
  -
  -try_dispatch(Mod, Func, Msg, State) ->
  +try_dispatch({'$gen_cast', Msg}, CbCache, State) ->
  +    try_handle_cast(CbCache, Msg, State);
  +try_dispatch(Info, CbCache, State) ->
  +    try_handle_info(CbCache, Info, State).
  +
  +try_handle_continue(#callback_cache{module = Mod}, Msg, State) ->
       try
  -	{ok, Mod:Func(Msg, State)}
  +        {ok, Mod:handle_continue(Msg, State)}
       catch
  -	throw:R ->
  -	    {ok, R};
  -        error:undef = R:Stacktrace when Func == handle_info ->
  +        throw:R ->
  +            {ok, R};
  +        Class:R:Stacktrace ->
  +            {'EXIT', Class, R, Stacktrace}
  +    end.
  +
  +try_handle_info(#callback_cache{module = Mod, handle_info = HandleInfo}, Msg, State) ->
  +    try
  +        {ok, HandleInfo(Msg, State)}
  +    catch
  +        throw:R ->
  +            {ok, R};
  +        error:undef = R:Stacktrace ->
               case erlang:function_exported(Mod, handle_info, 2) of
                   false ->
                       ?LOG_WARNING(
  -                       #{label=>{gen_server,no_handle_info},
  -                         module=>Mod,
  -                         message=>Msg},
  -                       #{domain=>[otp],
  -                         report_cb=>fun gen_server:format_log/2,
  -                         error_logger=>
  -                             #{tag=>warning_msg,
  -                               report_cb=>fun gen_server:format_log/1}}),
  +                    #{label=>{gen_server,no_handle_info},
  +                        module=>Mod,
  +                        message=>Msg},
  +                    #{domain=>[otp],
  +                        report_cb=>fun gen_server:format_log/2,
  +                        error_logger=>
  +                            #{tag=>warning_msg,
  +                            report_cb=>fun gen_server:format_log/1}}),
                       {ok, {noreply, State}};
                   true ->
                       {'EXIT', error, R, Stacktrace}
               end;
  -	Class:R:Stacktrace ->
  -	    {'EXIT', Class, R, Stacktrace}
  -    end.
  -
  -try_handle_call(Mod, Msg, From, State) ->
  +        Class:R:Stacktrace ->
  +            {'EXIT', Class, R, Stacktrace}
  +    end.
  +
  +try_handle_cast(#callback_cache{handle_cast = HandleCast}, Msg, State) ->
       try
  -	{ok, Mod:handle_call(Msg, From, State)}
  +        {ok, HandleCast(Msg, State)}
       catch
  -	throw:R ->
  -	    {ok, R};
  -	Class:R:Stacktrace ->
  -	    {'EXIT', Class, R, Stacktrace}
  +        throw:R ->
  +            {ok, R};
  +        Class:R:Stacktrace ->
  +            {'EXIT', Class, R, Stacktrace}
  +    end.
  +
  +try_handle_call(#callback_cache{handle_call = HandleCall}, Msg, From, State) ->
  +    try
  +        {ok, HandleCall(Msg, From, State)}
  +    catch
  +        throw:R ->
  +            {ok, R};
  +        Class:R:Stacktrace ->
  +            {'EXIT', Class, R, Stacktrace}
       end.
   
   try_terminate(Mod, Reason, State) ->
       case erlang:function_exported(Mod, terminate, 2) of
  -	true ->
  -	    try
  -		{ok, Mod:terminate(Reason, State)}
  -	    catch
  -		throw:R ->
  -		    {ok, R};
  -		Class:R:Stacktrace ->
  -		    {'EXIT', Class, R, Stacktrace}
  -	   end;
  -	false ->
  -	    {ok, ok}
  +        true ->
  +            try
  +                {ok, Mod:terminate(Reason, State)}
  +            catch
  +                throw:R ->
  +                    {ok, R};
  +                Class:R:Stacktrace ->
  +                    {'EXIT', Class, R, Stacktrace}
  +            end;
  +        false ->
  +            {ok, ok}
       end.
   
   
  
positive.code:     Parent = gen:get_parent(),
      Debug = gen:debug_options(Name, Options),
      HibernateAfterTimeout = gen:hibernate_after(Options),
      loop(Parent, Name, State, Mod, TimeoutOrHibernate, HibernateAfterTimeout, Debug);
  %%
  enter_loop(Mod, Options, State, ServerName, {continue, _}=Continue)
    when is_atom(Mod), is_list(Options) ->
  
negative.code: %%% The MAIN loop.
  %%% ---------------------------------------------------
  
  loop(Parent, Name, State, CbCache, {continue, Continue} = Msg, HibernateAfterTimeout, Debug) ->
      Reply = try_handle_continue(CbCache, Continue, State),
      case Debug of
          [] ->
              handle_common_reply(Reply, Parent, Name, undefined, Msg, CbCache,
                                  HibernateAfterTimeout, State);
          _ ->
              Debug1 = sys:handle_debug(Debug, fun print_event/3, Name, Msg),
              handle_common_reply(Reply, Parent, Name, undefined, Msg, CbCache,
                                  HibernateAfterTimeout, State, Debug1)
      end;
  
  loop(Parent, Name, State, CbCache, hibernate, HibernateAfterTimeout, Debug) ->
      Mod = CbCache#callback_cache.module,
      proc_lib:hibernate(?MODULE,wake_hib,[Parent, Name, State, Mod, HibernateAfterTimeout, Debug]);
  
  loop(Parent, Name, State, CbCache, infinity, HibernateAfterTimeout, Debug) ->
      receive
          Msg ->
              decode_msg(Msg, Parent, Name, State, CbCache, infinity, HibernateAfterTimeout, Debug, false)
      after HibernateAfterTimeout ->
              loop(Parent, Name, State, CbCache, hibernate, HibernateAfterTimeout, Debug)
      end;
  
  loop(Parent, Name, State, CbCache, Time, HibernateAfterTimeout, Debug) ->
      Msg = receive
                Input ->
                    Input
            after Time ->
                    timeout
            end,
      decode_msg(Msg, Parent, Name, State, CbCache, Time, HibernateAfterTimeout, Debug, false).
  
  -spec create_callback_cache(module()) -> #callback_cache{}.
  create_callback_cache(Mod) ->
      #callback_cache{module = Mod,
                      handle_call = fun Mod:handle_call/3,
                      handle_cast = fun Mod:handle_cast/2,
                      handle_info = fun Mod:handle_info/2}.
  
  wake_hib(Parent, Name, State, Mod, HibernateAfterTimeout, Debug) ->
      Msg = receive
                Input ->
                    Input
            end,
      CbCache = create_callback_cache(Mod),
      decode_msg(Msg, Parent, Name, State, CbCache, hibernate, HibernateAfterTimeout, Debug, true).
  
  decode_msg(Msg, Parent, Name, State, CbCache, Time, HibernateAfterTimeout, Debug, Hib) ->
      case Msg of
          {system, From, Req} ->
              sys:handle_system_msg(Req, From, Parent, ?MODULE, Debug,
                                    [Name, State, CbCache, Time, HibernateAfterTimeout], Hib);
          {'EXIT', Parent, Reason} ->
              #callback_cache{module = Mod} = CbCache,
              terminate(Reason, ?STACKTRACE(), Name, undefined, Msg, Mod, State, Debug);
          _Msg when Debug =:= [] ->
              handle_msg(Msg, Parent, Name, State, CbCache, HibernateAfterTimeout);
          _Msg ->
              Debug1 = sys:handle_debug(Debug, fun print_event/3,
                                        Name, {in, Msg}),
              handle_msg(Msg, Parent, Name, State, CbCache, HibernateAfterTimeout, Debug1)
      end.
  
  %%% ---------------------------------------------------
  