diff --git a/src/printer.rs b/src/printer.rs index 60cc48e..7bb0034 100644 --- a/src/printer.rs +++ b/src/printer.rs @@ -34,7 +34,10 @@ use serde::{Serialize, Serializer}; use stable_mir::{ abi::LayoutShape, mir::mono::{Instance, InstanceKind, MonoItem}, - mir::{alloc::AllocId, visit::MirVisitor, Body, LocalDecl, Rvalue, Terminator, TerminatorKind}, + mir::{ + alloc::AllocId, alloc::GlobalAlloc, visit::MirVisitor, Body, LocalDecl, Rvalue, Terminator, + TerminatorKind, + }, ty::{AdtDef, Allocation, ConstDef, ForeignItemKind, IndexedVal, RigidTy, TyKind}, visitor::{Visitable, Visitor}, CrateDef, CrateItem, ItemKind, @@ -474,18 +477,8 @@ impl Serialize for ItemSource { } } -#[derive(Serialize)] -pub enum AllocInfo { - Function(stable_mir::mir::mono::Instance), - VTable( - stable_mir::ty::Ty, - Option>, - ), - Static(stable_mir::mir::mono::StaticDef), - Memory(stable_mir::ty::Allocation), // TODO include stable_mir::ty::TyKind? -} type LinkMap<'tcx> = HashMap, (ItemSource, FnSymType)>; -type AllocMap = HashMap; +type AllocMap = HashMap; type TyMap = HashMap)>; type SpanMap = HashMap; @@ -644,15 +637,18 @@ fn update_link_map<'tcx>( } } -fn get_prov_type(maybe_kind: Option) -> Option { +fn get_prov_ty(pointer_ty: stable_mir::ty::Ty) -> Option { use stable_mir::ty::RigidTy; + let pointer_kind = pointer_ty.kind(); // check for pointers - let kind = maybe_kind?; - if let Some(ty) = kind.builtin_deref(true) { - return ty.ty.kind().into(); + if let Some(ty) = pointer_kind.builtin_deref(true) { + return ty.ty.into(); } - match kind.rigid().expect("Non-rigid-ty allocation found!") { - RigidTy::Array(ty, _) | RigidTy::Slice(ty) | RigidTy::Ref(_, ty, _) => ty.kind().into(), + match pointer_kind + .rigid() + .expect("Non-rigid-ty allocation found!") + { + RigidTy::Array(ty, _) | RigidTy::Slice(ty) | RigidTy::Ref(_, ty, _) => (*ty).into(), RigidTy::FnPtr(_) | RigidTy::Adt(..) => None, // TODO: Check for Adt if the GenericArgs are related to prov unimplemented => { todo!("Unimplemented RigidTy allocation: {:?}", unimplemented); @@ -662,47 +658,49 @@ fn get_prov_type(maybe_kind: Option) -> Option, + ty: stable_mir::ty::Ty, val: stable_mir::mir::alloc::AllocId, ) { - use stable_mir::mir::alloc::GlobalAlloc; let entry = val_collector.visited_allocs.entry(val); if matches!(entry, std::collections::hash_map::Entry::Occupied(_)) { return; } + let kind = ty.kind(); let global_alloc = GlobalAlloc::from(val); match global_alloc { GlobalAlloc::Memory(ref alloc) => { - let pointed_kind = get_prov_type(kind); + let pointed_ty = get_prov_ty(ty); #[cfg(feature = "debug_log")] println!( "DEBUG: called collect_alloc: {:?}:{:?}:{:?}", - val, pointed_kind, global_alloc + val, + pointed_ty.map(|ty| ty.kind()), + global_alloc ); - entry.or_insert(AllocInfo::Memory(alloc.clone())); // TODO: include pointed_kind.clone().unwrap() ? + entry.or_insert((ty, global_alloc.clone())); alloc.provenance.ptrs.iter().for_each(|(_, prov)| { - collect_alloc(val_collector, pointed_kind.clone(), prov.0); + collect_alloc(val_collector, pointed_ty.unwrap(), prov.0); }); } - GlobalAlloc::Static(def) => { + GlobalAlloc::Static(_) => { assert!( - kind.clone().unwrap().builtin_deref(true).is_some(), + kind.clone().builtin_deref(true).is_some(), "Allocated pointer is not a built-in pointer type: {:?}", kind ); - entry.or_insert(AllocInfo::Static(def)); + entry.or_insert((ty, global_alloc.clone())); } - GlobalAlloc::VTable(ty, traitref) => { + GlobalAlloc::VTable(_, _) => { assert!( - kind.clone().unwrap().builtin_deref(true).is_some(), + kind.clone().builtin_deref(true).is_some(), "Allocated pointer is not a built-in pointer type: {:?}", kind ); - entry.or_insert(AllocInfo::VTable(ty, traitref)); + entry.or_insert((ty, global_alloc.clone())); } - GlobalAlloc::Function(inst) => { - assert!(kind.unwrap().is_fn_ptr()); - entry.or_insert(AllocInfo::Function(inst)); + GlobalAlloc::Function(_) => { + assert!(kind.is_fn_ptr()); + entry.or_insert((ty, global_alloc.clone())); } }; } @@ -785,9 +783,11 @@ impl MirVisitor for InternedValueCollector<'_, '_> { alloc, constant.ty().kind() ); - alloc.provenance.ptrs.iter().for_each(|(_offset, prov)| { - collect_alloc(self, Some(constant.ty().kind()), prov.0) - }); + alloc + .provenance + .ptrs + .iter() + .for_each(|(_offset, prov)| collect_alloc(self, constant.ty(), prov.0)); } ConstantKind::Ty(ty_const) => { if let TyConstKind::Value(..) = ty_const.kind() { @@ -1183,7 +1183,7 @@ type SourceData = (String, usize, usize, usize, usize); pub struct SmirJson<'t> { pub name: String, pub crate_id: u64, - pub allocs: Vec<(AllocId, AllocInfo)>, + pub allocs: Vec, pub functions: Vec<(LinkMapKey<'t>, FnSymType)>, pub uneval_consts: Vec<(ConstDef, String)>, pub items: Vec, @@ -1200,6 +1200,13 @@ pub struct SmirJsonDebugInfo<'t> { foreign_modules: Vec<(String, Vec)>, } +#[derive(Serialize)] +pub struct AllocInfo { + alloc_id: AllocId, + ty: stable_mir::ty::Ty, + global_alloc: GlobalAlloc, +} + // Serialization Entrypoint // ======================== @@ -1213,7 +1220,7 @@ pub fn collect_smir(tcx: TyCtxt<'_>) -> SmirJson { // FIXME: We dump extra static items here --- this should be handled better for (_, alloc) in visited_allocs.iter() { - if let AllocInfo::Static(def) = alloc { + if let (_, GlobalAlloc::Static(def)) = alloc { let mono_item = stable_mir::mir::mono::MonoItem::Fn(stable_mir::mir::mono::Instance::from(*def)); let item_name = &mono_item_name(tcx, &mono_item); @@ -1246,7 +1253,14 @@ pub fn collect_smir(tcx: TyCtxt<'_>) -> SmirJson { .into_iter() .map(|(k, (_, name))| (k, name)) .collect::>(); - let mut allocs = visited_allocs.into_iter().collect::>(); + let mut allocs = visited_allocs + .into_iter() + .map(|(alloc_id, (ty, global_alloc))| AllocInfo { + alloc_id, + ty, + global_alloc, + }) + .collect::>(); let crate_id = tcx.stable_crate_id(LOCAL_CRATE).as_u64(); let mut types = visited_tys @@ -1258,7 +1272,7 @@ pub fn collect_smir(tcx: TyCtxt<'_>) -> SmirJson { let mut spans = span_map.into_iter().collect::>(); // sort output vectors to stabilise output (a bit) - allocs.sort_by(|a, b| a.0.to_index().cmp(&b.0.to_index())); + allocs.sort_by(|a, b| a.alloc_id.to_index().cmp(&b.alloc_id.to_index())); functions.sort_by(|a, b| a.0 .0.to_index().cmp(&b.0 .0.to_index())); items.sort(); types.sort_by(|a, b| a.0.to_index().cmp(&b.0.to_index())); diff --git a/tests/integration/normalise-filter.jq b/tests/integration/normalise-filter.jq index 6827320..319dba0 100644 --- a/tests/integration/normalise-filter.jq +++ b/tests/integration/normalise-filter.jq @@ -2,7 +2,7 @@ .functions = ( [ .functions[] | if .[1].NormalSym then .[1].NormalSym = .[1].NormalSym[:-17] else . end ] ) | .items = ( [ .items[] | if .symbol_name then .symbol_name = .symbol_name[:-17] else . end ] ) # delete unstable alloc, function, and type IDs - | .allocs = ( [ .allocs[] ] | map(del(.[0])) ) + | .allocs = ( .allocs | map(del(.alloc_id)) | map(del(.ty)) ) | .functions = ( [ .functions[] ] | map(del(.[0])) ) | .types = ( [ .types[] ] | map(del(.[0])) ) # remove "Never" type diff --git a/tests/integration/programs/binop.smir.json.expected b/tests/integration/programs/binop.smir.json.expected index 4509769..407cb17 100644 --- a/tests/integration/programs/binop.smir.json.expected +++ b/tests/integration/programs/binop.smir.json.expected @@ -1,7 +1,7 @@ { "allocs": [ - [ - { + { + "global_alloc": { "Memory": { "align": 1, "bytes": [ @@ -44,9 +44,9 @@ } } } - ], - [ - { + }, + { + "global_alloc": { "Memory": { "align": 1, "bytes": [ @@ -89,9 +89,9 @@ } } } - ], - [ - { + }, + { + "global_alloc": { "Memory": { "align": 1, "bytes": [ @@ -130,9 +130,9 @@ } } } - ], - [ - { + }, + { + "global_alloc": { "Memory": { "align": 1, "bytes": [ @@ -171,9 +171,9 @@ } } } - ], - [ - { + }, + { + "global_alloc": { "Memory": { "align": 1, "bytes": [ @@ -213,9 +213,9 @@ } } } - ], - [ - { + }, + { + "global_alloc": { "Memory": { "align": 1, "bytes": [ @@ -254,9 +254,9 @@ } } } - ], - [ - { + }, + { + "global_alloc": { "Memory": { "align": 1, "bytes": [ @@ -295,9 +295,9 @@ } } } - ], - [ - { + }, + { + "global_alloc": { "Memory": { "align": 1, "bytes": [ @@ -336,9 +336,9 @@ } } } - ], - [ - { + }, + { + "global_alloc": { "Memory": { "align": 1, "bytes": [ @@ -377,9 +377,9 @@ } } } - ], - [ - { + }, + { + "global_alloc": { "Memory": { "align": 1, "bytes": [ @@ -419,9 +419,9 @@ } } } - ], - [ - { + }, + { + "global_alloc": { "Memory": { "align": 1, "bytes": [ @@ -461,9 +461,9 @@ } } } - ], - [ - { + }, + { + "global_alloc": { "Memory": { "align": 1, "bytes": [ @@ -503,9 +503,9 @@ } } } - ], - [ - { + }, + { + "global_alloc": { "Memory": { "align": 1, "bytes": [ @@ -545,9 +545,9 @@ } } } - ], - [ - { + }, + { + "global_alloc": { "Memory": { "align": 1, "bytes": [ @@ -590,9 +590,9 @@ } } } - ], - [ - { + }, + { + "global_alloc": { "Memory": { "align": 1, "bytes": [ @@ -633,9 +633,9 @@ } } } - ], - [ - { + }, + { + "global_alloc": { "Memory": { "align": 1, "bytes": [ @@ -678,9 +678,9 @@ } } } - ], - [ - { + }, + { + "global_alloc": { "Memory": { "align": 1, "bytes": [ @@ -720,9 +720,9 @@ } } } - ], - [ - { + }, + { + "global_alloc": { "Memory": { "align": 1, "bytes": [ @@ -765,9 +765,9 @@ } } } - ], - [ - { + }, + { + "global_alloc": { "Memory": { "align": 1, "bytes": [ @@ -805,9 +805,9 @@ } } } - ], - [ - { + }, + { + "global_alloc": { "Memory": { "align": 1, "bytes": [ @@ -846,9 +846,9 @@ } } } - ], - [ - { + }, + { + "global_alloc": { "Memory": { "align": 1, "bytes": [ @@ -888,9 +888,9 @@ } } } - ], - [ - { + }, + { + "global_alloc": { "Memory": { "align": 1, "bytes": [ @@ -928,9 +928,9 @@ } } } - ], - [ - { + }, + { + "global_alloc": { "Memory": { "align": 1, "bytes": [ @@ -969,9 +969,9 @@ } } } - ], - [ - { + }, + { + "global_alloc": { "Memory": { "align": 1, "bytes": [ @@ -1014,9 +1014,9 @@ } } } - ], - [ - { + }, + { + "global_alloc": { "Memory": { "align": 1, "bytes": [ @@ -1059,9 +1059,9 @@ } } } - ], - [ - { + }, + { + "global_alloc": { "Memory": { "align": 1, "bytes": [ @@ -1102,7 +1102,7 @@ } } } - ] + } ], "functions": [ [ diff --git a/tests/integration/programs/char-trivial.smir.json.expected b/tests/integration/programs/char-trivial.smir.json.expected index 0570810..9e1786f 100644 --- a/tests/integration/programs/char-trivial.smir.json.expected +++ b/tests/integration/programs/char-trivial.smir.json.expected @@ -1,7 +1,7 @@ { "allocs": [ - [ - { + { + "global_alloc": { "Memory": { "align": 1, "bytes": [ @@ -38,7 +38,7 @@ } } } - ] + } ], "functions": [ [ diff --git a/tests/integration/programs/closure-args.smir.json.expected b/tests/integration/programs/closure-args.smir.json.expected index 12a7402..4e4f523 100644 --- a/tests/integration/programs/closure-args.smir.json.expected +++ b/tests/integration/programs/closure-args.smir.json.expected @@ -1,7 +1,7 @@ { "allocs": [ - [ - { + { + "global_alloc": { "Memory": { "align": 1, "bytes": [ @@ -47,7 +47,7 @@ } } } - ] + } ], "functions": [ [ diff --git a/tests/integration/programs/closure-no-args.smir.json.expected b/tests/integration/programs/closure-no-args.smir.json.expected index 52f14d6..875cc7b 100644 --- a/tests/integration/programs/closure-no-args.smir.json.expected +++ b/tests/integration/programs/closure-no-args.smir.json.expected @@ -1,7 +1,7 @@ { "allocs": [ - [ - { + { + "global_alloc": { "Memory": { "align": 1, "bytes": [ @@ -41,7 +41,7 @@ } } } - ] + } ], "functions": [ [ diff --git a/tests/integration/programs/const-arithm-simple.smir.json.expected b/tests/integration/programs/const-arithm-simple.smir.json.expected index 6a36226..81b35cf 100644 --- a/tests/integration/programs/const-arithm-simple.smir.json.expected +++ b/tests/integration/programs/const-arithm-simple.smir.json.expected @@ -1,7 +1,7 @@ { "allocs": [ - [ - { + { + "global_alloc": { "Memory": { "align": 1, "bytes": [ @@ -31,7 +31,7 @@ } } } - ] + } ], "functions": [ [ diff --git a/tests/integration/programs/div.smir.json.expected b/tests/integration/programs/div.smir.json.expected index a0abfd0..818ffec 100644 --- a/tests/integration/programs/div.smir.json.expected +++ b/tests/integration/programs/div.smir.json.expected @@ -1,7 +1,7 @@ { "allocs": [ - [ - { + { + "global_alloc": { "Memory": { "align": 1, "bytes": [ @@ -44,7 +44,7 @@ } } } - ] + } ], "functions": [ [ diff --git a/tests/integration/programs/double-ref-deref.smir.json.expected b/tests/integration/programs/double-ref-deref.smir.json.expected index 317022c..8761b89 100644 --- a/tests/integration/programs/double-ref-deref.smir.json.expected +++ b/tests/integration/programs/double-ref-deref.smir.json.expected @@ -1,7 +1,7 @@ { "allocs": [ - [ - { + { + "global_alloc": { "Memory": { "align": 1, "bytes": [ @@ -39,7 +39,7 @@ } } } - ] + } ], "functions": [ [ diff --git a/tests/integration/programs/fibonacci.smir.json.expected b/tests/integration/programs/fibonacci.smir.json.expected index 0c63a7d..cd9175b 100644 --- a/tests/integration/programs/fibonacci.smir.json.expected +++ b/tests/integration/programs/fibonacci.smir.json.expected @@ -1,7 +1,7 @@ { "allocs": [ - [ - { + { + "global_alloc": { "Memory": { "align": 1, "bytes": [ @@ -38,7 +38,7 @@ } } } - ] + } ], "functions": [ [ diff --git a/tests/integration/programs/float.smir.json.expected b/tests/integration/programs/float.smir.json.expected index 68f9cab..524e359 100644 --- a/tests/integration/programs/float.smir.json.expected +++ b/tests/integration/programs/float.smir.json.expected @@ -1,7 +1,7 @@ { "allocs": [ - [ - { + { + "global_alloc": { "Memory": { "align": 1, "bytes": [ @@ -42,9 +42,9 @@ } } } - ], - [ - { + }, + { + "global_alloc": { "Memory": { "align": 1, "bytes": [ @@ -85,7 +85,7 @@ } } } - ] + } ], "functions": [ [ diff --git a/tests/integration/programs/modulo.smir.json.expected b/tests/integration/programs/modulo.smir.json.expected index 8480ef5..fc1ab0d 100644 --- a/tests/integration/programs/modulo.smir.json.expected +++ b/tests/integration/programs/modulo.smir.json.expected @@ -1,7 +1,7 @@ { "allocs": [ - [ - { + { + "global_alloc": { "Memory": { "align": 1, "bytes": [ @@ -42,7 +42,7 @@ } } } - ] + } ], "functions": [ [ diff --git a/tests/integration/programs/mutual_recursion.smir.json.expected b/tests/integration/programs/mutual_recursion.smir.json.expected index 07ccdb6..e2f48ba 100644 --- a/tests/integration/programs/mutual_recursion.smir.json.expected +++ b/tests/integration/programs/mutual_recursion.smir.json.expected @@ -1,7 +1,7 @@ { "allocs": [ - [ - { + { + "global_alloc": { "Memory": { "align": 1, "bytes": [ @@ -41,7 +41,7 @@ } } } - ] + } ], "functions": [ [ diff --git a/tests/integration/programs/param_types.smir.json.expected b/tests/integration/programs/param_types.smir.json.expected index 15bc9fa..2ce5eea 100644 --- a/tests/integration/programs/param_types.smir.json.expected +++ b/tests/integration/programs/param_types.smir.json.expected @@ -1,7 +1,7 @@ { "allocs": [ - [ - { + { + "global_alloc": { "Memory": { "align": 1, "bytes": [ @@ -52,9 +52,9 @@ } } } - ], - [ - { + }, + { + "global_alloc": { "Memory": { "align": 1, "bytes": [ @@ -108,7 +108,7 @@ } } } - ] + } ], "functions": [ [ diff --git a/tests/integration/programs/primitive-type-bounds.smir.json.expected b/tests/integration/programs/primitive-type-bounds.smir.json.expected index f89914a..00972ad 100644 --- a/tests/integration/programs/primitive-type-bounds.smir.json.expected +++ b/tests/integration/programs/primitive-type-bounds.smir.json.expected @@ -1,7 +1,7 @@ { "allocs": [ - [ - { + { + "global_alloc": { "Memory": { "align": 1, "bytes": [ @@ -36,7 +36,7 @@ } } } - ] + } ], "functions": [ [ diff --git a/tests/integration/programs/recursion-simple-match.smir.json.expected b/tests/integration/programs/recursion-simple-match.smir.json.expected index 2462f6b..5fadcee 100644 --- a/tests/integration/programs/recursion-simple-match.smir.json.expected +++ b/tests/integration/programs/recursion-simple-match.smir.json.expected @@ -1,7 +1,7 @@ { "allocs": [ - [ - { + { + "global_alloc": { "Memory": { "align": 1, "bytes": [ @@ -39,7 +39,7 @@ } } } - ] + } ], "functions": [ [ diff --git a/tests/integration/programs/recursion-simple.smir.json.expected b/tests/integration/programs/recursion-simple.smir.json.expected index f3e55cf..92fa44e 100644 --- a/tests/integration/programs/recursion-simple.smir.json.expected +++ b/tests/integration/programs/recursion-simple.smir.json.expected @@ -1,7 +1,7 @@ { "allocs": [ - [ - { + { + "global_alloc": { "Memory": { "align": 1, "bytes": [ @@ -39,7 +39,7 @@ } } } - ] + } ], "functions": [ [ diff --git a/tests/integration/programs/ref-deref.smir.json.expected b/tests/integration/programs/ref-deref.smir.json.expected index 91dd5f9..d18a6aa 100644 --- a/tests/integration/programs/ref-deref.smir.json.expected +++ b/tests/integration/programs/ref-deref.smir.json.expected @@ -1,7 +1,7 @@ { "allocs": [ - [ - { + { + "global_alloc": { "Memory": { "align": 1, "bytes": [ @@ -37,7 +37,7 @@ } } } - ] + } ], "functions": [ [ diff --git a/tests/integration/programs/shl_min.smir.json.expected b/tests/integration/programs/shl_min.smir.json.expected index 3b99014..0777afb 100644 --- a/tests/integration/programs/shl_min.smir.json.expected +++ b/tests/integration/programs/shl_min.smir.json.expected @@ -1,7 +1,7 @@ { "allocs": [ - [ - { + { + "global_alloc": { "Memory": { "align": 1, "bytes": [ @@ -47,9 +47,9 @@ } } } - ], - [ - { + }, + { + "global_alloc": { "Memory": { "align": 1, "bytes": [ @@ -133,9 +133,9 @@ } } } - ], - [ - { + }, + { + "global_alloc": { "Memory": { "align": 1, "bytes": [ @@ -189,9 +189,9 @@ } } } - ], - [ - { + }, + { + "global_alloc": { "Memory": { "align": 1, "bytes": [ @@ -240,9 +240,9 @@ } } } - ], - [ - { + }, + { + "global_alloc": { "Memory": { "align": 1, "bytes": [ @@ -305,7 +305,7 @@ } } } - ] + } ], "functions": [ [ diff --git a/tests/integration/programs/slice.smir.json.expected b/tests/integration/programs/slice.smir.json.expected index 3558622..efd5f01 100644 --- a/tests/integration/programs/slice.smir.json.expected +++ b/tests/integration/programs/slice.smir.json.expected @@ -1,7 +1,7 @@ { "allocs": [ - [ - { + { + "global_alloc": { "Memory": { "align": 1, "bytes": [ @@ -41,9 +41,9 @@ } } } - ], - [ - { + }, + { + "global_alloc": { "Memory": { "align": 4, "bytes": [ @@ -62,7 +62,7 @@ } } } - ] + } ], "functions": [ [ diff --git a/tests/integration/programs/strange-ref-deref.smir.json.expected b/tests/integration/programs/strange-ref-deref.smir.json.expected index 3533336..73be9a5 100644 --- a/tests/integration/programs/strange-ref-deref.smir.json.expected +++ b/tests/integration/programs/strange-ref-deref.smir.json.expected @@ -1,7 +1,7 @@ { "allocs": [ - [ - { + { + "global_alloc": { "Memory": { "align": 1, "bytes": [ @@ -38,7 +38,7 @@ } } } - ] + } ], "functions": [ [ diff --git a/tests/integration/programs/struct.smir.json.expected b/tests/integration/programs/struct.smir.json.expected index 1739361..c0289f7 100644 --- a/tests/integration/programs/struct.smir.json.expected +++ b/tests/integration/programs/struct.smir.json.expected @@ -1,7 +1,7 @@ { "allocs": [ - [ - { + { + "global_alloc": { "Memory": { "align": 1, "bytes": [ @@ -44,7 +44,7 @@ } } } - ] + } ], "functions": [ [ diff --git a/tests/integration/programs/sum-to-n.smir.json.expected b/tests/integration/programs/sum-to-n.smir.json.expected index a539243..d715e23 100644 --- a/tests/integration/programs/sum-to-n.smir.json.expected +++ b/tests/integration/programs/sum-to-n.smir.json.expected @@ -1,7 +1,7 @@ { "allocs": [ - [ - { + { + "global_alloc": { "Memory": { "align": 1, "bytes": [ @@ -36,7 +36,7 @@ } } } - ] + } ], "functions": [ [ diff --git a/tests/integration/programs/tuple-eq.smir.json.expected b/tests/integration/programs/tuple-eq.smir.json.expected index f3ee1f7..c41d69b 100644 --- a/tests/integration/programs/tuple-eq.smir.json.expected +++ b/tests/integration/programs/tuple-eq.smir.json.expected @@ -1,7 +1,7 @@ { "allocs": [ - [ - { + { + "global_alloc": { "Memory": { "align": 1, "bytes": [ @@ -45,9 +45,9 @@ } } } - ], - [ - { + }, + { + "global_alloc": { "Memory": { "align": 4, "bytes": [ @@ -66,7 +66,7 @@ } } } - ] + } ], "functions": [ [ diff --git a/tests/integration/programs/tuples-simple.smir.json.expected b/tests/integration/programs/tuples-simple.smir.json.expected index 1bd3c82..3e5f8e3 100644 --- a/tests/integration/programs/tuples-simple.smir.json.expected +++ b/tests/integration/programs/tuples-simple.smir.json.expected @@ -1,7 +1,7 @@ { "allocs": [ - [ - { + { + "global_alloc": { "Memory": { "align": 1, "bytes": [ @@ -44,7 +44,7 @@ } } } - ] + } ], "functions": [ [ diff --git a/tests/integration/programs/weirdRefs.smir.json.expected b/tests/integration/programs/weirdRefs.smir.json.expected index 663005e..6a5f287 100644 --- a/tests/integration/programs/weirdRefs.smir.json.expected +++ b/tests/integration/programs/weirdRefs.smir.json.expected @@ -1,7 +1,7 @@ { "allocs": [ - [ - { + { + "global_alloc": { "Memory": { "align": 1, "bytes": [ @@ -45,9 +45,9 @@ } } } - ], - [ - { + }, + { + "global_alloc": { "Memory": { "align": 1, "bytes": [ @@ -91,9 +91,9 @@ } } } - ], - [ - { + }, + { + "global_alloc": { "Memory": { "align": 1, "bytes": [ @@ -137,9 +137,9 @@ } } } - ], - [ - { + }, + { + "global_alloc": { "Memory": { "align": 1, "bytes": [ @@ -177,9 +177,9 @@ } } } - ], - [ - { + }, + { + "global_alloc": { "Memory": { "align": 1, "bytes": [ @@ -216,7 +216,7 @@ } } } - ] + } ], "functions": [ [