Skip to content

JamesPatrickGill/nova

 
 

Repository files navigation

Nova - Your favorite javascript and wasm engine

⚠️ This project is a Work In Progress, and is very far from being suitable for use ⚠️

Nova is a JavaScript and WebAssembly engine written in Rust.

The engine is exposed as a library with an API for implementation in Rust projects which themselves must serve as a runtime for JavaScript code. The execution model is currently greatly inspired by Kiesel and SerenityOS's LibJS. See the code for more details.

The core of our team is on our Discord server.

Talks

Slides: Google Drive

Presented at the Finland Rust-lang group's January meetup, 2024. Focus on how JavaScript engines work in general, and what sort of design choices Nova makes in this context.

Slides: Google Drive

Presented at the Web Engines Hackfest, 2024. Focus on the details of why a data-oriented engine design is interesting, what sort of benefits it gives and what sort of costs it has. Explores the engine at a slightly deeper level.

The talk was revisited at the TC39 June meeting, 2024. No video is available, but the slightly modified slides are.

TC39 slides: Google Drive

The architecture of the engine follows the ECMAScript specification in spirit, but uses data-oriented design for the actual implementation. Records that are present in the specification are likely present in the Nova engine as well and they're likely found in an "equivalent" file / folder path as the specification defines them in.

Where the engine differs from the specification is that most ECMAScript types and specification Record types are defined "twice": They have one "heap data" definition, and another "index" definition. The heap data definition generally corresponds to the specification's definition, in some degree at least. The index definition is either a wrapper around u32 or a NonZeroU32. Most spec defined methods are defined on the index definitions (this avoids issues with borrowing).

The only case when direct "Record type A contains Record type B" ownership is used is when there can be only one referrer to the Record type B.

Heap structure - Data-oriented design

Reading the above, you might be wondering why the double-definitions and all that. The ultimate reason is two-fold:

  1. It is an interesting design.
  2. It helps the computer make frequently used things fast while allowing the infrequently used things to become slow.

Data-oriented design is all the rage on the Internet because of its cache-friendliness. This engine is one more attempt at seeing what sort of real-world benefits one might gain with this sort of architecture.

If you find yourself interested in where the idea spawns from and why, take a look at the Heap README.md. It gives a more thorough walkthrough of the Heap structure and what the idea there is.

So you wish to contribute, eh? You're very welcome to do so! Please take a look at the CONTRIBUTING.md.

Releases

No releases published

Packages

No packages published

Languages

  • Rust 99.9%
  • JavaScript 0.1%