dump.lua 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643
  1. ----------------------------------------------------------------------------
  2. -- LuaJIT compiler dump module.
  3. --
  4. -- Copyright (C) 2005-2010 Mike Pall. All rights reserved.
  5. -- Released under the MIT/X license. See Copyright Notice in luajit.h
  6. ----------------------------------------------------------------------------
  7. --
  8. -- This module can be used to debug the JIT compiler itself. It dumps the
  9. -- code representations and structures used in various compiler stages.
  10. --
  11. -- Example usage:
  12. --
  13. -- luajit -jdump -e "local x=0; for i=1,1e6 do x=x+i end; print(x)"
  14. -- luajit -jdump=im -e "for i=1,1000 do for j=1,1000 do end end" | less -R
  15. -- luajit -jdump=is myapp.lua | less -R
  16. -- luajit -jdump=-b myapp.lua
  17. -- luajit -jdump=+aH,myapp.html myapp.lua
  18. -- luajit -jdump=ixT,myapp.dump myapp.lua
  19. --
  20. -- The first argument specifies the dump mode. The second argument gives
  21. -- the output file name. Default output is to stdout, unless the environment
  22. -- variable LUAJIT_DUMPFILE is set. The file is overwritten every time the
  23. -- module is started.
  24. --
  25. -- Different features can be turned on or off with the dump mode. If the
  26. -- mode starts with a '+', the following features are added to the default
  27. -- set of features; a '-' removes them. Otherwise the features are replaced.
  28. --
  29. -- The following dump features are available (* marks the default):
  30. --
  31. -- * t Print a line for each started, ended or aborted trace (see also -jv).
  32. -- * b Dump the traced bytecode.
  33. -- * i Dump the IR (intermediate representation).
  34. -- r Augment the IR with register/stack slots.
  35. -- s Dump the snapshot map.
  36. -- * m Dump the generated machine code.
  37. -- x Print each taken trace exit.
  38. -- X Print each taken trace exit and the contents of all registers.
  39. --
  40. -- The output format can be set with the following characters:
  41. --
  42. -- T Plain text output.
  43. -- A ANSI-colored text output
  44. -- H Colorized HTML + CSS output.
  45. --
  46. -- The default output format is plain text. It's set to ANSI-colored text
  47. -- if the COLORTERM variable is set. Note: this is independent of any output
  48. -- redirection, which is actually considered a feature.
  49. --
  50. -- You probably want to use less -R to enjoy viewing ANSI-colored text from
  51. -- a pipe or a file. Add this to your ~/.bashrc: export LESS="-R"
  52. --
  53. ------------------------------------------------------------------------------
  54. -- Cache some library functions and objects.
  55. local jit = require("jit")
  56. assert(jit.version_num == 20000, "LuaJIT core/library version mismatch")
  57. local jutil = require("jit.util")
  58. local vmdef = require("jit.vmdef")
  59. local funcinfo, funcbc = jutil.funcinfo, jutil.funcbc
  60. local traceinfo, traceir, tracek = jutil.traceinfo, jutil.traceir, jutil.tracek
  61. local tracemc, tracesnap = jutil.tracemc, jutil.tracesnap
  62. local traceexitstub, ircalladdr = jutil.traceexitstub, jutil.ircalladdr
  63. local bit = require("bit")
  64. local band, shl, shr = bit.band, bit.lshift, bit.rshift
  65. local sub, gsub, format = string.sub, string.gsub, string.format
  66. local byte, char, rep = string.byte, string.char, string.rep
  67. local type, tostring = type, tostring
  68. local stdout, stderr = io.stdout, io.stderr
  69. -- Load other modules on-demand.
  70. local bcline, discreate
  71. -- Active flag, output file handle and dump mode.
  72. local active, out, dumpmode
  73. ------------------------------------------------------------------------------
  74. local symtab = {}
  75. local nexitsym = 0
  76. -- Fill symbol table with trace exit addresses.
  77. local function fillsymtab(nexit)
  78. local t = symtab
  79. if nexitsym == 0 then
  80. local ircall = vmdef.ircall
  81. for i=0,#ircall do t[ircalladdr(i)] = ircall[i] end
  82. end
  83. if nexit > nexitsym then
  84. for i=nexitsym,nexit-1 do t[traceexitstub(i)] = tostring(i) end
  85. nexitsym = nexit
  86. end
  87. return t
  88. end
  89. local function dumpwrite(s)
  90. out:write(s)
  91. end
  92. -- Disassemble machine code.
  93. local function dump_mcode(tr)
  94. local info = traceinfo(tr)
  95. if not info then return end
  96. local mcode, addr, loop = tracemc(tr)
  97. if not mcode then return end
  98. if not discreate then
  99. discreate = require("jit.dis_"..jit.arch).create
  100. end
  101. out:write("---- TRACE ", tr, " mcode ", #mcode, "\n")
  102. local ctx = discreate(mcode, addr, dumpwrite)
  103. ctx.hexdump = 0
  104. ctx.symtab = fillsymtab(info.nexit)
  105. if loop ~= 0 then
  106. symtab[addr+loop] = "LOOP"
  107. ctx:disass(0, loop)
  108. out:write("->LOOP:\n")
  109. ctx:disass(loop, #mcode-loop)
  110. symtab[addr+loop] = nil
  111. else
  112. ctx:disass(0, #mcode)
  113. end
  114. end
  115. ------------------------------------------------------------------------------
  116. local irtype_text = {
  117. [0] = "nil",
  118. "fal",
  119. "tru",
  120. "lud",
  121. "str",
  122. "p32",
  123. "thr",
  124. "pro",
  125. "fun",
  126. "p64",
  127. "cdt",
  128. "tab",
  129. "udt",
  130. "flt",
  131. "num",
  132. "i8 ",
  133. "u8 ",
  134. "i16",
  135. "u16",
  136. "int",
  137. "u32",
  138. "i64",
  139. "u64",
  140. }
  141. local colortype_ansi = {
  142. [0] = "%s",
  143. "%s",
  144. "%s",
  145. "\027[36m%s\027[m",
  146. "\027[32m%s\027[m",
  147. "%s",
  148. "\027[1m%s\027[m",
  149. "%s",
  150. "\027[1m%s\027[m",
  151. "%s",
  152. "\027[33m%s\027[m",
  153. "\027[31m%s\027[m",
  154. "\027[36m%s\027[m",
  155. "\027[34m%s\027[m",
  156. "\027[34m%s\027[m",
  157. "\027[35m%s\027[m",
  158. "\027[35m%s\027[m",
  159. "\027[35m%s\027[m",
  160. "\027[35m%s\027[m",
  161. "\027[35m%s\027[m",
  162. "\027[35m%s\027[m",
  163. "\027[35m%s\027[m",
  164. "\027[35m%s\027[m",
  165. }
  166. local function colorize_text(s, t)
  167. return s
  168. end
  169. local function colorize_ansi(s, t)
  170. return format(colortype_ansi[t], s)
  171. end
  172. local irtype_ansi = setmetatable({},
  173. { __index = function(tab, t)
  174. local s = colorize_ansi(irtype_text[t], t); tab[t] = s; return s; end })
  175. local html_escape = { ["<"] = "&lt;", [">"] = "&gt;", ["&"] = "&amp;", }
  176. local function colorize_html(s, t)
  177. s = gsub(s, "[<>&]", html_escape)
  178. return format('<span class="irt_%s">%s</span>', irtype_text[t], s)
  179. end
  180. local irtype_html = setmetatable({},
  181. { __index = function(tab, t)
  182. local s = colorize_html(irtype_text[t], t); tab[t] = s; return s; end })
  183. local header_html = [[
  184. <style type="text/css">
  185. background { background: #ffffff; color: #000000; }
  186. pre.ljdump {
  187. font-size: 10pt;
  188. background: #f0f4ff;
  189. color: #000000;
  190. border: 1px solid #bfcfff;
  191. padding: 0.5em;
  192. margin-left: 2em;
  193. margin-right: 2em;
  194. }
  195. span.irt_str { color: #00a000; }
  196. span.irt_thr, span.irt_fun { color: #404040; font-weight: bold; }
  197. span.irt_tab { color: #c00000; }
  198. span.irt_udt, span.irt_lud { color: #00c0c0; }
  199. span.irt_num { color: #4040c0; }
  200. span.irt_int, span.irt_i8, span.irt_u8, span.irt_i16, span.irt_u16 { color: #b040b0; }
  201. </style>
  202. ]]
  203. local colorize, irtype
  204. -- Lookup tables to convert some literals into names.
  205. local tointname = { [0] = "check", "index", "", "Z", "S", "T", }
  206. local litname = {
  207. ["SLOAD "] = setmetatable({}, { __index = function(t, mode)
  208. local s = ""
  209. if band(mode, 1) ~= 0 then s = s.."P" end
  210. if band(mode, 2) ~= 0 then s = s.."F" end
  211. if band(mode, 4) ~= 0 then s = s.."T" end
  212. if band(mode, 8) ~= 0 then s = s.."C" end
  213. if band(mode, 16) ~= 0 then s = s.."R" end
  214. if band(mode, 32) ~= 0 then s = s.."I" end
  215. t[mode] = s
  216. return s
  217. end}),
  218. ["XLOAD "] = { [0] = "", "R", "U", "RU", },
  219. ["CONV "] = setmetatable({}, { __index = function(t, mode)
  220. local s = irtype[band(mode, 31)]
  221. if band(mode, 0x100) ~= 0 then s = s.." trunc"
  222. elseif band(mode, 0x200) ~= 0 then s = s.." sext" end
  223. local c = shr(mode, 10)
  224. if c == 2 then s = s.." index" elseif c == 3 then s = s.." check" end
  225. t[mode] = s
  226. return s
  227. end}),
  228. ["TOINT "] = tointname,
  229. ["TOI64 "] = tointname,
  230. ["FLOAD "] = vmdef.irfield,
  231. ["FREF "] = vmdef.irfield,
  232. ["FPMATH"] = vmdef.irfpm,
  233. }
  234. local function ctlsub(c)
  235. if c == "\n" then return "\\n"
  236. elseif c == "\r" then return "\\r"
  237. elseif c == "\t" then return "\\t"
  238. elseif c == "\r" then return "\\r"
  239. else return format("\\%03d", byte(c))
  240. end
  241. end
  242. local function fmtfunc(func, pc)
  243. local fi = funcinfo(func, pc)
  244. if fi.loc then
  245. return fi.loc
  246. elseif fi.ffid then
  247. return vmdef.ffnames[fi.ffid]
  248. elseif fi.addr then
  249. return format("C:%x", fi.addr)
  250. else
  251. return "(?)"
  252. end
  253. end
  254. local function formatk(tr, idx)
  255. local k, t, slot = tracek(tr, idx)
  256. local tn = type(k)
  257. local s
  258. if tn == "number" then
  259. if k == 2^52+2^51 then
  260. s = "bias"
  261. else
  262. s = format("%+.14g", k)
  263. end
  264. elseif tn == "string" then
  265. s = format(#k > 20 and '"%.20s"~' or '"%s"', gsub(k, "%c", ctlsub))
  266. elseif tn == "function" then
  267. s = fmtfunc(k)
  268. elseif tn == "table" then
  269. s = format("{%p}", k)
  270. elseif tn == "userdata" then
  271. if t == 12 then
  272. s = format("userdata:%p", k)
  273. else
  274. s = format("[%p]", k)
  275. if s == "[0x00000000]" then s = "NULL" end
  276. end
  277. else
  278. s = tostring(k) -- For primitives.
  279. end
  280. s = colorize(format("%-4s", s), t)
  281. if slot then
  282. s = format("%s @%d", s, slot)
  283. end
  284. return s
  285. end
  286. local function printsnap(tr, snap)
  287. local n = 2
  288. for s=0,snap[1]-1 do
  289. local sn = snap[n]
  290. if shr(sn, 24) == s then
  291. n = n + 1
  292. local ref = band(sn, 0xffff) - 0x8000 -- REF_BIAS
  293. if ref < 0 then
  294. out:write(formatk(tr, ref))
  295. else
  296. local m, ot, op1, op2 = traceir(tr, ref)
  297. out:write(colorize(format("%04d", ref), band(ot, 31)))
  298. end
  299. out:write(band(sn, 0x10000) == 0 and " " or "|") -- SNAP_FRAME
  300. else
  301. out:write("---- ")
  302. end
  303. end
  304. out:write("]\n")
  305. end
  306. -- Dump snapshots (not interleaved with IR).
  307. local function dump_snap(tr)
  308. out:write("---- TRACE ", tr, " snapshots\n")
  309. for i=0,1000000000 do
  310. local snap = tracesnap(tr, i)
  311. if not snap then break end
  312. out:write(format("#%-3d %04d [ ", i, snap[0]))
  313. printsnap(tr, snap)
  314. end
  315. end
  316. -- NYI: should really get the register map from the disassembler.
  317. local reg_map = ({
  318. x86 = {
  319. [0] = "eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi",
  320. "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7",
  321. },
  322. x64 = {
  323. [0] = "rax", "rcx", "rdx", "rbx", "rsp", "rbp", "rsi", "rdi",
  324. "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
  325. "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7",
  326. "xmm8", "xmm9", "xmm10", "xmm11", "xmm12", "xmm13", "xmm14", "xmm15",
  327. }
  328. })[jit.arch]
  329. -- Return a register name or stack slot for a rid/sp location.
  330. local function ridsp_name(ridsp)
  331. local rid = band(ridsp, 0xff)
  332. if ridsp > 255 then return format("[%x]", shr(ridsp, 8)*4) end
  333. if rid < 128 then return reg_map[rid] end
  334. return ""
  335. end
  336. -- Recursively gather CALL* args and dump them.
  337. local function dumpcallargs(tr, ins)
  338. if ins < 0 then
  339. out:write(formatk(tr, ins))
  340. else
  341. local m, ot, op1, op2 = traceir(tr, ins)
  342. local oidx = 6*shr(ot, 8)
  343. local op = sub(vmdef.irnames, oidx+1, oidx+6)
  344. if op == "CARG " then
  345. dumpcallargs(tr, op1)
  346. if op2 < 0 then
  347. out:write(" ", formatk(tr, op2))
  348. else
  349. out:write(" ", format("%04d", op2))
  350. end
  351. else
  352. out:write(format("%04d", ins))
  353. end
  354. end
  355. end
  356. -- Dump IR and interleaved snapshots.
  357. local function dump_ir(tr, dumpsnap, dumpreg)
  358. local info = traceinfo(tr)
  359. if not info then return end
  360. local nins = info.nins
  361. out:write("---- TRACE ", tr, " IR\n")
  362. local irnames = vmdef.irnames
  363. local snapref = 65536
  364. local snap, snapno
  365. if dumpsnap then
  366. snap = tracesnap(tr, 0)
  367. snapref = snap[0]
  368. snapno = 0
  369. end
  370. for ins=1,nins do
  371. if ins >= snapref then
  372. if dumpreg then
  373. out:write(format(".... SNAP #%-3d [ ", snapno))
  374. else
  375. out:write(format(".... SNAP #%-3d [ ", snapno))
  376. end
  377. printsnap(tr, snap)
  378. snapno = snapno + 1
  379. snap = tracesnap(tr, snapno)
  380. snapref = snap and snap[0] or 65536
  381. end
  382. local m, ot, op1, op2, ridsp = traceir(tr, ins)
  383. local oidx, t = 6*shr(ot, 8), band(ot, 31)
  384. local op = sub(irnames, oidx+1, oidx+6)
  385. if op == "LOOP " then
  386. if dumpreg then
  387. out:write(format("%04d ------------ LOOP ------------\n", ins))
  388. else
  389. out:write(format("%04d ------ LOOP ------------\n", ins))
  390. end
  391. elseif op ~= "NOP " and op ~= "CARG " and
  392. (dumpreg or op ~= "RENAME") then
  393. if dumpreg then
  394. out:write(format("%04d %-5s ", ins, ridsp_name(ridsp)))
  395. else
  396. out:write(format("%04d ", ins))
  397. end
  398. out:write(format("%s%s %s %s ",
  399. band(ot, 128) == 0 and " " or ">",
  400. band(ot, 64) == 0 and " " or "+",
  401. irtype[t], op))
  402. local m1 = band(m, 3)
  403. if sub(op, 1, 4) == "CALL" then
  404. out:write(format("%-10s (", vmdef.ircall[op2]))
  405. if op1 ~= -1 then dumpcallargs(tr, op1) end
  406. out:write(")")
  407. elseif op == "CNEW " and op2 == -1 then
  408. out:write(formatk(tr, op1))
  409. elseif m1 ~= 3 then -- op1 != IRMnone
  410. if op1 < 0 then
  411. out:write(formatk(tr, op1))
  412. else
  413. out:write(format(m1 == 0 and "%04d" or "#%-3d", op1))
  414. end
  415. local m2 = band(m, 3*4)
  416. if m2 ~= 3*4 then -- op2 != IRMnone
  417. if m2 == 1*4 then -- op2 == IRMlit
  418. local litn = litname[op]
  419. if litn and litn[op2] then
  420. out:write(" ", litn[op2])
  421. elseif op == "UREFO " or op == "UREFC " then
  422. out:write(format(" #%-3d", shr(op2, 8)))
  423. else
  424. out:write(format(" #%-3d", op2))
  425. end
  426. elseif op2 < 0 then
  427. out:write(" ", formatk(tr, op2))
  428. else
  429. out:write(format(" %04d", op2))
  430. end
  431. end
  432. end
  433. out:write("\n")
  434. end
  435. end
  436. if snap then
  437. if dumpreg then
  438. out:write(format(".... SNAP #%-3d [ ", snapno))
  439. else
  440. out:write(format(".... SNAP #%-3d [ ", snapno))
  441. end
  442. printsnap(tr, snap)
  443. end
  444. end
  445. ------------------------------------------------------------------------------
  446. local recprefix = ""
  447. local recdepth = 0
  448. -- Format trace error message.
  449. local function fmterr(err, info)
  450. if type(err) == "number" then
  451. if type(info) == "function" then info = fmtfunc(info) end
  452. err = format(vmdef.traceerr[err], info)
  453. end
  454. return err
  455. end
  456. -- Dump trace states.
  457. local function dump_trace(what, tr, func, pc, otr, oex)
  458. if what == "stop" or (what == "abort" and dumpmode.a) then
  459. if dumpmode.i then dump_ir(tr, dumpmode.s, dumpmode.r and what == "stop")
  460. elseif dumpmode.s then dump_snap(tr) end
  461. if dumpmode.m then dump_mcode(tr) end
  462. end
  463. if what == "start" then
  464. if dumpmode.H then out:write('<pre class="ljdump">\n') end
  465. out:write("---- TRACE ", tr, " ", what)
  466. if otr then out:write(" ", otr, "/", oex) end
  467. out:write(" ", fmtfunc(func, pc), "\n")
  468. recprefix = ""
  469. elseif what == "stop" or what == "abort" then
  470. out:write("---- TRACE ", tr, " ", what)
  471. recprefix = nil
  472. if what == "abort" then
  473. out:write(" ", fmtfunc(func, pc), " -- ", fmterr(otr, oex), "\n")
  474. else
  475. local link = traceinfo(tr).link
  476. if link == tr then
  477. link = "loop"
  478. elseif link == 0 then
  479. link = "interpreter"
  480. end
  481. out:write(" -> ", link, "\n")
  482. end
  483. if dumpmode.H then out:write("</pre>\n\n") else out:write("\n") end
  484. else
  485. out:write("---- TRACE ", what, "\n\n")
  486. end
  487. out:flush()
  488. end
  489. -- Dump recorded bytecode.
  490. local function dump_record(tr, func, pc, depth, callee)
  491. if depth ~= recdepth then
  492. recdepth = depth
  493. recprefix = rep(" .", depth)
  494. end
  495. local line
  496. if pc >= 0 then
  497. line = bcline(func, pc, recprefix)
  498. if dumpmode.H then line = gsub(line, "[<>&]", html_escape) end
  499. else
  500. line = "0000 "..recprefix.." FUNCC \n"
  501. callee = func
  502. end
  503. if pc <= 0 then
  504. out:write(sub(line, 1, -2), " ; ", fmtfunc(func), "\n")
  505. else
  506. out:write(line)
  507. end
  508. if pc >= 0 and band(funcbc(func, pc), 0xff) < 16 then -- ORDER BC
  509. out:write(bcline(func, pc+1, recprefix)) -- Write JMP for cond.
  510. end
  511. end
  512. ------------------------------------------------------------------------------
  513. -- Dump taken trace exits.
  514. local function dump_texit(tr, ex, ngpr, nfpr, ...)
  515. out:write("---- TRACE ", tr, " exit ", ex, "\n")
  516. if dumpmode.X then
  517. local regs = {...}
  518. if jit.arch == "x64" then
  519. for i=1,ngpr do
  520. out:write(format(" %016x", regs[i]))
  521. if i % 4 == 0 then out:write("\n") end
  522. end
  523. else
  524. for i=1,ngpr do
  525. out:write(format(" %08x", regs[i]))
  526. if i % 8 == 0 then out:write("\n") end
  527. end
  528. end
  529. for i=1,nfpr do
  530. out:write(format(" %+17.14g", regs[ngpr+i]))
  531. if i % 4 == 0 then out:write("\n") end
  532. end
  533. end
  534. end
  535. ------------------------------------------------------------------------------
  536. -- Detach dump handlers.
  537. local function dumpoff()
  538. if active then
  539. active = false
  540. jit.attach(dump_texit)
  541. jit.attach(dump_record)
  542. jit.attach(dump_trace)
  543. if out and out ~= stdout and out ~= stderr then out:close() end
  544. out = nil
  545. end
  546. end
  547. -- Open the output file and attach dump handlers.
  548. local function dumpon(opt, outfile)
  549. if active then dumpoff() end
  550. local colormode = os.getenv("COLORTERM") and "A" or "T"
  551. if opt then
  552. opt = gsub(opt, "[TAH]", function(mode) colormode = mode; return ""; end)
  553. end
  554. local m = { t=true, b=true, i=true, m=true, }
  555. if opt and opt ~= "" then
  556. local o = sub(opt, 1, 1)
  557. if o ~= "+" and o ~= "-" then m = {} end
  558. for i=1,#opt do m[sub(opt, i, i)] = (o ~= "-") end
  559. end
  560. dumpmode = m
  561. if m.t or m.b or m.i or m.s or m.m then
  562. jit.attach(dump_trace, "trace")
  563. end
  564. if m.b then
  565. jit.attach(dump_record, "record")
  566. if not bcline then bcline = require("jit.bc").line end
  567. end
  568. if m.x or m.X then
  569. jit.attach(dump_texit, "texit")
  570. end
  571. if not outfile then outfile = os.getenv("LUAJIT_DUMPFILE") end
  572. if outfile then
  573. out = outfile == "-" and stdout or assert(io.open(outfile, "w"))
  574. else
  575. out = stdout
  576. end
  577. m[colormode] = true
  578. if colormode == "A" then
  579. colorize = colorize_ansi
  580. irtype = irtype_ansi
  581. elseif colormode == "H" then
  582. colorize = colorize_html
  583. irtype = irtype_html
  584. out:write(header_html)
  585. else
  586. colorize = colorize_text
  587. irtype = irtype_text
  588. end
  589. active = true
  590. end
  591. -- Public module functions.
  592. module(...)
  593. on = dumpon
  594. off = dumpoff
  595. start = dumpon -- For -j command line option.