Fetching contributors…
Cannot retrieve contributors at this time
158 lines (106 sloc) 5.62 KB


Environment variables available in the Niecza (.NET) runtime


Niecza has a large number of debug modes which can be activated by adding an environment variable. Most of these are boolean options which enable a specific form of debug output. Boolean options only care about the presence or absence of the named environment variable.

Non-debug options


Removes redundant unbox.any instructions from the generated IL stream, improving performance slightly at the expense of making the generated code unverifiable (and likely to segfault in critical failure scenarios).


Instructs the module saver to save a copy of the CgOp-level code in the generated .ser files. Used as part of the bootstrap procedure (see compiler.pod) and also for cross-compiling.

Special mention


Processed by the compiler, not the runtime. Disables the normal conversion of exceptions to SORRYs, allowing you to see the full backtrace.

Debug options


When set, all Perl 6 level exceptions (not internal ones like ExitRunloopException or ResumeUnwindException) will be printed as if they were unhandled, whether they are actually handled or not. Prints at a very early stage so it's useful in cases where exception handling itself is seriously broken.


Displays a running account of the state of the C3 superclass linearization algorithm.


Generates some debug info from the CLR object wrapper generator.


This is an integer parameter. If set to 1, an informative message will be printed before generating CLR methods for any Perl 6 block. If set to 2, individual steps in the NamProcessor.Scan recursion will be logged.


Setting this when running the compiler causes the equivalent of setting NIECZA_TRACE=all in the context of the child only. Useful for debugging problems that appear only in compile-and-run mode, since it avoids tracing the compiler itself (a procedure which generates much unneeded output, wasting time and space).


Throw an exception and generate a stack dump at a specific point in the parsing process. Only meaningful in conjunction with NIECZA_HIGHWATER_TRACE; for instance, setting this to 53 will die immediately after the generation of the "53%" status report.


Causes .dll files to be generated for all MSIL emission, even MSIL emission that would not normally be saved such as for evals and BEGIN blocks.


Generates running status reports for all regex matches against long strings (greater than 100 characters). The status measured is the high-water mark, the highest character position yet seen (for speed reasons, this is only sampled when backtracking, at the end of rules, and on entry to longest-term matching).


Encode unencodable objects as the string "UNSERIALIZABLE Type", to make it easier to find them in the data structure.


Generates extensive reports on the construction and use of longest-term automata.


Dumps the status of the overloading resolution algorithm (currently only used for CLR overloaded methods).


Traces entry and exit to all regex methods. Each trace point includes the position of the attempt; exits include success/failure information and match range if applicable. Also traces <ws>.


Normally exceptions generated during the thaw process are treated as indications of an incompatible format change too fundamental for the signature and version number to be correctly parsed, so they are not shown to the user. This option causes such exceptions to be displayed.


Dumps information on the saving and loading of objects from serialized store files, in particular types and file offsets. Useful for inspecting store files and debugging synchronization failures between save and load.


This enables per-operation tracing by instrumenting the trampoline. It may be set to all or stat. If it is set to all, then the call tree will be printed in real time; each trampoline bounce displays a node and the current call depth. If it is set to stat, then the call stack will be printed every 1 million bounces (by default).

The all mode is useful for debugging the context of crashes, especially infinite loops in a single operation. For Perl 6-level infinite loops, stat is more useful; stat can also be used as a primitive profiler, though its utility is limited by the fact that it does not count real time.


This dumps all edges in the callgraph for profiling purposes. The perf/ script transforms the output into a more readable form.


Setting this causes all interaction between the Perl 6 compiler proper and the C# runtime stub to be logged; for instance creation of subs, creation of packages, installation of sub code, and variable lookups.


This sets the display interval for NIECZA_TRACE=stat. Defaults to 1000000. Setting it lower is potentially useful in a profiling context.


Displays details of call arguments like callframe.args.perl in backtraces in addition to the usual $?FILE / $?LINE / &? information. Has an unfortunate tendency to cause infinite loops.