Skip to content

Commit

Permalink
Merge branch 'next' into plafer-mast-library-compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
plafer committed Jul 24, 2024
2 parents c0ee866 + 454d344 commit f12ce36
Show file tree
Hide file tree
Showing 60 changed files with 1,366 additions and 2,076 deletions.
10 changes: 7 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

- Added error codes support for the `mtree_verify` instruction (#1328).
- Added support for immediate values for `lt`, `lte`, `gt`, `gte` comparison instructions (#1346).
- Change MAST to a table-based representation (#1349)
- Introduce `MastForestStore` (#1359)
- Changed MAST to a table-based representation (#1349)
- Introduced `MastForestStore` (#1359)
- Adjusted prover's metal acceleration code to work with 0.9 versions of the crates (#1357)
- Added support for immediate values for `u32lt`, `u32lte`, `u32gt`, `u32gte`, `u32min` and `u32max` comparison instructions (#1358).
- Added support for the `nop` instruction, which corresponds to the VM opcode of the same name, and has the same semantics. This is implemented for use by compilers primarily.
Expand All @@ -19,11 +19,15 @@
- Add serialization/deserialization for `MastForest` (#1370)
- Assembler: add the ability to compile MAST libraries, and to assemble a program using compiled libraries (#1401)
- Updated CI to support `CHANGELOG.md` modification checking and `no changelog` label (#1406)
- Introduce `MastForestError` to enforce `MastForest` node count invariant (#1394)
- Introduced `MastForestError` to enforce `MastForest` node count invariant (#1394)
- Added functions to `MastForestBuilder` to allow ensuring of nodes with fewer LOC (#1404)
- Make `Assembler` single-use (#1409)
- Remove `ProcedureCache` from the assembler (#1411).

#### Changed

- When using `if.(true|false) .. end`, the parser used to emit an empty block for the branch that was elided. The parser now emits a block containing a single `nop` instruction instead, which is equivalent to the code emitted by the assembler when lowering to MAST.
- `internals` configuration feature was renamed to `testing` (#1399).

## 0.9.2 (2024-05-22) - `stdlib` crate only

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ mdbook: ## Generates mdbook documentation

.PHONY: test
test: ## Runs all tests
$(DEBUG_ASSERTIONS) cargo nextest run --cargo-profile test-release --features internals
$(DEBUG_ASSERTIONS) cargo nextest run --cargo-profile test-release --features testing

# --- checking ------------------------------------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion air/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ harness = false
[features]
default = ["std"]
std = ["vm-core/std", "winter-air/std"]
internals = []
testing = []

[dependencies]
vm-core = { package = "miden-core", path = "../core", version = "0.9", default-features = false }
Expand Down
4 changes: 2 additions & 2 deletions air/src/trace/main_trace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use super::{
use core::ops::{Deref, Range};
use vm_core::{utils::range, Felt, Word, ONE, ZERO};

#[cfg(any(test, feature = "internals"))]
#[cfg(any(test, feature = "testing"))]
use alloc::vec::Vec;

// CONSTANTS
Expand Down Expand Up @@ -54,7 +54,7 @@ impl MainTrace {
self.columns.num_rows()
}

#[cfg(any(test, feature = "internals"))]
#[cfg(any(test, feature = "testing"))]
pub fn get_column_range(&self, range: Range<usize>) -> Vec<Vec<Felt>> {
range.fold(vec![], |mut acc, col_idx| {
acc.push(self.get_column(col_idx).to_vec());
Expand Down
22 changes: 10 additions & 12 deletions assembly/src/assembler/basic_block_builder.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
use crate::AssemblyError;

use super::{
mast_forest_builder::MastForestBuilder, AssemblyContext, BodyWrapper, Decorator, DecoratorList,
Instruction,
mast_forest_builder::MastForestBuilder, BodyWrapper, Decorator, DecoratorList, Instruction,
ProcedureContext,
};
use alloc::{borrow::Borrow, string::ToString, vec::Vec};
use vm_core::{
mast::{MastForestError, MastNode, MastNodeId},
AdviceInjector, AssemblyOp, Operation,
};
use vm_core::{mast::MastNodeId, AdviceInjector, AssemblyOp, Operation};

// BASIC BLOCK BUILDER
// ================================================================================================
Expand Down Expand Up @@ -85,8 +84,8 @@ impl BasicBlockBuilder {
///
/// This indicates that the provided instruction should be tracked and the cycle count for
/// this instruction will be computed when the call to set_instruction_cycle_count() is made.
pub fn track_instruction(&mut self, instruction: &Instruction, ctx: &AssemblyContext) {
let context_name = ctx.unwrap_current_procedure().name().to_string();
pub fn track_instruction(&mut self, instruction: &Instruction, proc_ctx: &ProcedureContext) {
let context_name = proc_ctx.name().to_string();
let num_cycles = 0;
let op = instruction.to_string();
let should_break = instruction.should_break();
Expand Down Expand Up @@ -129,13 +128,12 @@ impl BasicBlockBuilder {
pub fn make_basic_block(
&mut self,
mast_forest_builder: &mut MastForestBuilder,
) -> Result<Option<MastNodeId>, MastForestError> {
) -> Result<Option<MastNodeId>, AssemblyError> {
if !self.ops.is_empty() {
let ops = self.ops.drain(..).collect();
let decorators = self.decorators.drain(..).collect();

let basic_block_node = MastNode::new_basic_block_with_decorators(ops, decorators);
let basic_block_node_id = mast_forest_builder.ensure_node(basic_block_node)?;
let basic_block_node_id = mast_forest_builder.ensure_block(ops, Some(decorators))?;

Ok(Some(basic_block_node_id))
} else if !self.decorators.is_empty() {
Expand All @@ -158,7 +156,7 @@ impl BasicBlockBuilder {
pub fn try_into_basic_block(
mut self,
mast_forest_builder: &mut MastForestBuilder,
) -> Result<Option<MastNodeId>, MastForestError> {
) -> Result<Option<MastNodeId>, AssemblyError> {
self.ops.append(&mut self.epilogue);
self.make_basic_block(mast_forest_builder)
}
Expand Down
237 changes: 0 additions & 237 deletions assembly/src/assembler/context.rs

This file was deleted.

8 changes: 4 additions & 4 deletions assembly/src/assembler/id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ use crate::ast::ProcedureIndex;
/// </div>
///
/// In addition to the [super::ModuleGraph], these indices are also used with an instance of a
/// [super::ProcedureCache]. This is because the [super::ModuleGraph] and [super::ProcedureCache]
/// instances are paired, i.e. the [super::ModuleGraph] stores the syntax trees and call graph
/// analysis for a program, while the [super::ProcedureCache] caches the compiled
/// [super::Procedure]s for the same program, as derived from the corresponding graph.
/// [super::MastForestBuilder]. This is because the [super::ModuleGraph] and
/// [super::MastForestBuilder] instances are paired, i.e. the [super::ModuleGraph] stores the syntax
/// trees and call graph analysis for a program, while the [super::MastForestBuilder] caches the
/// compiled [super::Procedure]s for the same program, as derived from the corresponding graph.
///
/// This is intended for use when we are doing global inter-procedural analysis on a (possibly
/// growable) set of modules. It is expected that the index of a module in the set, as well as the
Expand Down
Loading

0 comments on commit f12ce36

Please sign in to comment.