Skip to content

Whistler Oxidation 2019

Nicholas Nethercote edited this page Jun 20, 2019 · 3 revisions

Metadata

Compile time

  • njn: Cargo pipelining works in Nightly, use CARGO_PIPELINING=true
  • Sample speedups for opt builds: Webrender 1.27x, Cranelift 1.20x, Firefox 1.07x
  • On the path to stabilization
  • niko: any reason not to turn on?
    • njn: not really; doesn't slow things down because it just changes the order in which work is done
    • requires Nightly, some people don't want to use that because it sometimes breaks Firefox compilation

Code optimization

Rust XPCOM components

Things in progress

  • niko: rustc:
    • Parallelized rustc "coming soon"
    • not yet enabled or available, but we're in "data measure and document"
    • if you're editing Rust code (or just running mach cargo check), potentially a win
  • dragana: neqo - QUIC implentation in rust
    • Now integrated with platform code! (Not in m-c yet, but getting close)

New (proposed) Rust code in Firefox

  • erahm: Rewriting crash reporting in Rust
    • Can use ecosystem for parsing object files, which should make things much easier for us. (Leveraging Sentry's crates)
  • ashley: considering rewriting Spidermonkey frontend in Rust (parser, etc.)
    • Currently 60k lines of C++

Oxidation wiki

Difficulties with Rust in Firefox

  • erahm: Compilation is sloooowww. File bugs if you find specific scenarios!
  • gandalf: Using WebIDL maplikes in Rust is hard...and, in general, WebIDL needs better Rust bindings!
    • We basically need a structure with the same layout as an nsTHashtable in Rust! (Like ThinVec and nsTArray)
      • froydnj: I might be able to do that, though hashtable are obviously more complex than vectors
  • lina: Using jsvals in Rust!
    • We have Rust bindings for SpiderMonkey in the tree...in theory!
    • It'd be nice to use promises, access JS object properties...
  • bryce: Valgrind false positives due to optimized Rust code branching on an uninitialized value in the MP4 parser tripped fuzzing
    • Hard to verify if it's actually safe!
    • njn: LLVM generates code violating valgrind's assumptions
      • I will talk to jseward to see if anything has improved, might be no good answers
        • Update: jseward has a plan, but it's a non-trivial amount of work and may take some time

Questions

  • lina: Do we have a policy for vendoring non-Mozilla crates?
    • froydnj: mostly a licensing question
      • Whoever does main review should also take a look at the crate, especially if it involves unsafe code.
      • No formal signoff, :glob is working on requirements for this.
  • lina: Do we support building standalone Rust code (not linked into libxul)?
    • glandium: Yes...in theory. GeckoDriver is a binary, for example.
    • froydnj: We have examples of host and target programs.
      • Search for RUST_PROGRAMS
  • lina: How do we test in-tree Rust crates?
    • rust-test job runs on Treeherder (mostly Stylo tests, maybe something else now?)
      • Runs cargo test
      • Search for RUST_TESTS in moz.build
    • froydnj: GTest + FFI is probably best.
    • We don't run third-party tests.
    • Side note: for vendored crates, exclude large test fixtures from Cargo packages! We don't want 5 different copies of Sherlock Holmes in m-c.
  • yury: question about wasm
    • devtools uses two crates, would be nice to vendor them?
    • froydnj: should be doable, file a bug
  • jld: any Rust-related issues with IPC? IPC is currently only C++-to-C++, pretty much
    • gsvelto: I would use it!
Clone this wiki locally