1parrot(1) User Contributed Perl Documentation parrot(1)
2
3
4
6 docs/running.pod - Running
7
9 $Revision$
10
12 This document describes Parrot's command line options.
13
15 parrot [-options] <file> [arguments ...]
16
18 PARROT_RUNTIME
19 If this environment variable is set, parrot will use this path as
20 its runtime prefix instead of the compiled in path.
21
22 PARROT_GC_DEBUG
23 Turn on the --gc-debug flag.
24
26 Assembler options
27 -a, --pasm
28 Assume PASM input on stdin.
29
30 -c, --pbc
31 Assume PBC file on stdin, run it.
32
33 -d, --imcc-debug [hexbits]
34 The -d switch takes an optional argument which is considered to
35 hold a hex value of debug bits. Without a value, debug is set to 1.
36
37 The individual bits can be listed on the command line by use of the
38 --help-debug switch.
39
40 To produce really huge output on stderr run "parrot -d 0ffff ...".
41 Note: If the argument is separated by whitespace from the -d
42 switch, it has to start with a number.
43
44 -h, --help
45 Print command line option summary.
46
47 --help-debug
48 Print debugging and tracing flag bits summary.
49
50 -o outputfile, --output=outputfile
51 Act like an assembler. Don't run code, unless -r is given too. If
52 the outputfile ends with .pbc, a PBC file is written. If it ends
53 with .pasm, a PASM output is generated, even from PASM input. This
54 can be handy to check various optimizations, including "-Op".
55
56 --output-pbc
57 Act like an assembler, but always output bytecode, even if the
58 output file does not end in .pbc
59
60 -r, --run-pbc
61 Only useful after "-o" or "--output-pbc". Run the program from the
62 compiled in-memory image. If two "-r" options are given, the .pbc
63 file is read from disc and run. This is mainly needed for tests.
64
65 -v, --verbose
66 One "-v" shows which files are worked on and prints a summary over
67 register usage and optimization stats per subroutine. With two
68 "-v" switches, "parrot" prints a line per individual processing
69 step too.
70
71 -y, --yydebug
72 Turn on yydebug in yacc/bison.
73
74 -V, --version
75 Print version information and exit.
76
77 -Ox Optimize
78
79 -O0 no optimization (default)
80 -O1 optimizations without life info (e.g. branches)
81 -O same
82 -O2 optimizations with life info
83 -Op rewrite I and N PASM registers most used first
84 -Ot select fastest runcore
85 -Oc turns on the optional/experimental tail call optimizations
86
87 See docs/dev/optimizer.pod for more information on the optimizer.
88 Note that optimization is currently experimental and these options
89 are likely to change.
90
91 -E, --pre-process-only
92 Preprocess source file (expand macros) and print result to stdout:
93
94 $ parrot -E t/op/macro_10.pasm
95 $ parrot -E t/op/macro_10.pasm | parrot -- -
96
97 Runcore Options
98 These options select the runcore, which is useful for performance
99 tuning and debugging. See "About runcores" for details.
100
101 -R, --runcore CORE
102 Select the runcore. The following cores are available in Parrot,
103 but not all may be available on your system:
104
105 slow, bounds bounds checking core (default)
106 gcdebug performs a full GC run before every op dispatch (good for
107 debugging GC problems)
108 trace bounds checking core w/ trace info (see 'parrot --help-debug')
109 profiling see F<docs/dev/profilling.pod>
110
111 The "jit", "switch-jit", and "cgp-jit" options are currently
112 aliases for the "fast", "switch", and "cgp" options, respectively.
113 We do not recommend their use in new code; they will continue
114 working for existing code per our deprecation policy.
115
116 -p, --profile
117 Run with the slow core and print an execution profile.
118
119 -t, --trace
120 Run with the slow core and print trace information to stderr. See
121 "parrot --help-debug" for available flag bits.
122
123 VM Options
124 -w, --warnings
125 Turn on warnings. See "parrot --help-debug" for available flag
126 bits.
127
128 -D, --parrot-debug
129 Turn on interpreter debug flag. See "parrot --help-debug" for
130 available flag bits.
131
132 --hash-seed <hexnum>
133 Sets the hash seed to the provided value. Only useful for debugging
134 intermittent failures, and harmful in production.
135
136 --gc-debug
137 Turn on GC (Garbage Collection) debugging. This imposes some stress
138 on the GC subsystem and can slow down execution considerably.
139
140 -G, --no-gc
141 This turns off GC. This may be useful to find GC related bugs.
142 Don't use this option for longer running programs: as memory is no
143 longer recycled, it may quickly become exhausted.
144
145 --leak-test, --destroy-at-end
146 Free all memory of the last interpreter. This is useful when
147 running leak checkers.
148
149 -., --wait
150 Read a keystroke before starting. This is useful when you want to
151 attach a debugger on platforms such as Windows.
152
153 --runtime-prefix
154 Print the runtime prefix path and exit.
155
156 <file>
157 If the file ends in .pbc it will be interpreted immediately.
158
159 If the file ends in .pasm, then it is parsed as PASM code. Otherwise,
160 it is parsed as PIR code. In both cases, it will then be run, unless
161 the "-o" flag was given.
162
163 If the "file" is a single dash, input from "stdin" is read.
164
165 [arguments ...]
166 Optional arguments passed to the running program as ARGV. The program
167 is assumed to know what to do with these.
168
171 The runcore (or runloop) tells Parrot how to find the C code that
172 implements each instruction. Parrot provides more than one way to do
173 this, partly because no single runcore will perform optimally on all
174 architectures (or even for all problems on a given architecture), and
175 partly because some of the runcores have specific debugging and tracing
176 capabilities.
177
178 In the default "slow" runcore, each opcode is a separate C function.
179 That's pretty easy in pseudocode:
180
181 slow_runcore( op ):
182 while ( op ):
183 op = op_function( op )
184 check_for_events()
185
186 The GC debugging runcore is similar:
187
188 gcdebug_runcore( op ):
189 while ( op ):
190 perform_full_gc_run()
191 op = op_function( op )
192 check_for_events()
193
194 Of course, this is much slower, but is extremely helpful for pinning
195 memory corruption problems that affect GC down to single-instruction
196 resolution. See
197 <http://www.oreillynet.com/onlamp/blog/2007/10/debugging_gc_problems_in_parro.html>
198 for more information.
199
200 The trace and profile cores are also based on the "slow" core, doing
201 full bounds checking, and also printing runtime information to stderr.
202
204 Command Line Action Output
205 ---------------------------------------------
206 parrot x.pir run
207 parrot x.pasm run
208 parrot x.pbc run
209 -o x.pasm x.pir ass x.pasm
210 -o x.pasm y.pasm ass x.pasm
211 -o x.pbc x.pir ass x.pbc
212 -o x.pbc x.pasm ass x.pbc
213 -o x.pbc -r x.pasm ass/run pasm x.pbc
214 -o x.pbc -r -r x.pasm ass/run pbc x.pbc
215 -o x.o x.pbc obj
216
217 ... where the possible actions are:
218
219 run ... yes, run the program
220 ass ... assemble sourcefile
221 obj .. produce native (ELF) object file for the EXEC subsystem
222
224 main.c
225
226
227
228perl v5.12.3 2011-07-18 parrot(1)