## runtime-internals.pkg
#
# This package (lib7::internals) is a gathering place for internal
# features that need to be exposed outside the boot directory.
# Compiled by:
#
src/lib/std/src/standard-core.sublibstipulate
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 isg = interprocess_signals_guts; # interprocess_signals_guts is from
src/lib/std/src/nj/interprocess-signals-guts.pkgherein
package runtime_internals
: (weak) Runtime_Internals # Runtime_Internals is from
src/lib/std/src/nj/runtime-internals.api {
# Export to client packages:
#
package at = run_at__premicrothread; # run_at__premicrothread is from
src/lib/std/src/nj/run-at--premicrothread.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 = isg::initialize_posix_interprocess_signal_handler_table;
clear_posix_interprocess_signal_handler_table = isg::clear_posix_interprocess_signal_handler_table;
reset_posix_interprocess_signal_handler_table = isg::reset_posix_interprocess_signal_handler_table;
fun reset_cpu_and_wallclock_timers ()
=
{ iwt::reset_timer ();
ict::reset_timer ();
};
my _ =
at::schedule
(
"runtime-internals: reset cpu and wallclock timers", # Arbitrary string label.
[ at::STARTUP_PHASE_9_RESET_CPU_AND_WALLCLOCK_TIMERS ], # When to run the function.
\\ _ = { reset_cpu_and_wallclock_timers(); } # Function to run. Ignored arg is at::STARTUP_PHASE_9_RESET_CPU_AND_WALLCLOCK_TIMERS.
);
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, \\ () = loop rest);
end;
end;
};
};
end;
## COPYRIGHT (c) 1996 AT&T Research.
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2015,
## released per terms of SMLNJ-COPYRIGHT.