PreviousUpNext

15.4.1094  src/lib/std/src/nj/runtime-internals.pkg

## runtime-internals.pkg

# Compiled by:
#     src/lib/std/src/standard-core.sublib

# This package (lib7::internals) is a gathering place for internal
# features that need to be exposed outside the boot directory.

stipulate
    package cor =  core;                                                        # core                          is from   src/lib/core/init/core.pkg
    package ict =  internal_cpu_timer;                                          # internal_cpu_timer            is from   src/lib/std/src/internal-cpu-timer.pkg
    package iwt =  internal_wallclock_timer;                                    # internal_wallclock_timer      is from   src/lib/std/src/internal-wallclock-timer.pkg
    package rsg =  runtime_signals_guts;                                        # runtime_signals_guts          is from   src/lib/std/src/nj/runtime-signals-guts.pkg
herein

    package   runtime_internals
    : (weak)  Runtime_Internals                                                 # Runtime_Internals             is from   src/lib/std/src/nj/runtime-internals.api
    {
        # Export to client packages:
        #
        package at  =   at;                                                     # at                            is from   src/lib/std/src/nj/at.pkg
        package rpc =   runtime_profiling_control;                              # runtime_profiling_control     is from   src/lib/std/src/nj/runtime-profiling-control.pkg
        package hc  =   heapcleaner_control;                                    # heapcleaner_control           is from   src/lib/std/src/nj/heapcleaner-control.pkg

        print_hook = print_hook::print_hook;

        initialize_posix_interprocess_signal_handler_table  =   rsg::initialize_posix_interprocess_signal_handler_table;
        clear_posix_interprocess_signal_handler_table       =   rsg::clear_posix_interprocess_signal_handler_table;
        reset_posix_interprocess_signal_handler_table       =   rsg::reset_posix_interprocess_signal_handler_table;

        fun reset_timers ()
            =
            {   iwt::reset_timer ();
                ict::reset_timer ();
            };


        package tdp {                                                           # "tdp" == "tracing, debugging and profiling".
            #
            Plugin = cor::Tdp_Plugin;

            Monitor
              =
              { name:           String,
                monitor:        (Bool, (Void -> Void)) -> Void
              };

            active_plugins = cor::tdp_active_plugins;                           # active_plugins is referenced (only) in:
                                                                                # 
                                                                                #     src/app/debug/back-trace.pkg:         addto  runtime_internals::tdp::active_plugins   plugin;
                                                                                #     src/app/debug/test-coverage.pkg:      addto tdp::active_plugins plugin;

            active_monitors = REF ([]:  List(Monitor));                         # active_monitors is referenced (only) below and in
                                                                                #
                                                                                #     src/app/debug/back-trace.pkg

            fun reserve n =   cor::tdp_reserve n;
            fun reset ()  =   cor::tdp_reset ();

            idk_entry_point   =   cor::tdp_idk_entry_point;                     # "idk" == "id_kind".
            idk_tail_call     =   cor::tdp_idk_tail_call;
            idk_non_tail_call =   cor::tdp_idk_non_tail_call;

            tdp_instrument_enabled = REF FALSE; # This controls code generation in tdp_instrument       # tdp_instrument                is from   src/lib/compiler/debugging-and-profiling/profiling/tdp-instrument.pkg

            fun with_monitors  report_final_exception  work
                =
                loop *active_monitors
                where
                    fun loop []                          =>   work ();
                        loop ( { name, monitor } ! rest) =>   monitor (report_final_exception,  fn () = loop rest);
                    end;
                end;
        };
    };
end;



## COPYRIGHT (c) 1996 AT&T Research.
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2011,
## released under Gnu Public Licence version 3.


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext