Most variables of the Runtime
class are not public
, since they can
be accessed by simply inheriting Runtime
.
static String hostname;
static public String program_name;
static String long_program_name;
static Array arguments;
main
.
static Array all_arguments;
load
method modified it.
static Mapped environment;
static private ByteString main_resource_dir;
static private MutableMapped classes_by_name;
classes_by_name
method.
static private int quit_inhibit;
SIGINT
, the user interrupt signal) is inhibited.
static boolean quit_pending;
signal-int
will be raised when quit_inhibit
and
panic_mode
again reach 0.
static int panic_mode;
panic_mode
is set, quit_inhibit
is implicitly set too.
static boolean core_on_fatal;
TRUE
, a corefile will be produced on fatal errors, such as
uncaught condition raises.
static int gc_alloc_since_partial;
static int gc_alloc_since_total;
gc_alloc_since_partial
; it is
adjusted after a run is initiated, before the run is actually
started.
static boolean gc_stat_at_exit;
TRUE
statistics on memory usage and the garbage collector
will be emitted upon exit.
static boolean rt_stat_at_exit;
TRUE
output statistics on the runtime structures at exit.
static boolean rt_num_inst_at_exit;
TRUE
output the number of live instances of each class at
exit.
static int gc_num_runs;
static int gc_num_complete;
static long gc_num_alloc;
static long gc_num_dealloc;
static double gc_total_protect;
static double gc_total_mark;
static double gc_total_sweep;
static double gc_total_all;
static int malloc_cur_bytes;
static int malloc_max_bytes;
static int malloc_cum_bytes;
static int malloc_cur_items;
static int malloc_max_items;
static int malloc_cum_items;
static int gc_inhibit;
static boolean gc_atomic;
TRUE
, garbage collection will run atomically (with all its
consequences), irrespective of the time constraint argument to
garbageCollect
. The default value is FALSE
.
static boolean gc_full_at_exit;
TRUE
all garbage will be cleaned upon exit. This is a
debugging tool mostly.
static int gc_debug;
stderr
stream provided by the C library.
No information will be output if gc_debug
is 0 or if the runtime
was not compiled with the appropriate flags.
static int gc_partial_threshold;
gc_alloc_since_partial
before a garbage collection
run will be initiated. If gc_partial_threshold
is 0 (the default
value), garbage collection is never run implicitly.
static double gc_partial_time_limit;
gc_alloc_since_partial
exceeding
gc_partial_threshold
.
static int gc_total_threshold;
gc_alloc_since_total
exceeds gc_total_threshold
, the
gc_partial_time_limit
is ignored and instead the
gc_total_time_limit
is used. If gc_total_threshold
is 0 (the
default value), it is ignored.
static double gc_total_time_limit;
gc_total_threshold
applies.
static boolean preconditions_enabled;
TRUE
, preconditions are checked.
static boolean postconditions_enabled;
TRUE
, postconditions are checked.
static boolean rt_print_signals;
TRUE
, unhandled signals are printed on [stdio err]
. This
is for debugging purposes.
int start (All, selector) (object, sel) arguments Array arguments;
sel
and object
.
void exit int rc;
void fastExit int rc;
void unhandledSignal Condition condition;
condition
on [stdio
err]
.
void willExit int rc;
:gc-exit
, dumps gc statistics if
specified by :gc-stat
, number of instances if specified by
:rt-inst
, and memory overhead information if specified by
:rt-stat
.
OutputStream help OutputStream s done MutableKeyed done;
OutputStream
s.
Any implementation should add itself to the set done
, and check for
presence before outputting anything, to avoid generating the same
output for every subclass not overriding this method.
void load MutableArray arguments;
See the output of :help
of any TOM program for short information on
the options.
void preload MutableArray arguments;
This method is needed for two occasions: first is to check for
:help
. The reason this is not done in load
is to be able to get
some help before any negative side effects of any load
method. The
second reason is for finding :rt-resource-dir
, which must be done
before ByteString
's load
method can play with its encoding.
void reportNumInstances OutputStream s includeZeroes: boolean zeroes = FALSE;
s
the number of live instances for each
class. If the optional zeroes
is TRUE
, classes with zero
instances are included in the report. This includes deferred classes,
as they cannot have any instances.
protected void runtimeStatistics OutputStream s;
:rt-stat
to the stream s
.
Indexed classes;
Mapped classes_by_name;
class (State) (class_object) classNamed String name;
name
.
Name may be unqualified, as in "Runtime"
, which will return the
single class with that name, or nil
in case such a class does not
exist, or if more than one class with that name exists in multiple
units.
The name
may be qualified, as in "tom.Runtime"
, in which case the
Runtime
class of the tom
unit will be returned, if that unit and
class within that unit exist.
selector selectorNamed String name;
name
.
boolean selector selector s1 equals selector s2;
TRUE
iff the selectors s1
and s2
denote the same
selector.
String nameOfSelector selector sel;
selector
.
selector nullSelector;
void garbageCollect;
void garbageCollect double time pre gc_atomic -> !time;
time
seconds.
void disableGC pre gc_inhibit >= 0 post gc_inhibit == old gc_inhibit + 1;
gc_inhibit
. This invocation should be matched by an
invocation of enableGC
.
void enableGC pre gc_inhibit > 0 post gc_inhibit == old gc_inhibit - 1;
gc_inhibit
.
Mapped environment;
ByteString main_resource_dir;
main_resource_dir
.
void setenv (String, String) (environment_variable, value);
value
of the environment_variable
, thread-safely.
String hostname;
hostname
of this machine. If the class variable is not
set, it is set once from gethostname(2).
String tom_prefix;
TOM_PREFIX
in the Constants
class.
_builtin_.Any perror String prefix for All object class ConditionClass condition_class raise boolean not_signal;
Condition
for the object
with the condition_class
and a message created from the (optional) prefix, plus the information
available from the (ANSI C) errno
variable. If not_signal
is
TRUE
, the new condition is raised; otherwise it is signaled and the
result is returned (if a return is allowed).
int quit_inhibit;
quit_inhibit
which is private to the Runtime
class to protect it against being mutated by subclasses but which can
be freely read, hence this method.
void quit_disable;
quit_inhibit
flag. Any increase should be
accompanied later on by the corresponding decrease.
void quit_enable pre quit_inhibit > 0;
quit_inhibit
flag, raising a postponsed signal-int
if indicated by quit_pending
.
int panic_mode;
panic_mode
which is private to the Runtime
class to protect it against being mutated by subclasses but which can
be freely read, hence this method.
void panic_enable;
panic_mode
flag. Any increase should be accompanied
later on by the corresponding decrease.
void panic_disable pre panic_mode > 0;
panic_mode
flag, raising a signal-int
if requested
by quit_pending
.
Runtime
instance is totally empty.