Skip to content

Commit

Permalink
fix: Remove usage of group_vector_elements() from combine_blocks() (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbinth authored May 9, 2024
1 parent 9abd8d1 commit 00a460f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
15 changes: 8 additions & 7 deletions assembly/src/assembler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use super::{
use alloc::collections::BTreeMap;
use alloc::vec::Vec;
use core::{borrow::Borrow, cell::RefCell};
use vm_core::{utils::group_vector_elements, Decorator, DecoratorList};
use vm_core::{Decorator, DecoratorList};

mod instruction;

Expand Down Expand Up @@ -467,12 +467,13 @@ fn combine_blocks(mut blocks: Vec<CodeBlock>) -> CodeBlock {
while blocks.len() > 1 {
let last_block = if blocks.len() % 2 == 0 { None } else { blocks.pop() };

let mut grouped_blocks = Vec::new();
core::mem::swap(&mut blocks, &mut grouped_blocks);
let mut grouped_blocks = group_vector_elements::<CodeBlock, 2>(grouped_blocks);
grouped_blocks.drain(0..).for_each(|pair| {
blocks.push(CodeBlock::new_join(pair));
});
let mut source_blocks = Vec::new();
core::mem::swap(&mut blocks, &mut source_blocks);

let mut source_block_iter = source_blocks.drain(0..);
while let (Some(left), Some(right)) = (source_block_iter.next(), source_block_iter.next()) {
blocks.push(CodeBlock::new_join([left, right]));
}

if let Some(block) = last_block {
blocks.push(block);
Expand Down
1 change: 0 additions & 1 deletion stdlib/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ type ModuleMap = BTreeMap<String, ModuleAst>;

/// Read and parse the contents from `./asm` into a `LibraryContents` struct, serializing it into
/// `assets` folder under `std` namespace.
#[cfg(not(feature = "docs-rs"))]
fn main() -> io::Result<()> {
// re-build the `[OUT_DIR]/assets/std.masl` file iff something in the `./asm` directory
// or its builder changed:
Expand Down

0 comments on commit 00a460f

Please sign in to comment.