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

feat: implement rodata initialization #260

Closed
wants to merge 20 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
1dac466
wip: unify compilation, rodata init, test harness
bitwalker Jul 26, 2024
093d75f
wip: derive source spans from dwarf debug info in wasm frontend
bitwalker Jul 26, 2024
20b6022
feat(codegen): propagate source spans from hir to masm
bitwalker Jul 30, 2024
401845e
wip: refactor compiler test instantiation/configuration
bitwalker Jul 30, 2024
a7c4390
chore: bump rust toolchain
bitwalker Aug 2, 2024
126e7c5
refactor: unify diagnostics infa between compiler, assembler, vm
bitwalker Aug 2, 2024
e573066
wip: update to latest miden vm patchset
bitwalker Aug 4, 2024
5ec7db7
wip: support compiled libraries, linker flags
bitwalker Aug 5, 2024
453467c
fix: clap error formatting, unused deps
bitwalker Aug 5, 2024
34ed979
fix(cli): improve help output, hide plumbing flags
bitwalker Aug 5, 2024
c3af0cc
chore: move miden-vm deps to latest commit included in 0.10 releasef
bitwalker Aug 6, 2024
9d5a839
refactor: unify branch successor repr, support switch arms with argum…
bitwalker Aug 6, 2024
1b17a2f
test: use nextest test runner
bitwalker Aug 6, 2024
833a7e9
fix: bug in program.has_entrypoint
bitwalker Aug 6, 2024
768da77
fix: handle behavior change between codemap and sourcemanager
bitwalker Aug 6, 2024
2a61993
test: temporarily disable i128 tests until emulator supports mast
bitwalker Aug 6, 2024
651edfe
test: disable tx_kernel and stdlib tests until rodata issues fixed
bitwalker Aug 6, 2024
e3538fc
feat: improve inference of project type based on driver flags
bitwalker Aug 6, 2024
fd91a8a
fix: various tests, cli bugs, vm test executor, test builder api
bitwalker Aug 6, 2024
e319222
fix: linking of standard library in tests
bitwalker Aug 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 93 additions & 9 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 4 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,10 @@ thiserror = { version = "1.0", git = "https://github.com/bitwalker/thiserror", b
toml = { version = "0.8", features = ["preserve_order"] }
derive_more = "0.99"
indexmap = "2.1"
# 2da11ad0a975d2e5d6a2582871f0c89b820b3ffa is the latest commit in 'next' that includes
# the absolute paths support
miden-assembly = { git = "https://github.com/0xPolygonMiden/miden-vm", rev = "2da11ad0a975d2e5d6a2582871f0c89b820b3ffa" }
miden-core = { git = "https://github.com/0xPolygonMiden/miden-vm", rev = "2da11ad0a975d2e5d6a2582871f0c89b820b3ffa" }
miden-processor = { git = "https://github.com/0xPolygonMiden/miden-vm", rev = "2da11ad0a975d2e5d6a2582871f0c89b820b3ffa" }
miden-stdlib = { git = "https://github.com/0xPolygonMiden/miden-vm", rev = "2da11ad0a975d2e5d6a2582871f0c89b820b3ffa" }
miden-assembly = { git = "https://github.com/0xPolygonMiden/miden-vm", rev = "f194eb4e25f568b370164b8cb1bcdd7bb972f427" }
miden-core = { git = "https://github.com/0xPolygonMiden/miden-vm", rev = "f194eb4e25f568b370164b8cb1bcdd7bb972f427" }
miden-processor = { git = "https://github.com/0xPolygonMiden/miden-vm", rev = "f194eb4e25f568b370164b8cb1bcdd7bb972f427" }
miden-stdlib = { git = "https://github.com/0xPolygonMiden/miden-vm", rev = "f194eb4e25f568b370164b8cb1bcdd7bb972f427" }
midenc-codegen-masm = { path = "codegen/masm" }
miden-diagnostics = "0.1"
midenc-hir = { path = "hir" }
Expand Down
1 change: 1 addition & 0 deletions codegen/masm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ log.workspace = true
miden-assembly.workspace = true
miden-core.workspace = true
miden-diagnostics.workspace = true
miden-processor.workspace = true
miden-stdlib.workspace = true
midenc-hir.workspace = true
midenc-hir-analysis.workspace = true
Expand Down
10 changes: 9 additions & 1 deletion codegen/masm/src/codegen/emitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1064,8 +1064,16 @@ impl<'b, 'f: 'b> BlockEmitter<'b, 'f> {
}
// Entering a top-level loop, set the controlling loop
(None, controlling_loop @ Some(_)) => {
for l in self.function.loops.loops() {
dbg!(l, self.function.loops.loop_header(l));
dbg!(self.function.loops.is_in_loop(current_block, l));
dbg!(self.function.loops.is_in_loop(target_block, l));
}
assert!(is_first_visit);
assert_eq!(self.controlling_loop, None);
assert_eq!(
self.controlling_loop, None,
"expected no controlling loop entering {target_block} from {current_block}"
);
controlling_loop
}
// Escaping a loop
Expand Down
11 changes: 7 additions & 4 deletions codegen/masm/src/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,15 @@ impl ConversionPass for ConvertHirToMasm<hir::Program> {
analyses: &mut AnalysisManager,
session: &Session,
) -> ConversionResult<Self::To> {
let mut masm_program = Box::new(masm::Program::from_hir(&program));
// Ensure global variable analysis is computed
let globals =
analyses.get_or_compute::<ProgramGlobalVariableAnalysis>(&program, session)?;

let mut masm_program = Box::new(masm::Program::from_hir(&program, &globals));

// Remove the set of modules to compile from the program
let modules = program.modules_mut().take();

// Ensure global variable analysis is computed
analyses.get_or_compute::<ProgramGlobalVariableAnalysis>(&program, session)?;

for module in modules.into_iter() {
// Convert the module
let mut convert_to_masm = ConvertHirToMasm::<hir::Module>::default();
Expand Down Expand Up @@ -153,6 +154,8 @@ impl<'a> ConversionPass for ConvertHirToMasm<&'a hir::Function> {
) -> ConversionResult<Self::To> {
use midenc_hir::ProgramAnalysisKey;

println!("{f}");

let mut f_prime = masm::Function::new(f.id, f.signature.clone());

// Start at the function entry
Expand Down
1 change: 1 addition & 0 deletions codegen/masm/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![feature(array_windows)]
#![feature(iter_array_chunks)]
#![feature(is_sorted)]

mod codegen;
Expand Down
Loading