Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release: prepare for 0.0.6 release #309

Merged
merged 84 commits into from
Sep 6, 2024
Merged

release: prepare for 0.0.6 release #309

merged 84 commits into from
Sep 6, 2024

Conversation

bitwalker
Copy link
Contributor

This PR merges our current next branch into main, which will make the documentation available for publishing. Subsequent to this PR, we'll publish 0.0.6 containing some recent fixes relied upon in the updated docs.

@bobbinth @Dominik1999 I've added you as reviewers in case either of you are available still this afternoon/evening, and can approve this to keep things moving along. Otherwise, we'll probably have to put this off until Monday when @greenhat can get to it.

greenhat and others added 30 commits August 16, 2024 11:22
Release v0.0.1 (take 5): Initial release of the compiler and SDK crates
Previous to this commit, we were expecting the rodata segments to be
encoded in a specific order, and placed on the advice stack before
anything else. With this commit, we now simply expect to the advice map
to contain each segment keyed by its commitment hash, which we then move
to the advice stack on demand, and immediately pipe to memory.

This means the order of the segments no longer matters, and the advice
stack is not sensitive to codegen changes or other influences which
might perturb the advice stack or otherwise disrupt our assumptions. It
also sets the stage for us to be able to initialize rodata after a
context switch, as at that point the advice stack will be in an unknown
condition, and using the advice map gives us certainty that we can
arrange to have exactly what we need on the advice stack, when we need
it.

Additionally, I've updated the `midenc debug` input config file, as well
as the usage documentation to reflect this.

The last related change to this, will be emitting the rodata segments to
disk in a convenient form, so that when the compiler emits the program,
it also emits the segments alongside it, making it convenient to run the
debugger against that program (or via the VM directly).
This commit implements a basic package format for Miden programs and
libraries, with the metadata needed to simplify using them together. The
format is experimental, and can be changed at any time, however it does
use a header that lets us identify whether a package was produced with
the same specification or not.

This also modifies the compiler and debugger to emit and consume,
respectively, the package format as their primary artifact. The debugger
uses this, for example, to initialize the VM with the necessary
libraries and rodata segments required by the program.

The package format is described using the structures in
`codegen/masm/src/packaging/package.rs`, and is encoded using a tiny,
but efficient binary format from the `bitcode` crate, using `serde` to
facilitate the lowering of our high-level types to that format. This
made it relatively straightforward to implement the format without
having to mess around with the low-level byte representation. The
`bitcode` crate is designed with stability in mind, though because we
are using it via `serde`, the stability is subject to being violated if
`serde` changes something that causes `bitcode` to serialize a type
differently. For now, this is a non-issue, longer term we might want to
actually implement `bitcode::{Encode, Decode}` for our types if we want
to gain more stability.
Some recent changes caused the `midenc compile` command to emit no
outputs when `--emit` was not provided.

Also fixed:

* Moved some unnecessary debug logs to trace level
* Added more debug logging to the compiler to aid in troubleshooting
* Fixed serialization of packages involving more complex inputs which
  were hitting an issue with fields marked as skippable via serde; this
  is not supported via bitcode, so those attributes were removed
It turns out we were assuming that Rust was laying out its memory using
the default LLVM layout, but rustc actually specifies a larger shadow
stack. We were not properly handling the defined memory in Wasm modules
parsed by the frontend, and so we ended up incorrectly placing global
variables and other data in the middle of memory that rust was using for
either the shadow stack or static data. Because of the size of the
shadow stack region reserved by Rust, this was not causing any
corruption in our tests, but it was causing other assumptions to be
invalid, and miscompilations were the result.

This commit treats the Wasm memory for a parsed module as reserved for
use by the code in that module, which causes midenc to place any global
variables it defines after that region, and computes the start of the
heap as immediately following any such data. It does so by propagating
the page size and reserved number of pages through the IR and to the
backend, taking that information into account as needed.
feat: introduce experimental packaging format
Implement memory intrinsics for storing double word (i64/u64)
greenhat and others added 23 commits August 30, 2024 14:58
…ace-version

chore: switch all crates to a single workspace version (0.0.5)
chore: fix mkdocs warnings, move cargo-miden README to docs
Copy link
Contributor

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thank you! Not a review at all, but always good to see removal of almost 10 KLOCs :)

@bitwalker
Copy link
Contributor Author

always good to see removal of almost 10 KLOCs :)

Definitely :). I'm hoping we can further simplify some things in upcoming releases, we'll see how it goes!

@bitwalker bitwalker merged commit a48d095 into main Sep 6, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants