Coverage Report

Created: 2018-08-19 21:11

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/tools/lld/wasm/Driver.cpp
Line
Count
Source (jump to first uncovered line)
1
//===- Driver.cpp ---------------------------------------------------------===//
2
//
3
//                             The LLVM Linker
4
//
5
// This file is distributed under the University of Illinois Open Source
6
// License. See LICENSE.TXT for details.
7
//
8
//===----------------------------------------------------------------------===//
9
10
#include "lld/Common/Driver.h"
11
#include "Config.h"
12
#include "InputChunks.h"
13
#include "InputGlobal.h"
14
#include "MarkLive.h"
15
#include "SymbolTable.h"
16
#include "Writer.h"
17
#include "lld/Common/Args.h"
18
#include "lld/Common/ErrorHandler.h"
19
#include "lld/Common/Memory.h"
20
#include "lld/Common/Strings.h"
21
#include "lld/Common/Threads.h"
22
#include "lld/Common/Version.h"
23
#include "llvm/ADT/Twine.h"
24
#include "llvm/Object/Wasm.h"
25
#include "llvm/Option/ArgList.h"
26
#include "llvm/Support/CommandLine.h"
27
#include "llvm/Support/Path.h"
28
#include "llvm/Support/Process.h"
29
#include "llvm/Support/TargetSelect.h"
30
31
#define DEBUG_TYPE "lld"
32
33
using namespace llvm;
34
using namespace llvm::sys;
35
using namespace llvm::wasm;
36
37
using namespace lld;
38
using namespace lld::wasm;
39
40
Configuration *lld::wasm::Config;
41
42
namespace {
43
44
// Create enum with OPT_xxx values for each option in Options.td
45
enum {
46
  OPT_INVALID = 0,
47
#define OPTION(_1, _2, ID, _4, _5, _6, _7, _8, _9, _10, _11, _12) OPT_##ID,
48
#include "Options.inc"
49
#undef OPTION
50
};
51
52
// This function is called on startup. We need this for LTO since
53
// LTO calls LLVM functions to compile bitcode files to native code.
54
// Technically this can be delayed until we read bitcode files, but
55
// we don't bother to do lazily because the initialization is fast.
56
0
static void initLLVM() {
57
0
  InitializeAllTargets();
58
0
  InitializeAllTargetMCs();
59
0
  InitializeAllAsmPrinters();
60
0
  InitializeAllAsmParsers();
61
0
}
62
63
class LinkerDriver {
64
public:
65
  void link(ArrayRef<const char *> ArgsArr);
66
67
private:
68
  void createFiles(opt::InputArgList &Args);
69
  void addFile(StringRef Path);
70
  void addLibrary(StringRef Name);
71
72
  // True if we are in --whole-archive and --no-whole-archive.
73
  bool InWholeArchive = false;
74
75
  std::vector<InputFile *> Files;
76
};
77
} // anonymous namespace
78
79
bool lld::wasm::link(ArrayRef<const char *> Args, bool CanExitEarly,
80
0
                     raw_ostream &Error) {
81
0
  errorHandler().LogName = sys::path::filename(Args[0]);
82
0
  errorHandler().ErrorOS = &Error;
83
0
  errorHandler().ColorDiagnostics = Error.has_colors();
84
0
  errorHandler().ErrorLimitExceededMsg =
85
0
      "too many errors emitted, stopping now (use "
86
0
      "-error-limit=0 to see all errors)";
87
0
88
0
  Config = make<Configuration>();
89
0
  Symtab = make<SymbolTable>();
90
0
91
0
  initLLVM();
92
0
  LinkerDriver().link(Args);
93
0
94
0
  // Exit immediately if we don't need to return to the caller.
95
0
  // This saves time because the overhead of calling destructors
96
0
  // for all globally-allocated objects is not negligible.
97
0
  if (CanExitEarly)
98
0
    exitLld(errorCount() ? 1 : 0);
99
0
100
0
  freeArena();
101
0
  return !errorCount();
102
0
}
103
104
// Create prefix string literals used in Options.td
105
#define PREFIX(NAME, VALUE) const char *const NAME[] = VALUE;
106
#include "Options.inc"
107
#undef PREFIX
108
109
// Create table mapping all options defined in Options.td
110
static const opt::OptTable::Info OptInfo[] = {
111
#define OPTION(X1, X2, ID, KIND, GROUP, ALIAS, X7, X8, X9, X10, X11, X12)      \
112
  {X1, X2, X10,         X11,         OPT_##ID, opt::Option::KIND##Class,       \
113
   X9, X8, OPT_##GROUP, OPT_##ALIAS, X7,       X12},
114
#include "Options.inc"
115
#undef OPTION
116
};
117
118
namespace {
119
class WasmOptTable : public llvm::opt::OptTable {
120
public:
121
0
  WasmOptTable() : OptTable(OptInfo) {}
122
  opt::InputArgList parse(ArrayRef<const char *> Argv);
123
};
124
} // namespace
125
126
// Set color diagnostics according to -color-diagnostics={auto,always,never}
127
// or -no-color-diagnostics flags.
128
0
static void handleColorDiagnostics(opt::InputArgList &Args) {
129
0
  auto *Arg = Args.getLastArg(OPT_color_diagnostics, OPT_color_diagnostics_eq,
130
0
                              OPT_no_color_diagnostics);
131
0
  if (!Arg)
132
0
    return;
133
0
  if (Arg->getOption().getID() == OPT_color_diagnostics) {
134
0
    errorHandler().ColorDiagnostics = true;
135
0
  } else if (Arg->getOption().getID() == OPT_no_color_diagnostics) {
136
0
    errorHandler().ColorDiagnostics = false;
137
0
  } else {
138
0
    StringRef S = Arg->getValue();
139
0
    if (S == "always")
140
0
      errorHandler().ColorDiagnostics = true;
141
0
    else if (S == "never")
142
0
      errorHandler().ColorDiagnostics = false;
143
0
    else if (S != "auto")
144
0
      error("unknown option: --color-diagnostics=" + S);
145
0
  }
146
0
}
147
148
// Find a file by concatenating given paths.
149
static Optional<std::string> findFile(StringRef Path1, const Twine &Path2) {
150
  SmallString<128> S;
151
  path::append(S, Path1, Path2);
152
  if (fs::exists(S))
153
    return S.str().str();
154
  return None;
155
}
156
157
0
opt::InputArgList WasmOptTable::parse(ArrayRef<const char *> Argv) {
158
0
  SmallVector<const char *, 256> Vec(Argv.data(), Argv.data() + Argv.size());
159
0
160
0
  unsigned MissingIndex;
161
0
  unsigned MissingCount;
162
0
163
0
  // Expand response files (arguments in the form of @<filename>)
164
0
  cl::ExpandResponseFiles(Saver, cl::TokenizeGNUCommandLine, Vec);
165
0
166
0
  opt::InputArgList Args = this->ParseArgs(Vec, MissingIndex, MissingCount);
167
0
168
0
  handleColorDiagnostics(Args);
169
0
  for (auto *Arg : Args.filtered(OPT_UNKNOWN))
170
0
    error("unknown argument: " + Arg->getSpelling());
171
0
  return Args;
172
0
}
173
174
// Currently we allow a ".imports" to live alongside a library. This can
175
// be used to specify a list of symbols which can be undefined at link
176
// time (imported from the environment.  For example libc.a include an
177
// import file that lists the syscall functions it relies on at runtime.
178
// In the long run this information would be better stored as a symbol
179
// attribute/flag in the object file itself.
180
// See: https://github.com/WebAssembly/tool-conventions/issues/35
181
0
static void readImportFile(StringRef Filename) {
182
0
  if (Optional<MemoryBufferRef> Buf = readFile(Filename))
183
0
    for (StringRef Sym : args::getLines(*Buf))
184
0
      Config->AllowUndefinedSymbols.insert(Sym);
185
0
}
186
187
// Returns slices of MB by parsing MB as an archive file.
188
// Each slice consists of a member file in the archive.
189
std::vector<MemoryBufferRef> static getArchiveMembers(
190
    MemoryBufferRef MB) {
191
  std::unique_ptr<Archive> File =
192
      CHECK(Archive::create(MB),
193
            MB.getBufferIdentifier() + ": failed to parse archive");
194
195
  std::vector<MemoryBufferRef> V;
196
  Error Err = Error::success();
197
  for (const ErrorOr<Archive::Child> &COrErr : File->children(Err)) {
198
    Archive::Child C =
199
        CHECK(COrErr, MB.getBufferIdentifier() +
200
                          ": could not get the child of the archive");
201
    MemoryBufferRef MBRef =
202
        CHECK(C.getMemoryBufferRef(),
203
              MB.getBufferIdentifier() +
204
                  ": could not get the buffer for a child of the archive");
205
    V.push_back(MBRef);
206
  }
207
  if (Err)
208
    fatal(MB.getBufferIdentifier() + ": Archive::children failed: " +
209
          toString(std::move(Err)));
210
211
  // Take ownership of memory buffers created for members of thin archives.
212
  for (std::unique_ptr<MemoryBuffer> &MB : File->takeThinBuffers())
213
    make<std::unique_ptr<MemoryBuffer>>(std::move(MB));
214
215
  return V;
216
}
217
218
0
void LinkerDriver::addFile(StringRef Path) {
219
0
  Optional<MemoryBufferRef> Buffer = readFile(Path);
220
0
  if (!Buffer.hasValue())
221
0
    return;
222
0
  MemoryBufferRef MBRef = *Buffer;
223
0
224
0
  switch (identify_magic(MBRef.getBuffer())) {
225
0
  case file_magic::archive: {
226
0
    // Handle -whole-archive.
227
0
    if (InWholeArchive) {
228
0
      for (MemoryBufferRef &M : getArchiveMembers(MBRef))
229
0
        Files.push_back(createObjectFile(M));
230
0
      return;
231
0
    }
232
0
233
0
    SmallString<128> ImportFile = Path;
234
0
    path::replace_extension(ImportFile, ".imports");
235
0
    if (fs::exists(ImportFile))
236
0
      readImportFile(ImportFile.str());
237
0
238
0
    Files.push_back(make<ArchiveFile>(MBRef));
239
0
    return;
240
0
  }
241
0
  case file_magic::bitcode:
242
0
  case file_magic::wasm_object:
243
0
    Files.push_back(createObjectFile(MBRef));
244
0
    break;
245
0
  default:
246
0
    error("unknown file type: " + MBRef.getBufferIdentifier());
247
0
  }
248
0
}
249
250
// Add a given library by searching it from input search paths.
251
0
void LinkerDriver::addLibrary(StringRef Name) {
252
0
  for (StringRef Dir : Config->SearchPaths) {
253
0
    if (Optional<std::string> S = findFile(Dir, "lib" + Name + ".a")) {
254
0
      addFile(*S);
255
0
      return;
256
0
    }
257
0
  }
258
0
259
0
  error("unable to find library -l" + Name);
260
0
}
261
262
0
void LinkerDriver::createFiles(opt::InputArgList &Args) {
263
0
  for (auto *Arg : Args) {
264
0
    switch (Arg->getOption().getUnaliasedOption().getID()) {
265
0
    case OPT_l:
266
0
      addLibrary(Arg->getValue());
267
0
      break;
268
0
    case OPT_INPUT:
269
0
      addFile(Arg->getValue());
270
0
      break;
271
0
    case OPT_whole_archive:
272
0
      InWholeArchive = true;
273
0
      break;
274
0
    case OPT_no_whole_archive:
275
0
      InWholeArchive = false;
276
0
      break;
277
0
    }
278
0
  }
279
0
}
280
281
0
static StringRef getEntry(opt::InputArgList &Args, StringRef Default) {
282
0
  auto *Arg = Args.getLastArg(OPT_entry, OPT_no_entry);
283
0
  if (!Arg)
284
0
    return Default;
285
0
  if (Arg->getOption().getID() == OPT_no_entry)
286
0
    return "";
287
0
  return Arg->getValue();
288
0
}
289
290
static const uint8_t UnreachableFn[] = {
291
    0x03 /* ULEB length */, 0x00 /* ULEB num locals */,
292
    0x00 /* opcode unreachable */, 0x0b /* opcode end */
293
};
294
295
// For weak undefined functions, there may be "call" instructions that reference
296
// the symbol. In this case, we need to synthesise a dummy/stub function that
297
// will abort at runtime, so that relocations can still provided an operand to
298
// the call instruction that passes Wasm validation.
299
0
static void handleWeakUndefines() {
300
0
  for (Symbol *Sym : Symtab->getSymbols()) {
301
0
    if (!Sym->isUndefined() || !Sym->isWeak())
302
0
      continue;
303
0
    auto *FuncSym = dyn_cast<FunctionSymbol>(Sym);
304
0
    if (!FuncSym)
305
0
      continue;
306
0
307
0
    // It is possible for undefined functions not to have a signature (eg. if
308
0
    // added via "--undefined"), but weak undefined ones do have a signature.
309
0
    assert(FuncSym->FunctionType);
310
0
    const WasmSignature &Sig = *FuncSym->FunctionType;
311
0
312
0
    // Add a synthetic dummy for weak undefined functions.  These dummies will
313
0
    // be GC'd if not used as the target of any "call" instructions.
314
0
    Optional<std::string> SymName = demangleItanium(Sym->getName());
315
0
    StringRef DebugName =
316
0
        Saver.save("undefined function " +
317
0
                   (SymName ? StringRef(*SymName) : Sym->getName()));
318
0
    SyntheticFunction *Func =
319
0
        make<SyntheticFunction>(Sig, Sym->getName(), DebugName);
320
0
    Func->setBody(UnreachableFn);
321
0
    // Ensure it compares equal to the null pointer, and so that table relocs
322
0
    // don't pull in the stub body (only call-operand relocs should do that).
323
0
    Func->setTableIndex(0);
324
0
    Symtab->SyntheticFunctions.emplace_back(Func);
325
0
    // Hide our dummy to prevent export.
326
0
    uint32_t Flags = WASM_SYMBOL_VISIBILITY_HIDDEN;
327
0
    replaceSymbol<DefinedFunction>(Sym, Sym->getName(), Flags, nullptr, Func);
328
0
  }
329
0
}
330
331
// Force Sym to be entered in the output. Used for -u or equivalent.
332
0
static Symbol *handleUndefined(StringRef Name) {
333
0
  Symbol *Sym = Symtab->find(Name);
334
0
  if (!Sym)
335
0
    return nullptr;
336
0
337
0
  // Since symbol S may not be used inside the program, LTO may
338
0
  // eliminate it. Mark the symbol as "used" to prevent it.
339
0
  Sym->IsUsedInRegularObj = true;
340
0
341
0
  if (auto *LazySym = dyn_cast<LazySymbol>(Sym))
342
0
    LazySym->fetch();
343
0
344
0
  return Sym;
345
0
}
346
347
0
void LinkerDriver::link(ArrayRef<const char *> ArgsArr) {
348
0
  WasmOptTable Parser;
349
0
  opt::InputArgList Args = Parser.parse(ArgsArr.slice(1));
350
0
351
0
  // Handle --help
352
0
  if (Args.hasArg(OPT_help)) {
353
0
    Parser.PrintHelp(outs(), ArgsArr[0], "LLVM Linker", false);
354
0
    return;
355
0
  }
356
0
357
0
  // Handle --version
358
0
  if (Args.hasArg(OPT_version) || Args.hasArg(OPT_v)) {
359
0
    outs() << getLLDVersion() << "\n";
360
0
    return;
361
0
  }
362
0
363
0
  // Parse and evaluate -mllvm options.
364
0
  std::vector<const char *> V;
365
0
  V.push_back("wasm-ld (LLVM option parsing)");
366
0
  for (auto *Arg : Args.filtered(OPT_mllvm))
367
0
    V.push_back(Arg->getValue());
368
0
  cl::ParseCommandLineOptions(V.size(), V.data());
369
0
370
0
  errorHandler().ErrorLimit = args::getInteger(Args, OPT_error_limit, 20);
371
0
372
0
  Config->AllowUndefined = Args.hasArg(OPT_allow_undefined);
373
0
  Config->Demangle = Args.hasFlag(OPT_demangle, OPT_no_demangle, true);
374
0
  Config->DisableVerify = Args.hasArg(OPT_disable_verify);
375
0
  Config->Entry = getEntry(Args, Args.hasArg(OPT_relocatable) ? "" : "_start");
376
0
  Config->ExportAll = Args.hasArg(OPT_export_all);
377
0
  Config->ExportTable = Args.hasArg(OPT_export_table);
378
0
  errorHandler().FatalWarnings =
379
0
      Args.hasFlag(OPT_fatal_warnings, OPT_no_fatal_warnings, false);
380
0
  Config->ImportMemory = Args.hasArg(OPT_import_memory);
381
0
  Config->ImportTable = Args.hasArg(OPT_import_table);
382
0
  Config->LTOO = args::getInteger(Args, OPT_lto_O, 2);
383
0
  Config->LTOPartitions = args::getInteger(Args, OPT_lto_partitions, 1);
384
0
  Config->Optimize = args::getInteger(Args, OPT_O, 0);
385
0
  Config->OutputFile = Args.getLastArgValue(OPT_o);
386
0
  Config->Relocatable = Args.hasArg(OPT_relocatable);
387
0
  Config->GcSections =
388
0
      Args.hasFlag(OPT_gc_sections, OPT_no_gc_sections, !Config->Relocatable);
389
0
  Config->MergeDataSegments =
390
0
      Args.hasFlag(OPT_merge_data_segments, OPT_no_merge_data_segments,
391
0
                   !Config->Relocatable);
392
0
  Config->PrintGcSections =
393
0
      Args.hasFlag(OPT_print_gc_sections, OPT_no_print_gc_sections, false);
394
0
  Config->SaveTemps = Args.hasArg(OPT_save_temps);
395
0
  Config->SearchPaths = args::getStrings(Args, OPT_L);
396
0
  Config->StripAll = Args.hasArg(OPT_strip_all);
397
0
  Config->StripDebug = Args.hasArg(OPT_strip_debug);
398
0
  Config->CompressRelocTargets = Args.hasArg(OPT_compress_relocations);
399
0
  Config->StackFirst = Args.hasArg(OPT_stack_first);
400
0
  Config->ThinLTOCacheDir = Args.getLastArgValue(OPT_thinlto_cache_dir);
401
0
  Config->ThinLTOCachePolicy = CHECK(
402
0
      parseCachePruningPolicy(Args.getLastArgValue(OPT_thinlto_cache_policy)),
403
0
      "--thinlto-cache-policy: invalid cache policy");
404
0
  Config->ThinLTOJobs = args::getInteger(Args, OPT_thinlto_jobs, -1u);
405
0
  errorHandler().Verbose = Args.hasArg(OPT_verbose);
406
0
  ThreadsEnabled = Args.hasFlag(OPT_threads, OPT_no_threads, true);
407
0
408
0
  Config->InitialMemory = args::getInteger(Args, OPT_initial_memory, 0);
409
0
  Config->GlobalBase = args::getInteger(Args, OPT_global_base, 1024);
410
0
  Config->MaxMemory = args::getInteger(Args, OPT_max_memory, 0);
411
0
  Config->ZStackSize =
412
0
      args::getZOptionValue(Args, OPT_z, "stack-size", WasmPageSize);
413
0
414
0
  if (!Config->StripDebug && !Config->StripAll && Config->CompressRelocTargets)
415
0
    error("--compress-relocations is incompatible with output debug"
416
0
          " information. Please pass --strip-debug or --strip-all");
417
0
418
0
  if (Config->LTOO > 3)
419
0
    error("invalid optimization level for LTO: " + Twine(Config->LTOO));
420
0
  if (Config->LTOPartitions == 0)
421
0
    error("--lto-partitions: number of threads must be > 0");
422
0
  if (Config->ThinLTOJobs == 0)
423
0
    error("--thinlto-jobs: number of threads must be > 0");
424
0
425
0
  if (auto *Arg = Args.getLastArg(OPT_allow_undefined_file))
426
0
    readImportFile(Arg->getValue());
427
0
428
0
  if (!Args.hasArg(OPT_INPUT)) {
429
0
    error("no input files");
430
0
    return;
431
0
  }
432
0
433
0
  if (Config->OutputFile.empty())
434
0
    error("no output file specified");
435
0
436
0
  if (Config->ImportTable && Config->ExportTable)
437
0
    error("--import-table and --export-table may not be used together");
438
0
439
0
  if (Config->Relocatable) {
440
0
    if (!Config->Entry.empty())
441
0
      error("entry point specified for relocatable output file");
442
0
    if (Config->GcSections)
443
0
      error("-r and --gc-sections may not be used together");
444
0
    if (Config->CompressRelocTargets)
445
0
      error("-r -and --compress-relocations may not be used together");
446
0
    if (Args.hasArg(OPT_undefined))
447
0
      error("-r -and --undefined may not be used together");
448
0
  }
449
0
450
0
  Symbol *EntrySym = nullptr;
451
0
  if (!Config->Relocatable) {
452
0
    llvm::wasm::WasmGlobal Global;
453
0
    Global.Type = {WASM_TYPE_I32, true};
454
0
    Global.InitExpr.Value.Int32 = 0;
455
0
    Global.InitExpr.Opcode = WASM_OPCODE_I32_CONST;
456
0
    Global.SymbolName = "__stack_pointer";
457
0
    InputGlobal *StackPointer = make<InputGlobal>(Global, nullptr);
458
0
    StackPointer->Live = true;
459
0
460
0
    static WasmSignature NullSignature = {{}, WASM_TYPE_NORESULT};
461
0
462
0
    // Add synthetic symbols before any others
463
0
    WasmSym::CallCtors = Symtab->addSyntheticFunction(
464
0
        "__wasm_call_ctors", WASM_SYMBOL_VISIBILITY_HIDDEN,
465
0
        make<SyntheticFunction>(NullSignature, "__wasm_call_ctors"));
466
0
    // TODO(sbc): Remove WASM_SYMBOL_VISIBILITY_HIDDEN when the mutable global
467
0
    // spec proposal is implemented in all major browsers.
468
0
    // See: https://github.com/WebAssembly/mutable-global
469
0
    WasmSym::StackPointer = Symtab->addSyntheticGlobal(
470
0
        "__stack_pointer", WASM_SYMBOL_VISIBILITY_HIDDEN, StackPointer);
471
0
    WasmSym::HeapBase = Symtab->addSyntheticDataSymbol("__heap_base", 0);
472
0
    WasmSym::DsoHandle = Symtab->addSyntheticDataSymbol(
473
0
        "__dso_handle", WASM_SYMBOL_VISIBILITY_HIDDEN);
474
0
    WasmSym::DataEnd = Symtab->addSyntheticDataSymbol("__data_end", 0);
475
0
  }
476
0
477
0
  createFiles(Args);
478
0
  if (errorCount())
479
0
    return;
480
0
481
0
  // Add all files to the symbol table. This will add almost all
482
0
  // symbols that we need to the symbol table.
483
0
  for (InputFile *F : Files)
484
0
    Symtab->addFile(F);
485
0
  if (errorCount())
486
0
    return;
487
0
488
0
  // Handle the `--undefined <sym>` options.
489
0
  for (auto *Arg : Args.filtered(OPT_undefined))
490
0
    handleUndefined(Arg->getValue());
491
0
492
0
  // Handle the `--export <sym>` options
493
0
  // This works like --undefined but also exports the symbol if its found
494
0
  for (auto *Arg : Args.filtered(OPT_export)) {
495
0
    Symbol *Sym = handleUndefined(Arg->getValue());
496
0
    if (Sym && Sym->isDefined())
497
0
      Sym->ForceExport = true;
498
0
    else if (!Config->AllowUndefined)
499
0
      error(Twine("symbol exported via --export not found: ") +
500
0
            Arg->getValue());
501
0
  }
502
0
503
0
  if (!Config->Relocatable) {
504
0
    // Add synthetic dummies for weak undefined functions.
505
0
    handleWeakUndefines();
506
0
507
0
    if (!Config->Entry.empty()) {
508
0
      EntrySym = handleUndefined(Config->Entry);
509
0
      if (!EntrySym)
510
0
        error("entry symbol not defined (pass --no-entry to supress): " +
511
0
              Config->Entry);
512
0
    }
513
0
514
0
    // Make sure we have resolved all symbols.
515
0
    if (!Config->AllowUndefined)
516
0
      Symtab->reportRemainingUndefines();
517
0
  }
518
0
519
0
  if (errorCount())
520
0
    return;
521
0
522
0
  // Do link-time optimization if given files are LLVM bitcode files.
523
0
  // This compiles bitcode files into real object files.
524
0
  Symtab->addCombinedLTOObject();
525
0
  if (errorCount())
526
0
    return;
527
0
528
0
  if (EntrySym)
529
0
    EntrySym->setHidden(false);
530
0
531
0
  if (errorCount())
532
0
    return;
533
0
534
0
  // Do size optimizations: garbage collection
535
0
  markLive();
536
0
537
0
  // Write the result to the file.
538
0
  writeResult();
539
0
}