diff --git a/Cargo.lock b/Cargo.lock index 5e2ec17199542..c3706a65d71a6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7710,6 +7710,7 @@ dependencies = [ "colored", "difference", "move-binary-format", + "move-bytecode-source-map", "move-bytecode-utils", "move-bytecode-verifier", "move-bytecode-viewer", @@ -7724,6 +7725,7 @@ dependencies = [ "move-prover", "move-stdlib", "move-stdlib-natives", + "move-symbol-pool", "move-unit-test", "move-vm-profiler", "move-vm-runtime", @@ -7849,6 +7851,7 @@ dependencies = [ "move-core-types", "move-coverage", "move-ir-types", + "move-symbol-pool", ] [[package]] @@ -7963,6 +7966,7 @@ dependencies = [ "move-command-line-common", "move-compiler", "move-core-types", + "move-disassembler", "move-docgen", "move-model", "move-symbol-pool", @@ -14447,6 +14451,7 @@ dependencies = [ "jemalloc-ctl", "jsonrpsee", "move-binary-format", + "move-bytecode-source-map", "move-cli", "move-compiler", "move-disassembler", diff --git a/crates/sui-framework-tests/tests/move_tests.rs b/crates/sui-framework-tests/tests/move_tests.rs index 015cb4e3c3270..663c27763e4cd 100644 --- a/crates/sui-framework-tests/tests/move_tests.rs +++ b/crates/sui-framework-tests/tests/move_tests.rs @@ -58,7 +58,7 @@ pub(crate) fn tests(path: &Path) -> datatest_stable::Result<()> { testing_config.filter = std::env::var("FILTER").ok().map(|s| s.to_string()); assert_eq!( - run_move_unit_tests(path, move_config, Some(testing_config), false).unwrap(), + run_move_unit_tests(path, move_config, Some(testing_config), false, false).unwrap(), UnitTestResult::Success ); diff --git a/crates/sui-move/Cargo.toml b/crates/sui-move/Cargo.toml index 4b1afd221eb39..eef9c5649d5b8 100644 --- a/crates/sui-move/Cargo.toml +++ b/crates/sui-move/Cargo.toml @@ -24,6 +24,7 @@ move-disassembler.workspace = true move-ir-types.workspace = true move-package.workspace = true move-prover.workspace = true +move-bytecode-source-map.workspace = true move-unit-test.workspace = true telemetry-subscribers.workspace = true tokio = { workspace = true, features = ["full"] } diff --git a/crates/sui-move/src/disassemble.rs b/crates/sui-move/src/disassemble.rs index 13f6af6296fed..399d7866ce988 100644 --- a/crates/sui-move/src/disassemble.rs +++ b/crates/sui-move/src/disassemble.rs @@ -3,6 +3,7 @@ use clap::Parser; use move_binary_format::CompiledModule; +use move_bytecode_source_map::utils::serialize_to_json_string; use move_cli::base; use move_disassembler::disassembler::Disassembler; use move_ir_types::location::Spanned; @@ -25,6 +26,10 @@ pub struct Disassemble { #[clap(short = 'i', long = "interactive")] interactive: bool, + + /// Print the "bytecode map" (source map for disassembled bytecode) + #[clap(long = "bytecode-map")] + pub bytecode_map: bool, } impl Disassemble { @@ -47,6 +52,7 @@ impl Disassemble { package_name: None, module_or_script_name: module_name, debug: self.debug, + bytecode_map: self.bytecode_map, } .execute(package_path, build_config)?; return Ok(()); @@ -69,7 +75,11 @@ impl Disassemble { println!("{module:#?}"); } else { let d = Disassembler::from_module(&module, Spanned::unsafe_no_loc(()).loc)?; - println!("{}", d.disassemble()?); + let (disassemble_string, bcode_map) = d.disassemble_with_source_map()?; + if self.bytecode_map { + println!("{}", serialize_to_json_string(&bcode_map)?); + } + println!("{}", disassemble_string); } Ok(()) diff --git a/crates/sui-move/src/unit_test.rs b/crates/sui-move/src/unit_test.rs index a75f6b9b14910..6d9afd93b35e5 100644 --- a/crates/sui-move/src/unit_test.rs +++ b/crates/sui-move/src/unit_test.rs @@ -42,6 +42,8 @@ impl Test { "The --coverage flag is currently supported only in debug builds. Please build the Sui CLI from source in debug mode." )); } + // save disassembly if trace execution is enabled + let save_disassembly = self.test.trace_execution.is_some(); // find manifest file directory from a given path or (if missing) from current dir let rerooted_path = base::reroot_path(path)?; let unit_test_config = self.test.unit_test_config(); @@ -50,6 +52,7 @@ impl Test { build_config, Some(unit_test_config), compute_coverage, + save_disassembly, ) } } @@ -71,6 +74,7 @@ pub fn run_move_unit_tests( build_config: BuildConfig, config: Option, compute_coverage: bool, + save_disassembly: bool, ) -> anyhow::Result { // bind the extension hook if it has not yet been done Lazy::force(&SET_EXTENSION_HOOK); @@ -91,6 +95,7 @@ pub fn run_move_unit_tests( ), Some(initial_cost_schedule_for_unit_tests()), compute_coverage, + save_disassembly, &mut std::io::stdout(), ); result.map(|(test_result, warning_diags)| { diff --git a/external-crates/move/Cargo.lock b/external-crates/move/Cargo.lock index 7399170e29a0b..adbc8c74ba538 100644 --- a/external-crates/move/Cargo.lock +++ b/external-crates/move/Cargo.lock @@ -1774,6 +1774,7 @@ dependencies = [ "datatest-stable", "difference", "move-binary-format", + "move-bytecode-source-map", "move-bytecode-utils", "move-bytecode-verifier", "move-bytecode-viewer", @@ -1788,6 +1789,7 @@ dependencies = [ "move-prover", "move-stdlib", "move-stdlib-natives", + "move-symbol-pool", "move-unit-test", "move-vm-profiler", "move-vm-runtime", @@ -1926,6 +1928,7 @@ dependencies = [ "move-core-types", "move-coverage", "move-ir-types", + "move-symbol-pool", ] [[package]] @@ -2056,6 +2059,7 @@ dependencies = [ "move-command-line-common", "move-compiler", "move-core-types", + "move-disassembler", "move-docgen", "move-model", "move-symbol-pool", diff --git a/external-crates/move/crates/move-bytecode-source-map/src/source_map.rs b/external-crates/move/crates/move-bytecode-source-map/src/source_map.rs index 06dd047191985..02fbc4a460e1e 100644 --- a/external-crates/move/crates/move-bytecode-source-map/src/source_map.rs +++ b/external-crates/move/crates/move-bytecode-source-map/src/source_map.rs @@ -712,4 +712,68 @@ impl SourceMap { Ok(empty_source_map) } + + pub fn replace_file_hashes(&mut self, file_hash: FileHash) { + self.definition_location = Loc::new( + file_hash, + self.definition_location.start(), + self.definition_location.end(), + ); + for (_, struct_map) in self.struct_map.iter_mut() { + struct_map.definition_location = Loc::new( + file_hash, + struct_map.definition_location.start(), + struct_map.definition_location.end(), + ); + for (_, loc) in struct_map.type_parameters.iter_mut() { + *loc = Loc::new(file_hash, loc.start(), loc.end()); + } + for loc in struct_map.fields.iter_mut() { + *loc = Loc::new(file_hash, loc.start(), loc.end()); + } + } + for (_, enum_map) in self.enum_map.iter_mut() { + enum_map.definition_location = Loc::new( + file_hash, + enum_map.definition_location.start(), + enum_map.definition_location.end(), + ); + for (_, loc) in enum_map.type_parameters.iter_mut() { + *loc = Loc::new(file_hash, loc.start(), loc.end()); + } + for ((_, loc), field_locations) in enum_map.variants.iter_mut() { + *loc = Loc::new(file_hash, loc.start(), loc.end()); + for field_loc in field_locations.iter_mut() { + *field_loc = Loc::new(file_hash, field_loc.start(), field_loc.end()); + } + } + } + for (_, function_map) in self.function_map.iter_mut() { + function_map.location = Loc::new( + file_hash, + function_map.location.start(), + function_map.location.end(), + ); + function_map.definition_location = Loc::new( + file_hash, + function_map.definition_location.start(), + function_map.definition_location.end(), + ); + for (_, loc) in function_map.type_parameters.iter_mut() { + *loc = Loc::new(file_hash, loc.start(), loc.end()); + } + for (_, loc) in function_map.parameters.iter_mut() { + *loc = Loc::new(file_hash, loc.start(), loc.end()); + } + for loc in function_map.returns.iter_mut() { + *loc = Loc::new(file_hash, loc.start(), loc.end()); + } + for (_, loc) in function_map.locals.iter_mut() { + *loc = Loc::new(file_hash, loc.start(), loc.end()); + } + for (_, loc) in function_map.code_map.iter_mut() { + *loc = Loc::new(file_hash, loc.start(), loc.end()); + } + } + } } diff --git a/external-crates/move/crates/move-bytecode-source-map/src/utils.rs b/external-crates/move/crates/move-bytecode-source-map/src/utils.rs index 191f57f2b6203..cee8c85701a74 100644 --- a/external-crates/move/crates/move-bytecode-source-map/src/utils.rs +++ b/external-crates/move/crates/move-bytecode-source-map/src/utils.rs @@ -27,13 +27,16 @@ pub fn source_map_from_file(file_path: &Path) -> Result { .map_err(|_| format_err!("Error deserializing into source map")) } +pub fn serialize_to_json_string(map: &SourceMap) -> Result { + serde_json::to_string_pretty(map).map_err(|e| format_err!("Error serializing to json: {}", e)) +} + pub fn serialize_to_json(map: &SourceMap) -> Result> { serde_json::to_vec(map).map_err(|e| format_err!("Error serializing to json: {}", e)) } pub fn serialize_to_json_file(map: &SourceMap, file_path: &Path) -> Result<()> { - let json = serde_json::to_string_pretty(map) - .map_err(|e| format_err!("Error serializing to json: {}", e))?; + let json = serialize_to_json_string(map)?; let mut f = std::fs::File::create(file_path).map_err(|e| format_err!("Error creating file: {}", e))?; f.write_all(json.as_bytes()) diff --git a/external-crates/move/crates/move-cli/Cargo.toml b/external-crates/move/crates/move-cli/Cargo.toml index fae90ee1126d8..831e81bb35f19 100644 --- a/external-crates/move/crates/move-cli/Cargo.toml +++ b/external-crates/move/crates/move-cli/Cargo.toml @@ -22,6 +22,7 @@ toml_edit.workspace = true bcs.workspace = true +move-bytecode-source-map.workspace = true move-bytecode-verifier.workspace = true move-disassembler.workspace = true move-docgen.workspace = true @@ -40,6 +41,7 @@ move-vm-test-utils.workspace = true move-binary-format.workspace = true move-package.workspace = true move-prover.workspace = true +move-symbol-pool.workspace = true move-unit-test.workspace = true move-bytecode-viewer.workspace = true diff --git a/external-crates/move/crates/move-cli/src/base/disassemble.rs b/external-crates/move/crates/move-cli/src/base/disassemble.rs index 5bd17aac62660..11d1828afb77f 100644 --- a/external-crates/move/crates/move-cli/src/base/disassemble.rs +++ b/external-crates/move/crates/move-cli/src/base/disassemble.rs @@ -3,6 +3,7 @@ use super::reroot_path; use clap::*; +use move_bytecode_source_map::utils::serialize_to_json_string; use move_compiler::compiled_unit::NamedCompiledModule; use move_disassembler::disassembler::Disassembler; use move_package::{compilation::compiled_package::CompiledUnitWithSource, BuildConfig}; @@ -24,6 +25,9 @@ pub struct Disassemble { #[clap(long = "Xdebug")] /// Also print the raw disassembly using Rust's Debug output, at the end. pub debug: bool, + #[clap(long = "bytecode-map")] + /// Print the "bytecode map" (source map for disassembled bytecode) + pub bytecode_map: bool, } impl Disassemble { @@ -34,6 +38,7 @@ impl Disassemble { package_name, module_or_script_name, debug, + bytecode_map, } = self; // Make sure the package is built let package = config.compile_package(&rerooted_path, &mut Vec::new())?; @@ -66,7 +71,12 @@ impl Disassemble { source_path, ) } else { - println!("{}", Disassembler::from_unit(&unit.unit).disassemble()?); + let d = Disassembler::from_unit(&unit.unit); + let (disassemble_string, bcode_map) = d.disassemble_with_source_map()?; + if bytecode_map { + println!("{}", serialize_to_json_string(&bcode_map)?); + } + println!("{}", disassemble_string); if debug { println!("\n{:#?}", &unit.unit.module) } diff --git a/external-crates/move/crates/move-cli/src/base/test.rs b/external-crates/move/crates/move-cli/src/base/test.rs index 3133b799a9b10..c4c452ad9d392 100644 --- a/external-crates/move/crates/move-cli/src/base/test.rs +++ b/external-crates/move/crates/move-cli/src/base/test.rs @@ -84,6 +84,8 @@ impl Test { ) -> anyhow::Result<()> { let rerooted_path = reroot_path(path)?; let compute_coverage = self.compute_coverage; + // save disassembly if trace execution is enabled + let save_disassembly = self.trace_execution.is_some(); let result = run_move_unit_tests( &rerooted_path, config, @@ -91,6 +93,7 @@ impl Test { natives, cost_table, compute_coverage, + save_disassembly, &mut std::io::stdout(), )?; @@ -143,11 +146,13 @@ pub fn run_move_unit_tests( natives: Vec, cost_table: Option, compute_coverage: bool, + save_disassembly: bool, writer: &mut W, ) -> Result<(UnitTestResult, Option)> { let mut test_plan = None; build_config.test_mode = true; build_config.dev_mode = true; + build_config.save_disassembly = save_disassembly; // Build the resolution graph (resolution graph diagnostics are only needed for CLI commands so // ignore them by passing a vector as the writer) diff --git a/external-crates/move/crates/move-cli/tests/build_tests/disassemble_module_source_map/Move.toml b/external-crates/move/crates/move-cli/tests/build_tests/disassemble_module_source_map/Move.toml new file mode 100644 index 0000000000000..c8f2665caf8cb --- /dev/null +++ b/external-crates/move/crates/move-cli/tests/build_tests/disassemble_module_source_map/Move.toml @@ -0,0 +1,3 @@ +[package] +name = "Test" +edition = "2024.beta" diff --git a/external-crates/move/crates/move-cli/tests/build_tests/disassemble_module_source_map/args.exp b/external-crates/move/crates/move-cli/tests/build_tests/disassemble_module_source_map/args.exp new file mode 100644 index 0000000000000..44c7ad91cc2af --- /dev/null +++ b/external-crates/move/crates/move-cli/tests/build_tests/disassemble_module_source_map/args.exp @@ -0,0 +1,2282 @@ +Command `build`: +BUILDING Test +Command `disassemble --package Test --name m --bytecode-map`: +{ + "definition_location": { + "file_hash": [ + 27, + 66, + 228, + 250, + 191, + 50, + 143, + 69, + 46, + 113, + 55, + 194, + 188, + 188, + 13, + 27, + 137, + 203, + 18, + 104, + 90, + 108, + 225, + 27, + 191, + 211, + 168, + 81, + 81, + 63, + 144, + 10 + ], + "start": 30, + "end": 31 + }, + "module_name": [ + "0000000000000000000000000000000000000000000000000000000000000042", + "m" + ], + "struct_map": { + "0": { + "definition_location": { + "file_hash": [ + 27, + 66, + 228, + 250, + 191, + 50, + 143, + 69, + 46, + 113, + 55, + 194, + 188, + 188, + 13, + 27, + 137, + 203, + 18, + 104, + 90, + 108, + 225, + 27, + 191, + 211, + 168, + 81, + 81, + 63, + 144, + 10 + ], + "start": 42, + "end": 52 + }, + "type_parameters": [ + [ + "T1", + { + "file_hash": [ + 27, + 66, + 228, + 250, + 191, + 50, + 143, + 69, + 46, + 113, + 55, + 194, + 188, + 188, + 13, + 27, + 137, + 203, + 18, + 104, + 90, + 108, + 225, + 27, + 191, + 211, + 168, + 81, + 81, + 63, + 144, + 10 + ], + "start": 53, + "end": 55 + } + ], + [ + "T2", + { + "file_hash": [ + 27, + 66, + 228, + 250, + 191, + 50, + 143, + 69, + 46, + 113, + 55, + 194, + 188, + 188, + 13, + 27, + 137, + 203, + 18, + 104, + 90, + 108, + 225, + 27, + 191, + 211, + 168, + 81, + 81, + 63, + 144, + 10 + ], + "start": 65, + "end": 67 + } + ] + ], + "fields": [ + { + "file_hash": [ + 27, + 66, + 228, + 250, + 191, + 50, + 143, + 69, + 46, + 113, + 55, + 194, + 188, + 188, + 13, + 27, + 137, + 203, + 18, + 104, + 90, + 108, + 225, + 27, + 191, + 211, + 168, + 81, + 81, + 63, + 144, + 10 + ], + "start": 87, + "end": 97 + } + ] + } + }, + "enum_map": { + "0": { + "definition_location": { + "file_hash": [ + 27, + 66, + 228, + 250, + 191, + 50, + 143, + 69, + 46, + 113, + 55, + 194, + 188, + 188, + 13, + 27, + 137, + 203, + 18, + 104, + 90, + 108, + 225, + 27, + 191, + 211, + 168, + 81, + 81, + 63, + 144, + 10 + ], + "start": 110, + "end": 118 + }, + "type_parameters": [], + "variants": [ + [ + [ + "NamedVariant", + { + "file_hash": [ + 27, + 66, + 228, + 250, + 191, + 50, + 143, + 69, + 46, + 113, + 55, + 194, + 188, + 188, + 13, + 27, + 137, + 203, + 18, + 104, + 90, + 108, + 225, + 27, + 191, + 211, + 168, + 81, + 81, + 63, + 144, + 10 + ], + "start": 137, + "end": 164 + } + ], + [ + { + "file_hash": [ + 27, + 66, + 228, + 250, + 191, + 50, + 143, + 69, + 46, + 113, + 55, + 194, + 188, + 188, + 13, + 27, + 137, + 203, + 18, + 104, + 90, + 108, + 225, + 27, + 191, + 211, + 168, + 81, + 81, + 63, + 144, + 10 + ], + "start": 152, + "end": 157 + } + ] + ], + [ + [ + "PositionalVariant", + { + "file_hash": [ + 27, + 66, + 228, + 250, + 191, + 50, + 143, + 69, + 46, + 113, + 55, + 194, + 188, + 188, + 13, + 27, + 137, + 203, + 18, + 104, + 90, + 108, + 225, + 27, + 191, + 211, + 168, + 81, + 81, + 63, + 144, + 10 + ], + "start": 167, + "end": 198 + } + ], + [ + { + "file_hash": [ + 27, + 66, + 228, + 250, + 191, + 50, + 143, + 69, + 46, + 113, + 55, + 194, + 188, + 188, + 13, + 27, + 137, + 203, + 18, + 104, + 90, + 108, + 225, + 27, + 191, + 211, + 168, + 81, + 81, + 63, + 144, + 10 + ], + "start": 187, + "end": 191 + } + ] + ] + ] + } + }, + "function_map": { + "0": { + "location": { + "file_hash": [ + 27, + 66, + 228, + 250, + 191, + 50, + 143, + 69, + 46, + 113, + 55, + 194, + 188, + 188, + 13, + 27, + 137, + 203, + 18, + 104, + 90, + 108, + 225, + 27, + 191, + 211, + 168, + 81, + 81, + 63, + 144, + 10 + ], + "start": 202, + "end": 1762 + }, + "definition_location": { + "file_hash": [ + 27, + 66, + 228, + 250, + 191, + 50, + 143, + 69, + 46, + 113, + 55, + 194, + 188, + 188, + 13, + 27, + 137, + 203, + 18, + 104, + 90, + 108, + 225, + 27, + 191, + 211, + 168, + 81, + 81, + 63, + 144, + 10 + ], + "start": 209, + "end": 212 + }, + "type_parameters": [], + "parameters": [ + [ + "e#0#0", + { + "file_hash": [ + 27, + 66, + 228, + 250, + 191, + 50, + 143, + 69, + 46, + 113, + 55, + 194, + 188, + 188, + 13, + 27, + 137, + 203, + 18, + 104, + 90, + 108, + 225, + 27, + 191, + 211, + 168, + 81, + 81, + 63, + 144, + 10 + ], + "start": 213, + "end": 218 + } + ], + [ + "p1#0#0", + { + "file_hash": [ + 27, + 66, + 228, + 250, + 191, + 50, + 143, + 69, + 46, + 113, + 55, + 194, + 188, + 188, + 13, + 27, + 137, + 203, + 18, + 104, + 90, + 108, + 225, + 27, + 191, + 211, + 168, + 81, + 81, + 63, + 144, + 10 + ], + "start": 230, + "end": 236 + } + ], + [ + "p2#0#0", + { + "file_hash": [ + 27, + 66, + 228, + 250, + 191, + 50, + 143, + 69, + 46, + 113, + 55, + 194, + 188, + 188, + 13, + 27, + 137, + 203, + 18, + 104, + 90, + 108, + 225, + 27, + 191, + 211, + 168, + 81, + 81, + 63, + 144, + 10 + ], + "start": 243, + "end": 249 + } + ] + ], + "returns": [ + { + "file_hash": [ + 27, + 66, + 228, + 250, + 191, + 50, + 143, + 69, + 46, + 113, + 55, + 194, + 188, + 188, + 13, + 27, + 137, + 203, + 18, + 104, + 90, + 108, + 225, + 27, + 191, + 211, + 168, + 81, + 81, + 63, + 144, + 10 + ], + "start": 273, + "end": 276 + }, + { + "file_hash": [ + 27, + 66, + 228, + 250, + 191, + 50, + 143, + 69, + 46, + 113, + 55, + 194, + 188, + 188, + 13, + 27, + 137, + 203, + 18, + 104, + 90, + 108, + 225, + 27, + 191, + 211, + 168, + 81, + 81, + 63, + 144, + 10 + ], + "start": 279, + "end": 282 + } + ], + "locals": [ + [ + "%#7", + { + "file_hash": [ + 27, + 66, + 228, + 250, + 191, + 50, + 143, + 69, + 46, + 113, + 55, + 194, + 188, + 188, + 13, + 27, + 137, + 203, + 18, + 104, + 90, + 108, + 225, + 27, + 191, + 211, + 168, + 81, + 81, + 63, + 144, + 10 + ], + "start": 289, + "end": 292 + } + ], + [ + "%#8", + { + "file_hash": [ + 27, + 66, + 228, + 250, + 191, + 50, + 143, + 69, + 46, + 113, + 55, + 194, + 188, + 188, + 13, + 27, + 137, + 203, + 18, + 104, + 90, + 108, + 225, + 27, + 191, + 211, + 168, + 81, + 81, + 63, + 144, + 10 + ], + "start": 302, + "end": 305 + } + ], + [ + "__match_tmp%#match_subject#2#2#0", + { + "file_hash": [ + 27, + 66, + 228, + 250, + 191, + 50, + 143, + 69, + 46, + 113, + 55, + 194, + 188, + 188, + 13, + 27, + 137, + 203, + 18, + 104, + 90, + 108, + 225, + 27, + 191, + 211, + 168, + 81, + 81, + 63, + 144, + 10 + ], + "start": 315, + "end": 347 + } + ], + [ + "__match_tmp%#unpack_subject#1#1#0", + { + "file_hash": [ + 27, + 66, + 228, + 250, + 191, + 50, + 143, + 69, + 46, + 113, + 55, + 194, + 188, + 188, + 13, + 27, + 137, + 203, + 18, + 104, + 90, + 108, + 225, + 27, + 191, + 211, + 168, + 81, + 81, + 63, + 144, + 10 + ], + "start": 363, + "end": 396 + } + ], + [ + "field#3#0", + { + "file_hash": [ + 27, + 66, + 228, + 250, + 191, + 50, + 143, + 69, + 46, + 113, + 55, + 194, + 188, + 188, + 13, + 27, + 137, + 203, + 18, + 104, + 90, + 108, + 225, + 27, + 191, + 211, + 168, + 81, + 81, + 63, + 144, + 10 + ], + "start": 411, + "end": 420 + } + ] + ], + "nops": {}, + "code_map": { + "0": { + "file_hash": [ + 27, + 66, + 228, + 250, + 191, + 50, + 143, + 69, + 46, + 113, + 55, + 194, + 188, + 188, + 13, + 27, + 137, + 203, + 18, + 104, + 90, + 108, + 225, + 27, + 191, + 211, + 168, + 81, + 81, + 63, + 144, + 10 + ], + "start": 434, + "end": 461 + }, + "1": { + "file_hash": [ + 27, + 66, + 228, + 250, + 191, + 50, + 143, + 69, + 46, + 113, + 55, + 194, + 188, + 188, + 13, + 27, + 137, + 203, + 18, + 104, + 90, + 108, + 225, + 27, + 191, + 211, + 168, + 81, + 81, + 63, + 144, + 10 + ], + "start": 466, + "end": 519 + }, + "2": { + "file_hash": [ + 27, + 66, + 228, + 250, + 191, + 50, + 143, + 69, + 46, + 113, + 55, + 194, + 188, + 188, + 13, + 27, + 137, + 203, + 18, + 104, + 90, + 108, + 225, + 27, + 191, + 211, + 168, + 81, + 81, + 63, + 144, + 10 + ], + "start": 524, + "end": 584 + }, + "3": { + "file_hash": [ + 27, + 66, + 228, + 250, + 191, + 50, + 143, + 69, + 46, + 113, + 55, + 194, + 188, + 188, + 13, + 27, + 137, + 203, + 18, + 104, + 90, + 108, + 225, + 27, + 191, + 211, + 168, + 81, + 81, + 63, + 144, + 10 + ], + "start": 589, + "end": 642 + }, + "4": { + "file_hash": [ + 27, + 66, + 228, + 250, + 191, + 50, + 143, + 69, + 46, + 113, + 55, + 194, + 188, + 188, + 13, + 27, + 137, + 203, + 18, + 104, + 90, + 108, + 225, + 27, + 191, + 211, + 168, + 81, + 81, + 63, + 144, + 10 + ], + "start": 647, + "end": 702 + }, + "5": { + "file_hash": [ + 27, + 66, + 228, + 250, + 191, + 50, + 143, + 69, + 46, + 113, + 55, + 194, + 188, + 188, + 13, + 27, + 137, + 203, + 18, + 104, + 90, + 108, + 225, + 27, + 191, + 211, + 168, + 81, + 81, + 63, + 144, + 10 + ], + "start": 707, + "end": 746 + }, + "6": { + "file_hash": [ + 27, + 66, + 228, + 250, + 191, + 50, + 143, + 69, + 46, + 113, + 55, + 194, + 188, + 188, + 13, + 27, + 137, + 203, + 18, + 104, + 90, + 108, + 225, + 27, + 191, + 211, + 168, + 81, + 81, + 63, + 144, + 10 + ], + "start": 755, + "end": 810 + }, + "7": { + "file_hash": [ + 27, + 66, + 228, + 250, + 191, + 50, + 143, + 69, + 46, + 113, + 55, + 194, + 188, + 188, + 13, + 27, + 137, + 203, + 18, + 104, + 90, + 108, + 225, + 27, + 191, + 211, + 168, + 81, + 81, + 63, + 144, + 10 + ], + "start": 815, + "end": 857 + }, + "8": { + "file_hash": [ + 27, + 66, + 228, + 250, + 191, + 50, + 143, + 69, + 46, + 113, + 55, + 194, + 188, + 188, + 13, + 27, + 137, + 203, + 18, + 104, + 90, + 108, + 225, + 27, + 191, + 211, + 168, + 81, + 81, + 63, + 144, + 10 + ], + "start": 862, + "end": 865 + }, + "9": { + "file_hash": [ + 27, + 66, + 228, + 250, + 191, + 50, + 143, + 69, + 46, + 113, + 55, + 194, + 188, + 188, + 13, + 27, + 137, + 203, + 18, + 104, + 90, + 108, + 225, + 27, + 191, + 211, + 168, + 81, + 81, + 63, + 144, + 10 + ], + "start": 870, + "end": 925 + }, + "10": { + "file_hash": [ + 27, + 66, + 228, + 250, + 191, + 50, + 143, + 69, + 46, + 113, + 55, + 194, + 188, + 188, + 13, + 27, + 137, + 203, + 18, + 104, + 90, + 108, + 225, + 27, + 191, + 211, + 168, + 81, + 81, + 63, + 144, + 10 + ], + "start": 931, + "end": 967 + }, + "11": { + "file_hash": [ + 27, + 66, + 228, + 250, + 191, + 50, + 143, + 69, + 46, + 113, + 55, + 194, + 188, + 188, + 13, + 27, + 137, + 203, + 18, + 104, + 90, + 108, + 225, + 27, + 191, + 211, + 168, + 81, + 81, + 63, + 144, + 10 + ], + "start": 973, + "end": 996 + }, + "12": { + "file_hash": [ + 27, + 66, + 228, + 250, + 191, + 50, + 143, + 69, + 46, + 113, + 55, + 194, + 188, + 188, + 13, + 27, + 137, + 203, + 18, + 104, + 90, + 108, + 225, + 27, + 191, + 211, + 168, + 81, + 81, + 63, + 144, + 10 + ], + "start": 1002, + "end": 1005 + }, + "13": { + "file_hash": [ + 27, + 66, + 228, + 250, + 191, + 50, + 143, + 69, + 46, + 113, + 55, + 194, + 188, + 188, + 13, + 27, + 137, + 203, + 18, + 104, + 90, + 108, + 225, + 27, + 191, + 211, + 168, + 81, + 81, + 63, + 144, + 10 + ], + "start": 1011, + "end": 1055 + }, + "14": { + "file_hash": [ + 27, + 66, + 228, + 250, + 191, + 50, + 143, + 69, + 46, + 113, + 55, + 194, + 188, + 188, + 13, + 27, + 137, + 203, + 18, + 104, + 90, + 108, + 225, + 27, + 191, + 211, + 168, + 81, + 81, + 63, + 144, + 10 + ], + "start": 1061, + "end": 1113 + }, + "15": { + "file_hash": [ + 27, + 66, + 228, + 250, + 191, + 50, + 143, + 69, + 46, + 113, + 55, + 194, + 188, + 188, + 13, + 27, + 137, + 203, + 18, + 104, + 90, + 108, + 225, + 27, + 191, + 211, + 168, + 81, + 81, + 63, + 144, + 10 + ], + "start": 1119, + "end": 1126 + }, + "16": { + "file_hash": [ + 27, + 66, + 228, + 250, + 191, + 50, + 143, + 69, + 46, + 113, + 55, + 194, + 188, + 188, + 13, + 27, + 137, + 203, + 18, + 104, + 90, + 108, + 225, + 27, + 191, + 211, + 168, + 81, + 81, + 63, + 144, + 10 + ], + "start": 1132, + "end": 1135 + }, + "17": { + "file_hash": [ + 27, + 66, + 228, + 250, + 191, + 50, + 143, + 69, + 46, + 113, + 55, + 194, + 188, + 188, + 13, + 27, + 137, + 203, + 18, + 104, + 90, + 108, + 225, + 27, + 191, + 211, + 168, + 81, + 81, + 63, + 144, + 10 + ], + "start": 1141, + "end": 1160 + }, + "18": { + "file_hash": [ + 27, + 66, + 228, + 250, + 191, + 50, + 143, + 69, + 46, + 113, + 55, + 194, + 188, + 188, + 13, + 27, + 137, + 203, + 18, + 104, + 90, + 108, + 225, + 27, + 191, + 211, + 168, + 81, + 81, + 63, + 144, + 10 + ], + "start": 1166, + "end": 1184 + }, + "19": { + "file_hash": [ + 27, + 66, + 228, + 250, + 191, + 50, + 143, + 69, + 46, + 113, + 55, + 194, + 188, + 188, + 13, + 27, + 137, + 203, + 18, + 104, + 90, + 108, + 225, + 27, + 191, + 211, + 168, + 81, + 81, + 63, + 144, + 10 + ], + "start": 1190, + "end": 1208 + }, + "20": { + "file_hash": [ + 27, + 66, + 228, + 250, + 191, + 50, + 143, + 69, + 46, + 113, + 55, + 194, + 188, + 188, + 13, + 27, + 137, + 203, + 18, + 104, + 90, + 108, + 225, + 27, + 191, + 211, + 168, + 81, + 81, + 63, + 144, + 10 + ], + "start": 1214, + "end": 1224 + }, + "21": { + "file_hash": [ + 27, + 66, + 228, + 250, + 191, + 50, + 143, + 69, + 46, + 113, + 55, + 194, + 188, + 188, + 13, + 27, + 137, + 203, + 18, + 104, + 90, + 108, + 225, + 27, + 191, + 211, + 168, + 81, + 81, + 63, + 144, + 10 + ], + "start": 1234, + "end": 1289 + }, + "22": { + "file_hash": [ + 27, + 66, + 228, + 250, + 191, + 50, + 143, + 69, + 46, + 113, + 55, + 194, + 188, + 188, + 13, + 27, + 137, + 203, + 18, + 104, + 90, + 108, + 225, + 27, + 191, + 211, + 168, + 81, + 81, + 63, + 144, + 10 + ], + "start": 1295, + "end": 1337 + }, + "23": { + "file_hash": [ + 27, + 66, + 228, + 250, + 191, + 50, + 143, + 69, + 46, + 113, + 55, + 194, + 188, + 188, + 13, + 27, + 137, + 203, + 18, + 104, + 90, + 108, + 225, + 27, + 191, + 211, + 168, + 81, + 81, + 63, + 144, + 10 + ], + "start": 1343, + "end": 1346 + }, + "24": { + "file_hash": [ + 27, + 66, + 228, + 250, + 191, + 50, + 143, + 69, + 46, + 113, + 55, + 194, + 188, + 188, + 13, + 27, + 137, + 203, + 18, + 104, + 90, + 108, + 225, + 27, + 191, + 211, + 168, + 81, + 81, + 63, + 144, + 10 + ], + "start": 1352, + "end": 1407 + }, + "25": { + "file_hash": [ + 27, + 66, + 228, + 250, + 191, + 50, + 143, + 69, + 46, + 113, + 55, + 194, + 188, + 188, + 13, + 27, + 137, + 203, + 18, + 104, + 90, + 108, + 225, + 27, + 191, + 211, + 168, + 81, + 81, + 63, + 144, + 10 + ], + "start": 1413, + "end": 1449 + }, + "26": { + "file_hash": [ + 27, + 66, + 228, + 250, + 191, + 50, + 143, + 69, + 46, + 113, + 55, + 194, + 188, + 188, + 13, + 27, + 137, + 203, + 18, + 104, + 90, + 108, + 225, + 27, + 191, + 211, + 168, + 81, + 81, + 63, + 144, + 10 + ], + "start": 1455, + "end": 1479 + }, + "27": { + "file_hash": [ + 27, + 66, + 228, + 250, + 191, + 50, + 143, + 69, + 46, + 113, + 55, + 194, + 188, + 188, + 13, + 27, + 137, + 203, + 18, + 104, + 90, + 108, + 225, + 27, + 191, + 211, + 168, + 81, + 81, + 63, + 144, + 10 + ], + "start": 1485, + "end": 1511 + }, + "28": { + "file_hash": [ + 27, + 66, + 228, + 250, + 191, + 50, + 143, + 69, + 46, + 113, + 55, + 194, + 188, + 188, + 13, + 27, + 137, + 203, + 18, + 104, + 90, + 108, + 225, + 27, + 191, + 211, + 168, + 81, + 81, + 63, + 144, + 10 + ], + "start": 1517, + "end": 1543 + }, + "29": { + "file_hash": [ + 27, + 66, + 228, + 250, + 191, + 50, + 143, + 69, + 46, + 113, + 55, + 194, + 188, + 188, + 13, + 27, + 137, + 203, + 18, + 104, + 90, + 108, + 225, + 27, + 191, + 211, + 168, + 81, + 81, + 63, + 144, + 10 + ], + "start": 1549, + "end": 1567 + }, + "30": { + "file_hash": [ + 27, + 66, + 228, + 250, + 191, + 50, + 143, + 69, + 46, + 113, + 55, + 194, + 188, + 188, + 13, + 27, + 137, + 203, + 18, + 104, + 90, + 108, + 225, + 27, + 191, + 211, + 168, + 81, + 81, + 63, + 144, + 10 + ], + "start": 1573, + "end": 1591 + }, + "31": { + "file_hash": [ + 27, + 66, + 228, + 250, + 191, + 50, + 143, + 69, + 46, + 113, + 55, + 194, + 188, + 188, + 13, + 27, + 137, + 203, + 18, + 104, + 90, + 108, + 225, + 27, + 191, + 211, + 168, + 81, + 81, + 63, + 144, + 10 + ], + "start": 1601, + "end": 1621 + }, + "32": { + "file_hash": [ + 27, + 66, + 228, + 250, + 191, + 50, + 143, + 69, + 46, + 113, + 55, + 194, + 188, + 188, + 13, + 27, + 137, + 203, + 18, + 104, + 90, + 108, + 225, + 27, + 191, + 211, + 168, + 81, + 81, + 63, + 144, + 10 + ], + "start": 1627, + "end": 1647 + }, + "33": { + "file_hash": [ + 27, + 66, + 228, + 250, + 191, + 50, + 143, + 69, + 46, + 113, + 55, + 194, + 188, + 188, + 13, + 27, + 137, + 203, + 18, + 104, + 90, + 108, + 225, + 27, + 191, + 211, + 168, + 81, + 81, + 63, + 144, + 10 + ], + "start": 1653, + "end": 1656 + } + }, + "is_native": false + } + }, + "constant_map": { + "0": 0 + } +} +// Move bytecode v7 +module 42.m { + +struct SomeStruct has copy, drop { + some_field: T1 +} + +enum SomeEnum has copy, drop { + NamedVariant { field: u64 }, + PositionalVariant { pos0: u64 } +} + +public foo(e#0#0: SomeEnum, p1#0#0: u64, p2#0#0: SomeStruct): u64 * u64 { +L3: %#7: u64 +L4: %#8: u64 +L5: __match_tmp%#match_subject#2#2#0: &SomeEnum +L6: __match_tmp%#unpack_subject#1#1#0: SomeEnum +L7: field#3#0: u64 +B0: + 0: MoveLoc[0](e#0#0: SomeEnum) + 1: StLoc[6](__match_tmp%#unpack_subject#1#1#0: SomeEnum) + 2: ImmBorrowLoc[6](__match_tmp%#unpack_subject#1#1#0: SomeEnum) + 3: StLoc[5](__match_tmp%#match_subject#2#2#0: &SomeEnum) + 4: CopyLoc[5](__match_tmp%#match_subject#2#2#0: &SomeEnum) + 5: VariantSwitch(VariantJumpTableIndex(0)) +B1: + 6: MoveLoc[5](__match_tmp%#match_subject#2#2#0: &SomeEnum) + 7: UnpackVariantImmRef(VariantHandleIndex(0)) + 8: Pop + 9: MoveLoc[6](__match_tmp%#unpack_subject#1#1#0: SomeEnum) + 10: UnpackVariant(VariantHandleIndex(0)) + 11: MoveLoc[1](p1#0#0: u64) + 12: Add + 13: ImmBorrowLoc[2](p2#0#0: SomeStruct) + 14: ImmBorrowFieldGeneric[0](SomeStruct.some_field: u64) + 15: ReadRef + 16: Add + 17: LdConst[0](u64: 42) + 18: StLoc[4](%#8: u64) + 19: StLoc[3](%#7: u64) + 20: Branch(31) +B2: + 21: MoveLoc[5](__match_tmp%#match_subject#2#2#0: &SomeEnum) + 22: UnpackVariantImmRef(VariantHandleIndex(1)) + 23: Pop + 24: MoveLoc[6](__match_tmp%#unpack_subject#1#1#0: SomeEnum) + 25: UnpackVariant(VariantHandleIndex(1)) + 26: StLoc[7](field#3#0: u64) + 27: CopyLoc[7](field#3#0: u64) + 28: MoveLoc[7](field#3#0: u64) + 29: StLoc[4](%#8: u64) + 30: StLoc[3](%#7: u64) +B3: + 31: MoveLoc[3](%#7: u64) + 32: MoveLoc[4](%#8: u64) + 33: Ret +Jump tables: +[0]: variant_switch SomeEnum { + NamedVariant => jump 6 + PositionalVariant => jump 21 + } +} + +Constants [ + 0 => u64: 42 +] +} + diff --git a/external-crates/move/crates/move-cli/tests/build_tests/disassemble_module_source_map/args.txt b/external-crates/move/crates/move-cli/tests/build_tests/disassemble_module_source_map/args.txt new file mode 100644 index 0000000000000..3569249773627 --- /dev/null +++ b/external-crates/move/crates/move-cli/tests/build_tests/disassemble_module_source_map/args.txt @@ -0,0 +1,2 @@ +build +disassemble --package Test --name m --bytecode-map diff --git a/external-crates/move/crates/move-cli/tests/build_tests/disassemble_module_source_map/sources/m.move b/external-crates/move/crates/move-cli/tests/build_tests/disassemble_module_source_map/sources/m.move new file mode 100644 index 0000000000000..8bbb231e19833 --- /dev/null +++ b/external-crates/move/crates/move-cli/tests/build_tests/disassemble_module_source_map/sources/m.move @@ -0,0 +1,30 @@ +module 0x42::m; + +public enum SomeEnum has drop, copy { + NamedVariant { field: u64 }, + PositionalVariant(u64), +} + +public struct SomeStruct has drop, copy { + some_field: T1, +} + +const SOME_CONST: u64 = 42; + +public fun foo(e: SomeEnum, p1: u64, p2: SomeStruct): (u64, u64) { + match (e) { + SomeEnum::NamedVariant { field } => { + let mut res = field + p1; + res = res + p2.some_field; + (res, SOME_CONST) + }, + SomeEnum::PositionalVariant(field) => (field, field) + } +} + +#[test] +public fun test() { + let e = SomeEnum::NamedVariant { field: 42 }; + let s = SomeStruct { some_field: 7 }; + foo(e, 42, s); +} diff --git a/external-crates/move/crates/move-cli/tests/build_tests/help/args.exp b/external-crates/move/crates/move-cli/tests/build_tests/help/args.exp index b9e005495b14c..326f9e0dd503b 100644 --- a/external-crates/move/crates/move-cli/tests/build_tests/help/args.exp +++ b/external-crates/move/crates/move-cli/tests/build_tests/help/args.exp @@ -26,6 +26,8 @@ Options: Compile in 'test' mode. The 'dev-addresses' and 'dev-dependencies' fields will be used along with any code in the 'tests' directory --doc Generate documentation for packages + --disassemble + Save disassembly for generated bytecode along with bytecode maps (source maps for disassembeld bytecode) --install-dir Installation directory for compiled artifacts. Defaults to current directory --force diff --git a/external-crates/move/crates/move-command-line-common/src/files.rs b/external-crates/move/crates/move-command-line-common/src/files.rs index b7b1039c7c12a..c5f58c71389e5 100644 --- a/external-crates/move/crates/move-command-line-common/src/files.rs +++ b/external-crates/move/crates/move-command-line-common/src/files.rs @@ -46,6 +46,8 @@ pub const SOURCE_MAP_EXTENSION: &str = "mvsm"; pub const MOVE_ERROR_DESC_EXTENSION: &str = "errmap"; /// Extension for coverage maps pub const MOVE_COVERAGE_MAP_EXTENSION: &str = "mvcov"; +/// Extension for disassembled Move bytecode files +pub const MOVE_BYTECODE_EXTENSION: &str = "mvb"; /// Determine if the path at `path` exists distinguishing between whether the path did not exist, /// or if there were other errors in determining if the path existed. diff --git a/external-crates/move/crates/move-disassembler/Cargo.toml b/external-crates/move/crates/move-disassembler/Cargo.toml index 7e2914726baf4..fe171e480b36d 100644 --- a/external-crates/move/crates/move-disassembler/Cargo.toml +++ b/external-crates/move/crates/move-disassembler/Cargo.toml @@ -19,6 +19,7 @@ move-binary-format.workspace = true move-coverage.workspace = true move-compiler.workspace = true move-abstract-interpreter.workspace = true +move-symbol-pool.workspace = true bcs.workspace = true clap.workspace = true diff --git a/external-crates/move/crates/move-disassembler/src/disassembler.rs b/external-crates/move/crates/move-disassembler/src/disassembler.rs index 5bbade6e15e2e..1ae8b30dfaf76 100644 --- a/external-crates/move/crates/move-disassembler/src/disassembler.rs +++ b/external-crates/move/crates/move-disassembler/src/disassembler.rs @@ -8,25 +8,33 @@ use inline_colorization as IC; use move_abstract_interpreter::control_flow_graph::{ControlFlowGraph, VMControlFlowGraph}; use move_binary_format::{ file_format::{ - Ability, AbilitySet, Bytecode, CodeUnit, Constant, DatatypeTyParameter, - EnumDefinitionIndex, FieldHandleIndex, FunctionDefinitionIndex, FunctionHandle, - JumpTableInner, ModuleHandle, Signature, SignatureIndex, SignatureToken, + Ability, AbilitySet, Bytecode, CodeOffset, CodeUnit, Constant, ConstantPoolIndex, + DatatypeTyParameter, EnumDefinitionIndex, FieldHandleIndex, FunctionDefinitionIndex, + FunctionHandle, JumpTableInner, ModuleHandle, Signature, SignatureIndex, SignatureToken, StructDefinitionIndex, StructFieldInformation, TableIndex, TypeSignature, Visibility, }, CompiledModule, }; use move_bytecode_source_map::{ mapping::SourceMapping, - source_map::{FunctionSourceMap, SourceName}, + source_map::{FunctionSourceMap, SourceMap, SourceName}, +}; +use move_command_line_common::{ + display::{try_render_constant, RenderResult}, + files::FileHash, }; -use move_command_line_common::display::{try_render_constant, RenderResult}; use move_compiler::compiled_unit::CompiledUnit; use move_core_types::{identifier::IdentStr, language_storage::ModuleId}; use move_coverage::coverage_map::{ExecCoverageMap, FunctionCoverage}; -use move_ir_types::location::Loc; +use move_ir_types::{ + ast::{ConstantName, ModuleIdent, ModuleName}, + location::Loc, +}; +use move_symbol_pool::Symbol; use std::{ collections::{BTreeMap, HashMap}, fmt::{self, Write}, + vec, }; const PREVIEW_LEN: usize = 4; @@ -97,22 +105,44 @@ impl<'a> Write for BoundedBuffer<'a> { } } +trait ByteLength { + fn byte_len(&self) -> u32; +} + +impl<'a> ByteLength for BoundedBuffer<'a> { + fn byte_len(&self) -> u32 { + self.buf.len() as u32 + } +} + +impl ByteLength for String { + fn byte_len(&self) -> u32 { + self.len() as u32 + } +} + macro_rules! any_writeln { ($buf:expr) => { any_writeln!($buf,) }; - ($buf:expr, $($args:tt)*) => { - std::writeln!($buf, $($args)*).map_err(anyhow::Error::from) - }; + ($buf:expr, $($args:tt)*) => {{ + let start_offset = $buf.byte_len(); + let res = std::writeln!($buf, $($args)*).map_err(anyhow::Error::from); + let end_offset= $buf.byte_len(); + res.map(|_| Loc::new(FileHash::empty(), start_offset, end_offset)) + }}; } macro_rules! any_write { ($buf:expr) => { any_write!($buf,) }; - ($buf:expr, $($args:tt)*) => { - std::write!($buf, $($args)*).map_err(anyhow::Error::from) - }; + ($buf:expr, $($args:tt)*) => {{ + let start_offset = $buf.byte_len(); + let res = std::write!($buf, $($args)*).map_err(anyhow::Error::from); + let end_offset= $buf.byte_len(); + res.map(|_| Loc::new(FileHash::empty(), start_offset, end_offset)) + }}; } fn delimited_list( @@ -121,11 +151,11 @@ fn delimited_list( delimiter: &str, suffix: &str, buf: &mut W, - printer: F, + mut printer: F, ) -> Result<()> where - W: Write, - F: Fn(&mut W, T) -> Result<()>, + W: Write + ByteLength, + F: FnMut(&mut W, T) -> Result<()>, { let mut first = prefix; let mut last = ""; @@ -197,48 +227,84 @@ impl<'a> Disassembler<'a> { self.coverage_map = Some(coverage_map); } + /// Disassemble the module and return the disassembled string. pub fn disassemble(&self) -> Result { let mut buffer = String::new(); + let bcode_map_gen = false; if let Some(budget) = self.options.max_output_size { - self.print_module(&mut BoundedBuffer { - buf: &mut buffer, - budget, - }) + self.print_module( + &mut BoundedBuffer { + buf: &mut buffer, + budget, + }, + bcode_map_gen, + ) .map_err(|e| anyhow::anyhow!("{e}: Module exceeded max allowed disassembly size"))?; } else { - self.print_module(&mut buffer)?; + self.print_module(&mut buffer, bcode_map_gen)?; }; Ok(buffer) } + + /// Disassemble the module and return the disassembled string, + /// but also a source map for the disassembled bytecode. + pub fn disassemble_with_source_map(&self) -> Result<(String, SourceMap)> { + let mut buffer = String::new(); + let bcode_map_gen = true; + let mut bcode_map = if let Some(budget) = self.options.max_output_size { + self.print_module( + &mut BoundedBuffer { + buf: &mut buffer, + budget, + }, + bcode_map_gen, + ) + .map_err(|e| anyhow::anyhow!("{e}: Module exceeded max allowed disassembly size"))? + } else { + self.print_module(&mut buffer, bcode_map_gen)? + }; + let file_hash = FileHash::new(&buffer); + bcode_map.replace_file_hashes(file_hash); + Ok((buffer, bcode_map)) + } } // Note on naming: // * disassemble_* and print_* functions are functions that output to the buffer // * format_* functions return a string that can be used in the buffer impl<'a> Disassembler<'a> { - fn print_module(&self, buffer: &mut impl Write) -> Result<()> { + fn print_module( + &self, + buffer: &mut (impl Write + ByteLength), + bcode_map_gen: bool, + ) -> Result { // NB: The order in which these are called is important as each function is effectful. - self.print_header(buffer)?; + let mut res = Some(self.print_header(buffer)?); + let bcode_map_opt = if bcode_map_gen { &mut res } else { &mut None }; self.print_imports(buffer)?; - self.print_user_defined_types(buffer)?; - self.print_function_definitions(buffer)?; - self.print_constants(buffer)?; + self.print_user_defined_types(buffer, bcode_map_opt)?; + self.print_function_definitions(buffer, bcode_map_opt)?; + self.print_constants(buffer, bcode_map_opt)?; self.print_footer(buffer)?; - Ok(()) + Ok(res.unwrap()) } - fn print_header(&self, buffer: &mut impl Write) -> Result<()> { + fn print_header(&self, buffer: &mut (impl Write + ByteLength)) -> Result { let (addr, n) = &self.source_mapper.source_map.module_name; - any_writeln!( + any_write!( buffer, - "// Move bytecode v{version}\nmodule {addr}.{name} {{", + "// Move bytecode v{version}\nmodule {addr}.", version = self.source_mapper.bytecode.version(), addr = addr.short_str_lossless(), - name = n, - ) + )?; + let mod_name_loc = any_write!(buffer, "{name}", name = n)?; + any_writeln!(buffer, " {{")?; + let mod_ident = ModuleIdent::new(ModuleName(Symbol::from(n.as_str())), *addr); + let bcode_map = SourceMap::new(mod_name_loc, mod_ident); + Ok(bcode_map) } - fn print_imports(&self, buffer: &mut impl Write) -> Result<()> { + fn print_imports(&self, buffer: &mut (impl Write + ByteLength)) -> Result<()> { for h in self.source_mapper.bytecode.module_handles().iter() { self.disassemble_import(buffer, h)?; } @@ -250,30 +316,50 @@ impl<'a> Disassembler<'a> { Ok(()) } - fn print_user_defined_types(&self, buffer: &mut impl Write) -> Result<()> { + fn print_user_defined_types( + &self, + buffer: &mut (impl Write + ByteLength), + bcode_map_opt: &mut Option, + ) -> Result<()> { for i in 0..self.source_mapper.bytecode.struct_defs().len() { - self.disassemble_struct_def(buffer, StructDefinitionIndex(i as TableIndex))?; + self.disassemble_struct_def( + buffer, + bcode_map_opt, + StructDefinitionIndex(i as TableIndex), + )?; any_writeln!(buffer)?; } for i in 0..self.source_mapper.bytecode.enum_defs().len() { - self.disassemble_enum_def(buffer, EnumDefinitionIndex(i as TableIndex))?; + self.disassemble_enum_def(buffer, bcode_map_opt, EnumDefinitionIndex(i as TableIndex))?; any_writeln!(buffer)?; } Ok(()) } - fn print_function_definitions(&self, buffer: &mut impl Write) -> Result<()> { + fn print_function_definitions( + &self, + buffer: &mut (impl Write + ByteLength), + bcode_map_opt: &mut Option, + ) -> Result<()> { for i in 0..self.source_mapper.bytecode.function_defs().len() { - self.disassemble_function_definition(buffer, FunctionDefinitionIndex(i as TableIndex))?; + self.disassemble_function_definition( + buffer, + bcode_map_opt, + FunctionDefinitionIndex(i as TableIndex), + )?; any_writeln!(buffer)?; } Ok(()) } - fn print_constants(&self, buffer: &mut impl Write) -> Result<()> { + fn print_constants( + &self, + buffer: &mut (impl Write + ByteLength), + bcode_map_opt: &mut Option, + ) -> Result<()> { delimited_list( self.source_mapper .bytecode @@ -284,12 +370,21 @@ impl<'a> Disassembler<'a> { "", "]\n", buffer, - |buffer, (idx, constant)| self.disassemble_constant(buffer, idx, constant, false), + |buffer, (idx, constant)| { + if let Some(bcode_map) = bcode_map_opt { + // no constant name in the disassembled bytecode - use index as a name + bcode_map.add_const_mapping( + ConstantPoolIndex(idx as TableIndex), + ConstantName(Symbol::from(idx.to_string())), + )?; + } + self.disassemble_constant(buffer, idx, constant, false) + }, ) } - fn print_footer(&self, buffer: &mut impl Write) -> Result<()> { - any_writeln!(buffer, "}}") + fn print_footer(&self, buffer: &mut (impl Write + ByteLength)) -> Result<()> { + any_writeln!(buffer, "}}").map(|_| ()) } //*************************************************************************** @@ -300,7 +395,8 @@ impl<'a> Disassembler<'a> { // defined in the module in question. fn disassemble_struct_def( &self, - buffer: &mut impl Write, + buffer: &mut (impl Write + ByteLength), + bcode_map_opt: &mut Option, struct_def_idx: StructDefinitionIndex, ) -> Result<()> { let struct_definition = self.source_mapper.bytecode.struct_def_at(struct_def_idx); @@ -338,13 +434,22 @@ impl<'a> Disassembler<'a> { .identifier_at(struct_handle.name) .to_string(); - any_write!(buffer, "{native}struct {name}")?; + any_write!(buffer, "{native}struct ")?; + let struct_name_loc = any_write!(buffer, "{name}")?; + if let Some(bcode_map) = bcode_map_opt { + bcode_map.add_top_level_struct_mapping(struct_def_idx, struct_name_loc)?; + } - Self::disassemble_datatype_type_formals( + let type_param_source_names = Self::disassemble_datatype_type_formals( buffer, &struct_source_map.type_parameters, &struct_handle.type_parameters, )?; + if let Some(bcode_map) = bcode_map_opt { + for n in type_param_source_names { + bcode_map.add_struct_type_parameter_mapping(struct_def_idx, n)?; + } + } Self::disassemble_abilites(buffer, struct_handle.abilities)?; @@ -360,7 +465,13 @@ impl<'a> Disassembler<'a> { "", buffer, |buffer, (name, ty)| { - any_write!(buffer, "\t{name}: ")?; + any_write!(buffer, "\t")?; + let field_name_loc = any_write!(buffer, "{name}")?; + if let Some(bcode_map) = bcode_map_opt { + bcode_map.add_struct_field_mapping(struct_def_idx, field_name_loc)?; + } + any_write!(buffer, ": ")?; + self.disassemble_sig_tok( buffer, &ty.0, @@ -380,7 +491,8 @@ impl<'a> Disassembler<'a> { fn disassemble_enum_def( &self, - buffer: &mut impl Write, + buffer: &mut (impl Write + ByteLength), + bcode_map_opt: &mut Option, enum_def_idx: EnumDefinitionIndex, ) -> Result<()> { let enum_definition = self.source_mapper.bytecode.enum_def_at(enum_def_idx); @@ -399,13 +511,22 @@ impl<'a> Disassembler<'a> { .identifier_at(enum_handle.name) .to_string(); - any_write!(buffer, "enum {name}")?; + any_write!(buffer, "enum ")?; + let enum_name_loc = any_write!(buffer, "{name}")?; + if let Some(bcode_map) = bcode_map_opt { + bcode_map.add_top_level_enum_mapping(enum_def_idx, enum_name_loc)?; + } - Self::disassemble_datatype_type_formals( + let type_param_source_names = Self::disassemble_datatype_type_formals( buffer, &enum_source_map.type_parameters, &enum_handle.type_parameters, )?; + if let Some(bcode_map) = bcode_map_opt { + for n in type_param_source_names { + bcode_map.add_enum_type_parameter_mapping(enum_def_idx, n)?; + } + } Self::disassemble_abilites(buffer, enum_handle.abilities)?; @@ -421,8 +542,11 @@ impl<'a> Disassembler<'a> { .bytecode .identifier_at(variant.variant_name); - any_write!(buffer, "\n\t{variant_name} {{ ")?; + any_write!(buffer, "\n\t")?; + let variant_start_offset = buffer.byte_len(); + any_write!(buffer, "{variant_name} {{ ")?; + let mut field_locs = vec![]; delimited_list( &variant.fields, "", @@ -435,7 +559,10 @@ impl<'a> Disassembler<'a> { .source_mapper .bytecode .identifier_at(field_definition.name); - any_write!(buffer, "{field_name}: ")?; + let field_name_loc = any_write!(buffer, "{field_name}")?; + field_locs.push(field_name_loc); + + any_write!(buffer, ": ")?; self.disassemble_sig_tok( buffer, &type_sig.0, @@ -445,16 +572,67 @@ impl<'a> Disassembler<'a> { }, )?; - any_write!(buffer, " }}") + any_write!(buffer, " }}")?; + // perhaps surprisingly, but the location is of the whole variant + // and not just of its name + let variant_end_offset = buffer.byte_len(); + if let Some(bcode_map) = bcode_map_opt { + let variant_loc = + Loc::new(FileHash::empty(), variant_start_offset, variant_end_offset); + bcode_map.add_enum_variant_mapping( + enum_def_idx, + (variant_name.to_string(), variant_loc), + field_locs, + )?; + } + Ok(()) }, )?; Ok(()) } + fn add_function_bytecode_map( + &self, + bcode_map: &mut SourceMap, + function_definition_index: FunctionDefinitionIndex, + fun_name_loc: Loc, + fun_def_loc: Loc, + is_native: bool, + type_param_source_names: Vec, + param_source_names: Vec, + return_locs: Vec, + locals: Vec, + code_locations: BTreeMap, + ) -> Result<()> { + bcode_map.add_top_level_function_mapping( + function_definition_index, + fun_name_loc, + fun_def_loc, + is_native, + )?; + for n in type_param_source_names { + bcode_map.add_function_type_parameter_mapping(function_definition_index, n)?; + } + for n in param_source_names { + bcode_map.add_parameter_mapping(function_definition_index, n)?; + } + for loc in return_locs { + bcode_map.add_return_mapping(function_definition_index, loc)?; + } + for name in locals { + bcode_map.add_local_mapping(function_definition_index, name)?; + } + for (offset, loc) in code_locations { + bcode_map.add_code_mapping(function_definition_index, offset, loc)?; + } + Ok(()) + } + fn disassemble_function_definition( &self, - buffer: &mut impl Write, + buffer: &mut (impl Write + ByteLength), + bcode_map_opt: &mut Option, function_definition_index: FunctionDefinitionIndex, ) -> Result<()> { let function_definition = self @@ -497,15 +675,18 @@ impl<'a> Disassembler<'a> { Visibility::Public => "public ", }; + let fun_def_start_offset = buffer.byte_len(); let entry_modifier = if function.is_entry { "entry " } else { "" }; let native_modifier = if function.is_native() { "native " } else { "" }; any_write!( buffer, - "{entry_modifier}{native_modifier}{visibility_modifier}{name}", + "{entry_modifier}{native_modifier}{visibility_modifier}", )?; - Self::disassemble_fun_type_formals( + let fun_name_loc = any_write!(buffer, "{name}",)?; + + let type_param_source_names = Self::disassemble_fun_type_formals( buffer, &function_source_map.type_parameters, &function_handle.type_parameters, @@ -513,6 +694,7 @@ impl<'a> Disassembler<'a> { any_write!(buffer, "(")?; + let mut param_source_names = vec![]; delimited_list( self.source_mapper .bytecode @@ -525,13 +707,16 @@ impl<'a> Disassembler<'a> { "", buffer, |buffer, (tok, (name, _))| { - any_write!(buffer, "{name}: ")?; + let name_loc = any_write!(buffer, "{name}")?; + param_source_names.push((name.to_string(), name_loc)); + any_write!(buffer, ": ")?; self.disassemble_sig_tok(buffer, tok, None, &function_source_map.type_parameters) }, )?; any_write!(buffer, ")")?; + let mut return_locs = vec![]; delimited_list( &self .source_mapper @@ -543,46 +728,100 @@ impl<'a> Disassembler<'a> { "", buffer, |buffer, tok| { - self.disassemble_sig_tok(buffer, tok, None, &function_source_map.type_parameters) + let return_type_start_offset = buffer.byte_len(); + self.disassemble_sig_tok(buffer, tok, None, &function_source_map.type_parameters)?; + let return_type_end_offset = buffer.byte_len(); + let return_type_loc = Loc::new( + FileHash::empty(), + return_type_start_offset, + return_type_end_offset, + ); + return_locs.push(return_type_loc); + Ok(()) }, )?; let Some(code) = &function.code else { any_writeln!(buffer, ";")?; + let fun_def_end_offset = buffer.byte_len(); + if let Some(bcode_map) = bcode_map_opt { + let fun_def_loc = + Loc::new(FileHash::empty(), fun_def_start_offset, fun_def_end_offset); + self.add_function_bytecode_map( + bcode_map, + function_definition_index, + fun_name_loc, + fun_def_loc, + function.is_native(), + type_param_source_names, + param_source_names, + return_locs, + vec![], + BTreeMap::new(), + )?; + } return Ok(()); }; let params_len = self.source_mapper.bytecode.signature_at(parameters).0.len(); any_writeln!(buffer, " {{")?; - self.disassemble_locals(buffer, function_source_map, code.locals, params_len)?; - self.disassemble_bytecode(buffer, function_source_map, &name, parameters, code)?; + let locals = + self.disassemble_locals(buffer, function_source_map, code.locals, params_len)?; + let code_locations = + self.disassemble_bytecode(buffer, function_source_map, &name, parameters, code)?; self.disassemble_jump_tables(buffer, code)?; - any_writeln!(buffer, "}}") + any_writeln!(buffer, "}}")?; + + let fun_def_end_offset = buffer.byte_len(); + if let Some(bcode_map) = bcode_map_opt { + let fun_loc = Loc::new(FileHash::empty(), fun_def_start_offset, fun_def_end_offset); + self.add_function_bytecode_map( + bcode_map, + function_definition_index, + fun_loc, + fun_name_loc, + function.is_native(), + type_param_source_names, + param_source_names, + return_locs, + locals, + code_locations, + )?; + } + Ok(()) } fn disassemble_locals( &self, - buffer: &mut impl Write, + buffer: &mut (impl Write + ByteLength), function_source_map: &FunctionSourceMap, locals_idx: SignatureIndex, parameter_len: usize, - ) -> Result<()> { + ) -> Result> { + let mut locals = vec![]; if !self.options.print_locals { - return Ok(()); + return Ok(locals); } let signature = self.source_mapper.bytecode.signature_at(locals_idx); for (local_idx, (name, _)) in function_source_map.locals.iter().enumerate() { - any_write!(buffer, "L{}:\t{}: ", local_idx + parameter_len, name)?; + any_write!(buffer, "L{}:\t", local_idx + parameter_len)?; + let name_loc = any_write!(buffer, "{name}")?; + any_write!(buffer, ": ")?; + locals.push((name.clone(), name_loc)); self.disassemble_type_for_local(buffer, function_source_map, local_idx, signature)?; any_writeln!(buffer)?; } - Ok(()) + Ok(locals) } - fn disassemble_jump_tables(&self, buffer: &mut impl Write, code: &CodeUnit) -> Result<()> { + fn disassemble_jump_tables( + &self, + buffer: &mut (impl Write + ByteLength), + code: &CodeUnit, + ) -> Result<()> { if !self.options.print_code || code.jump_tables.is_empty() { return Ok(()); } @@ -616,14 +855,15 @@ impl<'a> Disassembler<'a> { fn disassemble_bytecode( &self, - buffer: &mut impl Write, + buffer: &mut (impl Write + ByteLength), function_source_map: &FunctionSourceMap, function_name: &IdentStr, parameters: SignatureIndex, code: &CodeUnit, - ) -> Result<()> { + ) -> Result> { + let mut code_offsets = BTreeMap::new(); if !self.options.print_code { - return Ok(()); + return Ok(code_offsets); } let parameters = self.source_mapper.bytecode.signature_at(parameters); @@ -665,7 +905,7 @@ impl<'a> Disassembler<'a> { } } - self.disassemble_instruction( + let inst_loc = self.disassemble_instruction( buffer, function_source_map, parameters, @@ -673,6 +913,8 @@ impl<'a> Disassembler<'a> { instruction, )?; + code_offsets.insert(pc as CodeOffset, inst_loc); + any_writeln!( buffer, "{}", @@ -684,12 +926,12 @@ impl<'a> Disassembler<'a> { )?; } - Ok(()) + Ok(code_offsets) } fn disassemble_import( &self, - buffer: &mut impl Write, + buffer: &mut (impl Write + ByteLength), module_handle: &ModuleHandle, ) -> Result<()> { let module_id = self @@ -699,34 +941,39 @@ impl<'a> Disassembler<'a> { if self.is_self_id(&module_id) { // No need to import self handle Ok(()) - } else if let Some(alias) = self.module_aliases.get(&module_id) { - any_writeln!( - buffer, - "use {}::{} as {};", - module_id.address(), - module_id.name(), - alias - ) } else { - any_writeln!(buffer, "use {}::{};", module_id.address(), module_id.name()) + if let Some(alias) = self.module_aliases.get(&module_id) { + any_writeln!( + buffer, + "use {}::{} as {};", + module_id.address(), + module_id.name(), + alias + ) + } else { + any_writeln!(buffer, "use {}::{};", module_id.address(), module_id.name()) + } + .map(|_| ()) } } fn disassemble_instruction( &self, - buffer: &mut impl Write, + buffer: &mut (impl Write + ByteLength), function_source_map: &FunctionSourceMap, parameters: &Signature, locals_sigs: &Signature, instruction: &Bytecode, - ) -> Result<()> { + ) -> Result { macro_rules! parens { ($($args:tt)*) => {{ any_write!(buffer, "(")?; $($args)* - any_write!(buffer, ")") + any_write!(buffer, ")").map(|_| ()) }}; } + + let inst_start_offset = buffer.byte_len(); match instruction { Bytecode::LdConst(idx) => { any_write!(buffer, "LdConst[{idx}]")?; @@ -1026,32 +1273,38 @@ impl<'a> Disassembler<'a> { | Bytecode::MoveFromGenericDeprecated(_) | Bytecode::MoveToDeprecated(_) | Bytecode::MoveToGenericDeprecated(_) => { - any_write!(buffer, "DEPRECATED BYTECODE: {instruction:?}") + any_write!(buffer, "DEPRECATED BYTECODE: {instruction:?}").map(|_| ()) } // All other instructions are OK to be printed using the standard debug print. - x => any_write!(buffer, "{x:#?}"), - } + x => any_write!(buffer, "{x:#?}").map(|_| ()), + }?; + let inst_end_offset = buffer.byte_len(); + Ok(Loc::new( + FileHash::empty(), + inst_start_offset, + inst_end_offset, + )) } // These need to be in the context of a function or a struct definition since type parameters // can refer to function/struct type parameters. fn disassemble_sig_tok( &self, - buffer: &mut impl Write, + buffer: &mut (impl Write + ByteLength), sig_tok: &SignatureToken, type_instantiation: Option<&[SignatureToken]>, type_param_name_context: &[SourceName], ) -> Result<()> { match sig_tok { - SignatureToken::Bool => any_write!(buffer, "bool"), - SignatureToken::U8 => any_write!(buffer, "u8"), - SignatureToken::U16 => any_write!(buffer, "u16"), - SignatureToken::U32 => any_write!(buffer, "u32"), - SignatureToken::U64 => any_write!(buffer, "u64"), - SignatureToken::U128 => any_write!(buffer, "u128"), - SignatureToken::U256 => any_write!(buffer, "u256"), - SignatureToken::Address => any_write!(buffer, "address"), - SignatureToken::Signer => any_write!(buffer, "signer"), + SignatureToken::Bool => any_write!(buffer, "bool").map(|_| ()), + SignatureToken::U8 => any_write!(buffer, "u8").map(|_| ()), + SignatureToken::U16 => any_write!(buffer, "u16").map(|_| ()), + SignatureToken::U32 => any_write!(buffer, "u32").map(|_| ()), + SignatureToken::U64 => any_write!(buffer, "u64").map(|_| ()), + SignatureToken::U128 => any_write!(buffer, "u128").map(|_| ()), + SignatureToken::U256 => any_write!(buffer, "u256").map(|_| ()), + SignatureToken::Address => any_write!(buffer, "address").map(|_| ()), + SignatureToken::Signer => any_write!(buffer, "signer").map(|_| ()), SignatureToken::Datatype(struct_handle_idx) => any_write!( buffer, "{}", @@ -1061,7 +1314,8 @@ impl<'a> Disassembler<'a> { .datatype_handle_at(*struct_handle_idx) .name, ) - ), + ) + .map(|_| ()), SignatureToken::DatatypeInstantiation(struct_inst) => { let (struct_handle_idx, instantiation) = &**struct_inst; let name = self.source_mapper.bytecode.identifier_at( @@ -1088,7 +1342,7 @@ impl<'a> Disassembler<'a> { type_instantiation, type_param_name_context, )?; - any_write!(buffer, ">") + any_write!(buffer, ">").map(|_| ()) } SignatureToken::Reference(sig_tok) => { any_write!(buffer, "&")?; @@ -1116,27 +1370,30 @@ impl<'a> Disassembler<'a> { buffer, "ERROR[Type parameter index {ty_param_index} out of bounds while disassembling type signature]", ) - } + }.map(|_| ()) } SignatureToken::TypeParameter(ty_param_index) => { match type_instantiation.and_then(|i| i.get(*ty_param_index as usize)) { Some(tok) => { self.disassemble_sig_tok(buffer, tok, None, type_param_name_context) } - None => any_write!( - buffer, - "ERROR[Type parameter index {ty_param_index} out of bounds while disassembling type signature]", - ), + None => { + any_write!( + buffer, + "ERROR[Type parameter index {ty_param_index} out of bounds while disassembling type signature]", + ).map(|_| ()) + } } } } } fn disassemble_datatype_type_formals( - buffer: &mut impl Write, + buffer: &mut (impl Write + ByteLength), source_map_ty_params: &[SourceName], type_parameters: &[DatatypeTyParameter], - ) -> Result<()> { + ) -> Result> { + let mut type_param_source_names = vec![]; delimited_list( source_map_ty_params.iter().zip(type_parameters), "<", @@ -1147,16 +1404,21 @@ impl<'a> Disassembler<'a> { if ty_param.is_phantom { buf.write_str("phantom ")?; } - buf.write_str(name.as_str())?; + let type_param_loc = any_write!(buf, "{name}")?; + type_param_source_names.push((name.to_string(), type_param_loc)); delimited_list(ty_param.constraints, ": ", " + ", "", buf, |buf, a| { buf.write_str(&Self::format_ability(a)) .map_err(anyhow::Error::from) }) }, - ) + )?; + Ok(type_param_source_names) } - fn disassemble_abilites(buffer: &mut impl Write, abilities: AbilitySet) -> Result<()> { + fn disassemble_abilites( + buffer: &mut (impl Write + ByteLength), + abilities: AbilitySet, + ) -> Result<()> { if abilities == AbilitySet::EMPTY { return Ok(()); } @@ -1167,10 +1429,11 @@ impl<'a> Disassembler<'a> { } fn disassemble_fun_type_formals( - buffer: &mut impl Write, + buffer: &mut (impl Write + ByteLength), source_map_ty_params: &[SourceName], ablities: &[AbilitySet], - ) -> Result<()> { + ) -> Result> { + let mut type_param_source_names = vec![]; delimited_list( source_map_ty_params.iter().zip(ablities), "<", @@ -1178,17 +1441,19 @@ impl<'a> Disassembler<'a> { ">", buffer, |buffer, ((name, _), abs)| { - any_write!(buffer, "{}", name)?; + let type_param_loc = any_write!(buffer, "{name}")?; + type_param_source_names.push((name.to_string(), type_param_loc)); delimited_list(*abs, ": ", " + ", "", buffer, |buffer, a| { - any_write!(buffer, "{}", Self::format_ability(a)) + any_write!(buffer, "{}", Self::format_ability(a)).map(|_| ()) }) }, - ) + )?; + Ok(type_param_source_names) } fn disassemble_type_for_local( &self, - buffer: &mut impl Write, + buffer: &mut (impl Write + ByteLength), function_source_map: &FunctionSourceMap, local_idx: usize, locals: &Signature, @@ -1205,7 +1470,7 @@ impl<'a> Disassembler<'a> { fn disassemble_type_for_parameter_or_local( &self, - buffer: &mut impl Write, + buffer: &mut (impl Write + ByteLength), function_source_map: &FunctionSourceMap, idx: usize, parameters: &Signature, @@ -1227,7 +1492,7 @@ impl<'a> Disassembler<'a> { fn disassemble_type_for_field( &self, - buffer: &mut impl Write, + buffer: &mut (impl Write + ByteLength), function_source_map: &FunctionSourceMap, instantiation: Option<&[SignatureToken]>, field_idx: FieldHandleIndex, @@ -1239,11 +1504,13 @@ impl<'a> Disassembler<'a> { .struct_def_at(field_handle.owner); let field_def = match &struct_def.field_information { StructFieldInformation::Native => { - return any_write!(buffer, "ERROR[Attempt to access field on a native struct]"); + return any_write!(buffer, "ERROR[Attempt to access field on a native struct]") + .map(|_| ()); } StructFieldInformation::Declared(fields) => { let Some(fields) = fields.get(field_handle.field as usize) else { - return any_write!(buffer, "ERROR[Bad field index {}]", field_handle.field); + return any_write!(buffer, "ERROR[Bad field index {}]", field_handle.field) + .map(|_| ()); }; fields } @@ -1259,7 +1526,7 @@ impl<'a> Disassembler<'a> { fn disassemble_struct_call( &self, - buffer: &mut impl Write, + buffer: &mut (impl Write + ByteLength), function_source_map: &FunctionSourceMap, struct_idx: StructDefinitionIndex, signature: &Signature, @@ -1282,7 +1549,7 @@ impl<'a> Disassembler<'a> { fn disassemble_constant( &self, - buffer: &mut impl Write, + buffer: &mut (impl Write + ByteLength), const_idx: usize, constant: &Constant, use_inline_formatting: bool, @@ -1300,11 +1567,12 @@ impl<'a> Disassembler<'a> { self.disassemble_sig_tok(buffer, &constant.type_, None, &[])?; any_writeln!(buffer, ": {data_str}") } + .map(|_| ()) } fn disassemble_struct_field_access( &self, - buffer: &mut impl Write, + buffer: &mut (impl Write + ByteLength), field_idx: FieldHandleIndex, ) -> Result<()> { let field_handle = self.source_mapper.bytecode.field_handle_at(field_idx); @@ -1318,11 +1586,13 @@ impl<'a> Disassembler<'a> { buffer, "ERROR[Attempt to access field on a native struct {}]", field_idx - ); + ) + .map(|_| ()); } StructFieldInformation::Declared(fields) => { let Some(fields) = fields.get(field_handle.field as usize) else { - return any_write!(buffer, "ERROR[Bad field index {}]", field_handle.field); + return any_write!(buffer, "ERROR[Bad field index {}]", field_handle.field) + .map(|_| ()); }; fields } @@ -1341,12 +1611,12 @@ impl<'a> Disassembler<'a> { .bytecode .identifier_at(struct_handle.name) .to_string(); - any_write!(buffer, "{struct_name}.{field_name}") + any_write!(buffer, "{struct_name}.{field_name}").map(|_| ()) } fn disassemble_function_string( &self, - buffer: &mut impl Write, + buffer: &mut (impl Write + ByteLength), module_handle: &ModuleHandle, function_handle: &FunctionHandle, ) -> Result<()> { @@ -1369,6 +1639,7 @@ impl<'a> Disassembler<'a> { .unwrap_or_else(|| module_id.name().to_string()); any_write!(buffer, "{module_name}::{function_name}") } + .map(|_| ()) } } diff --git a/external-crates/move/crates/move-package/Cargo.toml b/external-crates/move/crates/move-package/Cargo.toml index dc648dc5503a3..282b22ba07466 100644 --- a/external-crates/move/crates/move-package/Cargo.toml +++ b/external-crates/move/crates/move-package/Cargo.toml @@ -30,6 +30,7 @@ move-binary-format.workspace = true move-compiler.workspace = true move-bytecode-source-map.workspace = true move-docgen.workspace = true +move-disassembler.workspace = true move-core-types.workspace = true move-symbol-pool.workspace = true move-command-line-common.workspace = true diff --git a/external-crates/move/crates/move-package/src/compilation/compiled_package.rs b/external-crates/move/crates/move-package/src/compilation/compiled_package.rs index 30f68519afa1b..418c8ce0f9523 100644 --- a/external-crates/move/crates/move-package/src/compilation/compiled_package.rs +++ b/external-crates/move/crates/move-package/src/compilation/compiled_package.rs @@ -15,11 +15,13 @@ use anyhow::{ensure, Result}; use colored::Colorize; use itertools::{Either, Itertools}; use move_binary_format::file_format::CompiledModule; -use move_bytecode_source_map::utils::{serialize_to_json, source_map_from_file}; +use move_bytecode_source_map::utils::{ + serialize_to_json, serialize_to_json_string, source_map_from_file, +}; use move_bytecode_utils::Modules; use move_command_line_common::files::{ - extension_equals, find_filenames, try_exists, FileHash, MOVE_COMPILED_EXTENSION, - MOVE_EXTENSION, SOURCE_MAP_EXTENSION, + extension_equals, find_filenames, try_exists, FileHash, MOVE_BYTECODE_EXTENSION, + MOVE_COMPILED_EXTENSION, MOVE_EXTENSION, SOURCE_MAP_EXTENSION, }; use move_compiler::{ compiled_unit::{AnnotatedCompiledUnit, CompiledUnit, NamedCompiledModule}, @@ -29,6 +31,7 @@ use move_compiler::{ sui_mode::{self}, Compiler, }; +use move_disassembler::disassembler::Disassembler; use move_docgen::{Docgen, DocgenOptions}; use move_model::{model::GlobalEnv, options::ModelBuilderOptions, run_model_builder_with_options}; use move_symbol_pool::Symbol; @@ -354,6 +357,36 @@ impl OnDiskCompiledPackage { std::fs::read_to_string(&compiled_unit.source_path)?.as_bytes(), ) } + + fn save_disassembly_to_disk( + &self, + package_name: Symbol, + unit: &CompiledUnitWithSource, + ) -> Result<()> { + let root_package = self.package.compiled_package_info.package_name; + assert!(self.root_path.ends_with(root_package.as_str())); + let disassembly_dir = CompiledPackageLayout::Disassembly.path(); + let file_path = if root_package == package_name { + PathBuf::new() + } else { + CompiledPackageLayout::Dependencies + .path() + .join(package_name.as_str()) + } + .join(unit.unit.name.as_str()); + let d = Disassembler::from_unit(&unit.unit); + let (disassembled_string, bytecode_map) = d.disassemble_with_source_map()?; + self.save_under( + disassembly_dir + .join(&file_path) + .with_extension(MOVE_BYTECODE_EXTENSION), + disassembled_string.as_bytes(), + )?; + self.save_under( + disassembly_dir.join(&file_path).with_extension("json"), + serialize_to_json_string(&bytecode_map)?.as_bytes(), + ) + } } impl CompiledPackage { @@ -710,9 +743,15 @@ impl CompiledPackage { for compiled_unit in &self.root_compiled_units { on_disk_package.save_compiled_unit(root_package, compiled_unit)?; + if self.compiled_package_info.build_flags.save_disassembly { + on_disk_package.save_disassembly_to_disk(root_package, compiled_unit)?; + } } for (dep_name, compiled_unit) in &self.deps_compiled_units { on_disk_package.save_compiled_unit(*dep_name, compiled_unit)?; + if self.compiled_package_info.build_flags.save_disassembly { + on_disk_package.save_disassembly_to_disk(*dep_name, compiled_unit)?; + } } if let Some(docs) = &self.compiled_docs { diff --git a/external-crates/move/crates/move-package/src/compilation/package_layout.rs b/external-crates/move/crates/move-package/src/compilation/package_layout.rs index 485d0ba23160c..2b22bfeea22da 100644 --- a/external-crates/move/crates/move-package/src/compilation/package_layout.rs +++ b/external-crates/move/crates/move-package/src/compilation/package_layout.rs @@ -14,6 +14,7 @@ pub enum CompiledPackageLayout { LockFiles, CompiledModules, CompiledDocs, + Disassembly, } impl CompiledPackageLayout { @@ -27,6 +28,7 @@ impl CompiledPackageLayout { Self::LockFiles => "locks", Self::CompiledModules => "bytecode_modules", Self::CompiledDocs => "docs", + Self::Disassembly => "disassembly", }; Path::new(path) } diff --git a/external-crates/move/crates/move-package/src/lib.rs b/external-crates/move/crates/move-package/src/lib.rs index fab7954ffea73..3b153a7a2148e 100644 --- a/external-crates/move/crates/move-package/src/lib.rs +++ b/external-crates/move/crates/move-package/src/lib.rs @@ -60,6 +60,11 @@ pub struct BuildConfig { #[clap(name = "generate-docs", long = "doc", global = true)] pub generate_docs: bool, + /// Save disassembly for generated bytecode along with + /// bytecode maps (source maps for disassembeld bytecode) + #[clap(name = "save-disassembly", long = "disassemble", global = true)] + pub save_disassembly: bool, + /// Installation directory for compiled artifacts. Defaults to current directory. #[clap(long = "install-dir", global = true)] pub install_dir: Option, diff --git a/external-crates/move/crates/move-package/tests/test_sources/basic_no_deps/Move.compiled b/external-crates/move/crates/move-package/tests/test_sources/basic_no_deps/Move.compiled index b056fff11133d..bd612df2bc73a 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/basic_no_deps/Move.compiled +++ b/external-crates/move/crates/move-package/tests/test_sources/basic_no_deps/Move.compiled @@ -8,6 +8,7 @@ CompiledPackageInfo { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/basic_no_deps/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/basic_no_deps/Move.resolved index b50dc2ffac738..f139b6175549b 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/basic_no_deps/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/basic_no_deps/Move.resolved @@ -17,6 +17,7 @@ ResolvedGraph { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/basic_no_deps_address_assigned/Move.compiled b/external-crates/move/crates/move-package/tests/test_sources/basic_no_deps_address_assigned/Move.compiled index 70de47509f07a..220778ea35bdd 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/basic_no_deps_address_assigned/Move.compiled +++ b/external-crates/move/crates/move-package/tests/test_sources/basic_no_deps_address_assigned/Move.compiled @@ -10,6 +10,7 @@ CompiledPackageInfo { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/basic_no_deps_address_assigned/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/basic_no_deps_address_assigned/Move.resolved index e2890247aeb4d..7ba41cacb5048 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/basic_no_deps_address_assigned/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/basic_no_deps_address_assigned/Move.resolved @@ -17,6 +17,7 @@ ResolvedGraph { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/basic_no_deps_address_not_assigned_with_dev_assignment/Move.compiled b/external-crates/move/crates/move-package/tests/test_sources/basic_no_deps_address_not_assigned_with_dev_assignment/Move.compiled index 238432b0d829a..9da446a816092 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/basic_no_deps_address_not_assigned_with_dev_assignment/Move.compiled +++ b/external-crates/move/crates/move-package/tests/test_sources/basic_no_deps_address_not_assigned_with_dev_assignment/Move.compiled @@ -10,6 +10,7 @@ CompiledPackageInfo { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/basic_no_deps_address_not_assigned_with_dev_assignment/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/basic_no_deps_address_not_assigned_with_dev_assignment/Move.resolved index 7add7e0f00a77..0d7dd01f98bec 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/basic_no_deps_address_not_assigned_with_dev_assignment/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/basic_no_deps_address_not_assigned_with_dev_assignment/Move.resolved @@ -17,6 +17,7 @@ ResolvedGraph { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/basic_no_deps_test_mode/Move.compiled b/external-crates/move/crates/move-package/tests/test_sources/basic_no_deps_test_mode/Move.compiled index 2b4dfb33deed6..dd27f14a08e1d 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/basic_no_deps_test_mode/Move.compiled +++ b/external-crates/move/crates/move-package/tests/test_sources/basic_no_deps_test_mode/Move.compiled @@ -10,6 +10,7 @@ CompiledPackageInfo { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/dep_dev_dep_diamond/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/dep_dev_dep_diamond/Move.resolved index 6e7013d1f889e..6040938edf089 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/dep_dev_dep_diamond/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/dep_dev_dep_diamond/Move.resolved @@ -106,6 +106,7 @@ ResolvedGraph { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/dep_good_digest/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/dep_good_digest/Move.resolved index b455ac81c3c06..5a7aa443db9dd 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/dep_good_digest/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/dep_good_digest/Move.resolved @@ -37,6 +37,7 @@ ResolvedGraph { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_backflow_resolution/Move.compiled b/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_backflow_resolution/Move.compiled index 83456cf89c948..31e1ab56fd702 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_backflow_resolution/Move.compiled +++ b/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_backflow_resolution/Move.compiled @@ -11,6 +11,7 @@ CompiledPackageInfo { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_backflow_resolution/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_backflow_resolution/Move.resolved index 4b9f6a8b4500d..505f1589b7456 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_backflow_resolution/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_backflow_resolution/Move.resolved @@ -81,6 +81,7 @@ ResolvedGraph { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_dev_override_with_reg/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_dev_override_with_reg/Move.resolved index 7413ccc0bfff3..d39d91217498e 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_dev_override_with_reg/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_dev_override_with_reg/Move.resolved @@ -87,6 +87,7 @@ ResolvedGraph { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_external_no_conflict/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_external_no_conflict/Move.resolved index e59c52416df07..fad5fdf889c44 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_external_no_conflict/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_external_no_conflict/Move.resolved @@ -85,6 +85,7 @@ ResolvedGraph { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_external_override/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_external_override/Move.resolved index 0585fff693f3b..43af29af1a5df 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_external_override/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_external_override/Move.resolved @@ -91,6 +91,7 @@ ResolvedGraph { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_external_override_root/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_external_override_root/Move.resolved index b06b447aa9963..ef165b4d39e02 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_external_override_root/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_external_override_root/Move.resolved @@ -107,6 +107,7 @@ ResolvedGraph { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_nested_override/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_nested_override/Move.resolved index 1053697b1e4bc..edce16b8457d0 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_nested_override/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_nested_override/Move.resolved @@ -133,6 +133,7 @@ ResolvedGraph { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_override/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_override/Move.resolved index edeb0af1dc438..01403a1287a54 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_override/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_override/Move.resolved @@ -89,6 +89,7 @@ ResolvedGraph { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_transitive_nested_override/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_transitive_nested_override/Move.resolved index 70d90ae5c5e5d..9baca51138d7a 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_transitive_nested_override/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_transitive_nested_override/Move.resolved @@ -125,6 +125,7 @@ ResolvedGraph { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_two_nested_overrides/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_two_nested_overrides/Move.resolved index 0651d784c28b7..d1749ce9bd0ff 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_two_nested_overrides/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_two_nested_overrides/Move.resolved @@ -141,6 +141,7 @@ ResolvedGraph { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_with_deps/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_with_deps/Move.resolved index c64ebf2c09da9..f9adf8ab3cea1 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_with_deps/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_with_deps/Move.resolved @@ -141,6 +141,7 @@ ResolvedGraph { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dual_override/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dual_override/Move.resolved index 231ad17075531..710778003e492 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dual_override/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dual_override/Move.resolved @@ -141,6 +141,7 @@ ResolvedGraph { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_no_conflict/Move.compiled b/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_no_conflict/Move.compiled index 83456cf89c948..31e1ab56fd702 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_no_conflict/Move.compiled +++ b/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_no_conflict/Move.compiled @@ -11,6 +11,7 @@ CompiledPackageInfo { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_no_conflict/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_no_conflict/Move.resolved index 3b6235611c62d..120cdfd2541e9 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_no_conflict/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_no_conflict/Move.resolved @@ -81,6 +81,7 @@ ResolvedGraph { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_with_and_without_override_v1/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_with_and_without_override_v1/Move.resolved index 07ccf38f9bf1d..e0b01924fd38c 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_with_and_without_override_v1/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_with_and_without_override_v1/Move.resolved @@ -117,6 +117,7 @@ ResolvedGraph { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_with_and_without_override_v2/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_with_and_without_override_v2/Move.resolved index ce3c1d0f5b3d4..99e4ede9cedcc 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_with_and_without_override_v2/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_with_and_without_override_v2/Move.resolved @@ -117,6 +117,7 @@ ResolvedGraph { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/direct_and_indirect_dep/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/direct_and_indirect_dep/Move.resolved index 6dfd1091c609d..eac8a601bd502 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/direct_and_indirect_dep/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/direct_and_indirect_dep/Move.resolved @@ -81,6 +81,7 @@ ResolvedGraph { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/external/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/external/Move.resolved index 0237bb21e49b2..3168c5e708187 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/external/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/external/Move.resolved @@ -59,6 +59,7 @@ ResolvedGraph { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/external_dev_dep/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/external_dev_dep/Move.resolved index aaa0fc6dc3e34..523ad80ef4645 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/external_dev_dep/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/external_dev_dep/Move.resolved @@ -97,6 +97,7 @@ ResolvedGraph { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/external_overlap/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/external_overlap/Move.resolved index c8cc30c36935a..e11225b637f33 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/external_overlap/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/external_overlap/Move.resolved @@ -67,6 +67,7 @@ ResolvedGraph { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/external_package_batch_response/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/external_package_batch_response/Move.resolved index dd5a8f90cd2a1..89724d5e1e05b 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/external_package_batch_response/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/external_package_batch_response/Move.resolved @@ -61,6 +61,7 @@ ResolvedGraph { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/external_resolver_config/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/external_resolver_config/Move.resolved index 7bcee822c4b33..15e0e3ff3513c 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/external_resolver_config/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/external_resolver_config/Move.resolved @@ -17,6 +17,7 @@ ResolvedGraph { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/multiple_deps_from_lock/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/multiple_deps_from_lock/Move.resolved index 179cb2d294cfb..8880c36d4a5af 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/multiple_deps_from_lock/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/multiple_deps_from_lock/Move.resolved @@ -55,6 +55,7 @@ ResolvedGraph { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/multiple_deps_from_lock_no_manifest/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/multiple_deps_from_lock_no_manifest/Move.resolved index 89add364dd0d1..cfab7f673a2ac 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/multiple_deps_from_lock_no_manifest/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/multiple_deps_from_lock_no_manifest/Move.resolved @@ -55,6 +55,7 @@ ResolvedGraph { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/multiple_deps_rename/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/multiple_deps_rename/Move.resolved index d9f74d4b133c6..3e322894e0709 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/multiple_deps_rename/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/multiple_deps_rename/Move.resolved @@ -55,6 +55,7 @@ ResolvedGraph { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/multiple_deps_rename_one/Move.compiled b/external-crates/move/crates/move-package/tests/test_sources/multiple_deps_rename_one/Move.compiled index 020373e5a4358..b55e56d689a8d 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/multiple_deps_rename_one/Move.compiled +++ b/external-crates/move/crates/move-package/tests/test_sources/multiple_deps_rename_one/Move.compiled @@ -12,6 +12,7 @@ CompiledPackageInfo { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/nested_deps_git_local/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/nested_deps_git_local/Move.resolved index cf1b85f967af5..cbb84f79631a2 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/nested_deps_git_local/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/nested_deps_git_local/Move.resolved @@ -63,6 +63,7 @@ ResolvedGraph { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/nested_deps_shared_override/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/nested_deps_shared_override/Move.resolved index 4065110b72aa3..7a0d63792d74f 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/nested_deps_shared_override/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/nested_deps_shared_override/Move.resolved @@ -97,6 +97,7 @@ ResolvedGraph { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/nested_pruned_override/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/nested_pruned_override/Move.resolved index 28f0726244d0c..1e1fe46a59a4d 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/nested_pruned_override/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/nested_pruned_override/Move.resolved @@ -81,6 +81,7 @@ ResolvedGraph { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/one_dep/Move.compiled b/external-crates/move/crates/move-package/tests/test_sources/one_dep/Move.compiled index 975474a9077f1..a1f840c778df8 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/one_dep/Move.compiled +++ b/external-crates/move/crates/move-package/tests/test_sources/one_dep/Move.compiled @@ -10,6 +10,7 @@ CompiledPackageInfo { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/one_dep/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/one_dep/Move.resolved index a5fcdce0a3abe..dc0c387ea283b 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/one_dep/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/one_dep/Move.resolved @@ -37,6 +37,7 @@ ResolvedGraph { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/one_dep_assigned_address/Move.compiled b/external-crates/move/crates/move-package/tests/test_sources/one_dep_assigned_address/Move.compiled index 975474a9077f1..a1f840c778df8 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/one_dep_assigned_address/Move.compiled +++ b/external-crates/move/crates/move-package/tests/test_sources/one_dep_assigned_address/Move.compiled @@ -10,6 +10,7 @@ CompiledPackageInfo { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/one_dep_assigned_address/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/one_dep_assigned_address/Move.resolved index d49b738da3091..5ee5216e5692f 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/one_dep_assigned_address/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/one_dep_assigned_address/Move.resolved @@ -37,6 +37,7 @@ ResolvedGraph { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/one_dep_multiple_of_same_name/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/one_dep_multiple_of_same_name/Move.resolved index 295bbb57ba375..4b081fc24e857 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/one_dep_multiple_of_same_name/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/one_dep_multiple_of_same_name/Move.resolved @@ -37,6 +37,7 @@ ResolvedGraph { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/one_dep_override/Move.compiled b/external-crates/move/crates/move-package/tests/test_sources/one_dep_override/Move.compiled index 975474a9077f1..a1f840c778df8 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/one_dep_override/Move.compiled +++ b/external-crates/move/crates/move-package/tests/test_sources/one_dep_override/Move.compiled @@ -10,6 +10,7 @@ CompiledPackageInfo { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/one_dep_override/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/one_dep_override/Move.resolved index c56c8c98c5906..22afaaf633ca5 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/one_dep_override/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/one_dep_override/Move.resolved @@ -37,6 +37,7 @@ ResolvedGraph { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/one_dep_reassigned_address/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/one_dep_reassigned_address/Move.resolved index e365228f0b227..83cd780269ece 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/one_dep_reassigned_address/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/one_dep_reassigned_address/Move.resolved @@ -37,6 +37,7 @@ ResolvedGraph { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/one_dep_renamed/Move.compiled b/external-crates/move/crates/move-package/tests/test_sources/one_dep_renamed/Move.compiled index 975474a9077f1..a1f840c778df8 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/one_dep_renamed/Move.compiled +++ b/external-crates/move/crates/move-package/tests/test_sources/one_dep_renamed/Move.compiled @@ -10,6 +10,7 @@ CompiledPackageInfo { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/one_dep_unification_across_local_renamings/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/one_dep_unification_across_local_renamings/Move.resolved index 6975251ff244d..b02295e3c792a 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/one_dep_unification_across_local_renamings/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/one_dep_unification_across_local_renamings/Move.resolved @@ -37,6 +37,7 @@ ResolvedGraph { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/one_dep_with_scripts/Move.compiled b/external-crates/move/crates/move-package/tests/test_sources/one_dep_with_scripts/Move.compiled index 975474a9077f1..a1f840c778df8 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/one_dep_with_scripts/Move.compiled +++ b/external-crates/move/crates/move-package/tests/test_sources/one_dep_with_scripts/Move.compiled @@ -10,6 +10,7 @@ CompiledPackageInfo { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/parsing_edition_2024/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/parsing_edition_2024/Move.resolved index 8158e05781c42..a0b28f34d93e3 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/parsing_edition_2024/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/parsing_edition_2024/Move.resolved @@ -17,6 +17,7 @@ ResolvedGraph { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/parsing_edition_2024_alpha/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/parsing_edition_2024_alpha/Move.resolved index d9e35cdce540d..8ce5d339ece18 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/parsing_edition_2024_alpha/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/parsing_edition_2024_alpha/Move.resolved @@ -17,6 +17,7 @@ ResolvedGraph { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/parsing_edition_2024_beta/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/parsing_edition_2024_beta/Move.resolved index 5fc233fa38521..4b5ae57fd5a25 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/parsing_edition_2024_beta/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/parsing_edition_2024_beta/Move.resolved @@ -17,6 +17,7 @@ ResolvedGraph { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/parsing_edition_legacy/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/parsing_edition_legacy/Move.resolved index 7040db0b49e58..4576422739ca1 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/parsing_edition_legacy/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/parsing_edition_legacy/Move.resolved @@ -17,6 +17,7 @@ ResolvedGraph { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/parsing_flavor_global_storage/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/parsing_flavor_global_storage/Move.resolved index 270425a58dfa6..3562daeea0b3e 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/parsing_flavor_global_storage/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/parsing_flavor_global_storage/Move.resolved @@ -17,6 +17,7 @@ ResolvedGraph { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/parsing_flavor_sui/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/parsing_flavor_sui/Move.resolved index 253c0d02f1e80..3fca8a7cd6f81 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/parsing_flavor_sui/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/parsing_flavor_sui/Move.resolved @@ -17,6 +17,7 @@ ResolvedGraph { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/parsing_invalid_identifier_package_name/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/parsing_invalid_identifier_package_name/Move.resolved index 1d595ef2f77b9..55bced96a5a67 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/parsing_invalid_identifier_package_name/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/parsing_invalid_identifier_package_name/Move.resolved @@ -17,6 +17,7 @@ ResolvedGraph { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/parsing_minimal_manifest/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/parsing_minimal_manifest/Move.resolved index c24919f0f8866..b61d26d84ef05 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/parsing_minimal_manifest/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/parsing_minimal_manifest/Move.resolved @@ -17,6 +17,7 @@ ResolvedGraph { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/resolve_pkg_name/Move.compiled b/external-crates/move/crates/move-package/tests/test_sources/resolve_pkg_name/Move.compiled index 529fb0a8e0450..50ce90fd0f347 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/resolve_pkg_name/Move.compiled +++ b/external-crates/move/crates/move-package/tests/test_sources/resolve_pkg_name/Move.compiled @@ -11,6 +11,7 @@ CompiledPackageInfo { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/resolve_pkg_name/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/resolve_pkg_name/Move.resolved index 1234b880dd6e6..c58f24b687e5d 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/resolve_pkg_name/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/resolve_pkg_name/Move.resolved @@ -81,6 +81,7 @@ ResolvedGraph { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/resolve_pkg_name_override/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/resolve_pkg_name_override/Move.resolved index 84e6ebde2d579..adf3d4216cb5e 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/resolve_pkg_name_override/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/resolve_pkg_name_override/Move.resolved @@ -89,6 +89,7 @@ ResolvedGraph { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/resolve_version/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/resolve_version/Move.resolved index 07ffe1bdddf64..dab4cb10a6706 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/resolve_version/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/resolve_version/Move.resolved @@ -59,6 +59,7 @@ ResolvedGraph { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/resolve_version_diamond/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/resolve_version_diamond/Move.resolved index 53d1540a8864f..05ba1f8545fed 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/resolve_version_diamond/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/resolve_version_diamond/Move.resolved @@ -87,6 +87,7 @@ ResolvedGraph { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/resolve_version_diamond_deep/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/resolve_version_diamond_deep/Move.resolved index a9ce3d414b962..1c23816f79db1 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/resolve_version_diamond_deep/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/resolve_version_diamond_deep/Move.resolved @@ -105,6 +105,7 @@ ResolvedGraph { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/resolve_version_diamond_deep_success/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/resolve_version_diamond_deep_success/Move.resolved index 26a8d230507a8..c138f7b05e8dd 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/resolve_version_diamond_deep_success/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/resolve_version_diamond_deep_success/Move.resolved @@ -107,6 +107,7 @@ ResolvedGraph { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/resolve_version_diamond_external/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/resolve_version_diamond_external/Move.resolved index 2aeb9fda97556..a81eeb91fcb13 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/resolve_version_diamond_external/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/resolve_version_diamond_external/Move.resolved @@ -87,6 +87,7 @@ ResolvedGraph { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/resolve_version_diamond_override/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/resolve_version_diamond_override/Move.resolved index 501250aa54294..ea844c4e1255c 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/resolve_version_diamond_override/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/resolve_version_diamond_override/Move.resolved @@ -95,6 +95,7 @@ ResolvedGraph { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/external-crates/move/crates/move-package/tests/test_sources/test_symlinks/Move.compiled b/external-crates/move/crates/move-package/tests/test_sources/test_symlinks/Move.compiled index 70de47509f07a..220778ea35bdd 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/test_symlinks/Move.compiled +++ b/external-crates/move/crates/move-package/tests/test_sources/test_symlinks/Move.compiled @@ -10,6 +10,7 @@ CompiledPackageInfo { dev_mode: true, test_mode: false, generate_docs: false, + save_disassembly: false, install_dir: Some( "ELIDED_FOR_TEST", ),