2011-07-27 07:17:02 -07:00
|
|
|
.\"***********************************************************************
|
|
|
|
.\"* *
|
|
|
|
.\"* OCaml *
|
|
|
|
.\"* *
|
|
|
|
.\"* Xavier Leroy, projet Cristal, INRIA Rocquencourt *
|
|
|
|
.\"* *
|
|
|
|
.\"* Copyright 1996 Institut National de Recherche en Informatique et *
|
|
|
|
.\"* en Automatique. All rights reserved. This file is distributed *
|
|
|
|
.\"* under the terms of the Q Public License version 1.0. *
|
|
|
|
.\"* *
|
|
|
|
.\"***********************************************************************
|
|
|
|
.\"
|
1996-05-10 06:27:26 -07:00
|
|
|
.TH OCAMLRUN 1
|
1995-11-02 08:54:37 -08:00
|
|
|
|
|
|
|
.SH NAME
|
2011-04-26 05:16:50 -07:00
|
|
|
ocamlrun \- The OCaml bytecode interpreter
|
1995-11-02 08:54:37 -08:00
|
|
|
|
|
|
|
.SH SYNOPSIS
|
1996-04-30 07:53:58 -07:00
|
|
|
.B ocamlrun
|
1995-11-02 08:54:37 -08:00
|
|
|
[
|
2008-09-15 07:05:30 -07:00
|
|
|
.I options
|
1995-11-02 08:54:37 -08:00
|
|
|
]
|
|
|
|
.I filename argument ...
|
|
|
|
|
|
|
|
.SH DESCRIPTION
|
2008-09-15 07:05:30 -07:00
|
|
|
The
|
1996-04-30 07:53:58 -07:00
|
|
|
.BR ocamlrun (1)
|
1995-11-02 08:54:37 -08:00
|
|
|
command executes bytecode files produced by the
|
2008-09-15 07:05:30 -07:00
|
|
|
linking phase of the
|
1996-04-30 07:53:58 -07:00
|
|
|
.BR ocamlc (1)
|
1995-11-02 08:54:37 -08:00
|
|
|
command.
|
|
|
|
|
|
|
|
The first non-option argument is taken to be the name of the file
|
|
|
|
containing the executable bytecode. (That file is searched in the
|
|
|
|
executable path as well as in the current directory.) The remaining
|
2011-04-26 05:16:50 -07:00
|
|
|
arguments are passed to the OCaml program, in the string array
|
2008-09-15 07:05:30 -07:00
|
|
|
.BR Sys.argv .
|
|
|
|
Element 0 of this array is the name of the
|
|
|
|
bytecode executable file; elements 1 to
|
1995-11-02 08:54:37 -08:00
|
|
|
.I n
|
|
|
|
are the remaining arguments.
|
|
|
|
|
|
|
|
In most cases, the bytecode
|
2008-09-15 07:05:30 -07:00
|
|
|
executable files produced by the
|
1996-04-30 07:53:58 -07:00
|
|
|
.BR ocamlc (1)
|
1995-11-02 08:54:37 -08:00
|
|
|
command are self-executable,
|
2008-09-15 07:05:30 -07:00
|
|
|
and manage to launch the
|
1996-04-30 07:53:58 -07:00
|
|
|
.BR ocamlrun (1)
|
1995-11-02 08:54:37 -08:00
|
|
|
command on themselves automatically.
|
|
|
|
|
|
|
|
.SH OPTIONS
|
|
|
|
|
2008-09-15 07:05:30 -07:00
|
|
|
The following command-line options are recognized by
|
1996-04-30 07:53:58 -07:00
|
|
|
.BR ocamlrun (1).
|
1995-11-02 08:54:37 -08:00
|
|
|
.TP
|
2008-09-15 07:05:30 -07:00
|
|
|
.B \-b
|
|
|
|
When the program aborts due to an uncaught exception, print a detailed
|
|
|
|
"back trace" of the execution, showing where the exception was
|
|
|
|
raised and which function calls were outstanding at this point. The
|
|
|
|
back trace is printed only if the bytecode executable contains
|
|
|
|
debugging information, i.e. was compiled and linked with the
|
|
|
|
.B \-g
|
|
|
|
option to
|
|
|
|
.BR ocamlc (1)
|
|
|
|
set. This option is equivalent to setting the
|
|
|
|
.B b
|
|
|
|
flag in the OCAMLRUNPARAM environment variable (see below).
|
|
|
|
.TP
|
|
|
|
.BI \-I \ dir
|
|
|
|
Search the directory
|
|
|
|
.I dir
|
|
|
|
for dynamically-loaded libraries, in addition to the standard search path.
|
2011-07-27 07:17:02 -07:00
|
|
|
.TP
|
2008-09-15 07:05:30 -07:00
|
|
|
.B \-p
|
|
|
|
Print the names of the primitives known to this version of
|
|
|
|
.BR ocamlrun (1)
|
|
|
|
and exit.
|
|
|
|
.TP
|
|
|
|
.B \-v
|
|
|
|
Direct the memory manager to print verbose messages on standard error.
|
|
|
|
This is equivalent to setting
|
|
|
|
.B v=63
|
|
|
|
in the OCAMLRUNPARAM environment variable (see below).
|
|
|
|
.TP
|
|
|
|
.B \-version
|
2010-05-20 07:06:29 -07:00
|
|
|
Print version string and exit.
|
|
|
|
.TP
|
|
|
|
.B \-vnum
|
|
|
|
Print short version number and exit.
|
1995-11-02 08:54:37 -08:00
|
|
|
|
|
|
|
.SH ENVIRONMENT VARIABLES
|
|
|
|
|
|
|
|
The following environment variable are also consulted:
|
|
|
|
.TP
|
2008-09-15 07:05:30 -07:00
|
|
|
.B CAML_LD_LIBRARY_PATH
|
|
|
|
Additional directories to search for dynamically-loaded libraries.
|
|
|
|
.TP
|
|
|
|
.B OCAMLLIB
|
2011-04-26 05:16:50 -07:00
|
|
|
The directory containing the OCaml standard
|
2008-09-15 07:05:30 -07:00
|
|
|
library. (If
|
|
|
|
.B OCAMLLIB
|
1999-11-18 09:57:48 -08:00
|
|
|
is not set,
|
2008-09-15 07:05:30 -07:00
|
|
|
.B CAMLLIB
|
|
|
|
will be used instead.) Used to locate the ld.conf configuration file for
|
|
|
|
dynamic loading. If not set,
|
2011-04-26 05:16:50 -07:00
|
|
|
default to the library directory specified when compiling OCaml.
|
2008-09-15 07:05:30 -07:00
|
|
|
.TP
|
|
|
|
.B OCAMLRUNPARAM
|
|
|
|
Set the runtime system options and garbage collection parameters.
|
|
|
|
(If OCAMLRUNPARAM is not set, CAMLRUNPARAM will be used instead.)
|
2015-05-04 08:44:40 -07:00
|
|
|
This variable must be a sequence of parameter specifications separated
|
|
|
|
by commas.
|
|
|
|
A parameter specification is a letter, optionally followed by an =
|
2008-09-15 07:05:30 -07:00
|
|
|
sign, a decimal number (or a hexadecimal number prefixed by
|
|
|
|
.BR 0x ),
|
2015-05-04 08:44:40 -07:00
|
|
|
and an optional multiplier. If the letter is followed by anything
|
|
|
|
else, the corresponding option is set to 1. Unknown letters
|
|
|
|
are ignored.
|
|
|
|
The options are documented below; the
|
2013-01-03 07:22:11 -08:00
|
|
|
last six correspond to the fields of the
|
2008-09-15 07:05:30 -07:00
|
|
|
.B control
|
|
|
|
record documented in
|
2011-04-26 05:16:50 -07:00
|
|
|
.IR "The OCaml user's manual",
|
2008-09-15 07:05:30 -07:00
|
|
|
chapter "Standard Library", section "Gc".
|
|
|
|
.TP
|
2008-12-03 10:09:09 -08:00
|
|
|
.B b
|
2008-09-15 07:05:30 -07:00
|
|
|
Trigger the printing of a stack backtrace
|
|
|
|
when an uncaught exception aborts the program.
|
|
|
|
This option takes no argument.
|
|
|
|
.TP
|
2008-12-03 10:09:09 -08:00
|
|
|
.B p
|
2008-09-15 07:05:30 -07:00
|
|
|
Turn on debugging support for
|
|
|
|
.BR ocamlyacc -generated
|
|
|
|
parsers. When this option is on,
|
|
|
|
the pushdown automaton that executes the parsers prints a
|
|
|
|
trace of its actions. This option takes no argument.
|
2004-04-15 09:16:55 -07:00
|
|
|
.TP
|
2013-01-03 07:22:11 -08:00
|
|
|
.BR R
|
|
|
|
Turn on randomization of all hash tables by default (see the
|
|
|
|
.B Hashtbl
|
|
|
|
module of the standard library). This option takes no
|
|
|
|
argument.
|
|
|
|
.TP
|
|
|
|
.BR h
|
|
|
|
The initial size of the major heap (in words).
|
|
|
|
.TP
|
2008-12-03 10:09:09 -08:00
|
|
|
.BR a \ (allocation_policy)
|
|
|
|
The policy used for allocating in the OCaml heap. Possible values
|
|
|
|
are 0 for the next-fit policy, and 1 for the first-fit
|
2013-01-03 07:22:11 -08:00
|
|
|
policy. Next-fit is usually faster, but first-fit is better for
|
2008-12-03 10:09:09 -08:00
|
|
|
avoiding fragmentation and the associated heap compactions.
|
|
|
|
.TP
|
1995-11-02 08:54:37 -08:00
|
|
|
.BR s \ (minor_heap_size)
|
2008-09-15 07:05:30 -07:00
|
|
|
The size of the minor heap (in words).
|
1995-11-02 08:54:37 -08:00
|
|
|
.TP
|
|
|
|
.BR i \ (major_heap_increment)
|
2008-09-15 07:05:30 -07:00
|
|
|
The default size increment for the major heap (in words).
|
1995-11-02 08:54:37 -08:00
|
|
|
.TP
|
|
|
|
.BR o \ (space_overhead)
|
|
|
|
The major GC speed setting.
|
|
|
|
.TP
|
1999-11-18 09:57:48 -08:00
|
|
|
.BR O \ (max_overhead)
|
|
|
|
The heap compaction trigger setting.
|
|
|
|
.TP
|
|
|
|
.BR l \ (stack_limit)
|
|
|
|
The limit (in words) of the stack size.
|
|
|
|
.TP
|
1995-11-02 08:54:37 -08:00
|
|
|
.BR v \ (verbose)
|
1999-11-18 09:57:48 -08:00
|
|
|
What GC messages to print to stderr. This is a sum of values selected
|
|
|
|
from the following:
|
2008-09-15 07:05:30 -07:00
|
|
|
|
|
|
|
.B 0x001
|
1999-11-18 09:57:48 -08:00
|
|
|
Start of major GC cycle.
|
2008-09-15 07:05:30 -07:00
|
|
|
|
|
|
|
.B 0x002
|
1999-11-18 09:57:48 -08:00
|
|
|
Minor collection and major GC slice.
|
2008-09-15 07:05:30 -07:00
|
|
|
|
|
|
|
.B 0x004
|
1999-11-18 09:57:48 -08:00
|
|
|
Growing and shrinking of the heap.
|
2008-09-15 07:05:30 -07:00
|
|
|
|
|
|
|
.B 0x008
|
1999-11-18 09:57:48 -08:00
|
|
|
Resizing of stacks and memory manager tables.
|
2008-09-15 07:05:30 -07:00
|
|
|
|
|
|
|
.B 0x010
|
1999-11-18 09:57:48 -08:00
|
|
|
Heap compaction.
|
2008-09-15 07:05:30 -07:00
|
|
|
|
|
|
|
.BR 0x020
|
1999-11-18 09:57:48 -08:00
|
|
|
Change of GC parameters.
|
2008-09-15 07:05:30 -07:00
|
|
|
|
|
|
|
.BR 0x040
|
1999-11-18 09:57:48 -08:00
|
|
|
Computation of major GC slice size.
|
2008-09-15 07:05:30 -07:00
|
|
|
|
|
|
|
.BR 0x080
|
|
|
|
Calling of finalisation functions.
|
|
|
|
|
|
|
|
.BR 0x100
|
|
|
|
Startup messages (loading the bytecode executable file, resolving
|
|
|
|
shared libraries).
|
1999-11-18 09:57:48 -08:00
|
|
|
|
2015-07-17 07:31:05 -07:00
|
|
|
.BR 0x200
|
|
|
|
Computation of compaction-triggering condition.
|
|
|
|
|
2015-12-02 02:25:45 -08:00
|
|
|
.BR 0x400
|
|
|
|
Output GC statistics at program exit, in the same format as Gc.print_stat.
|
|
|
|
|
1999-11-18 09:57:48 -08:00
|
|
|
The multiplier is
|
2008-09-15 07:05:30 -07:00
|
|
|
.BR k ,
|
2013-01-03 07:22:11 -08:00
|
|
|
.BR M ,\ or
|
2008-09-15 07:05:30 -07:00
|
|
|
.BR G ,
|
|
|
|
for multiplication by 2^10, 2^20, and 2^30 respectively.
|
1999-11-18 09:57:48 -08:00
|
|
|
For example, on a 32-bit machine under bash, the command
|
|
|
|
.B export OCAMLRUNPARAM='s=256k,v=1'
|
|
|
|
tells a subsequent
|
|
|
|
.B ocamlrun
|
|
|
|
to set its initial minor heap size to 1 megabyte and to print
|
|
|
|
a message at the start of each major GC cycle.
|
2008-09-15 07:05:30 -07:00
|
|
|
.TP
|
|
|
|
.B CAMLRUNPARAM
|
|
|
|
If OCAMLRUNPARAM is not found in the environment, then CAMLRUNPARAM
|
|
|
|
will be used instead. If CAMLRUNPARAM is not found, then the default
|
|
|
|
values will be used.
|
1995-11-02 08:54:37 -08:00
|
|
|
.TP
|
|
|
|
.B PATH
|
|
|
|
List of directories searched to find the bytecode executable file.
|
|
|
|
|
|
|
|
.SH SEE ALSO
|
1996-04-30 07:53:58 -07:00
|
|
|
.BR ocamlc (1).
|
1995-11-02 08:54:37 -08:00
|
|
|
.br
|
2011-04-26 05:16:50 -07:00
|
|
|
.IR "The OCaml user's manual" ,
|
1995-11-02 08:54:37 -08:00
|
|
|
chapter "Runtime system".
|