Skip to content

[move-compiler] A leaner version of pre-compiled libs #22422

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

awelc
Copy link
Contributor

@awelc awelc commented Jun 17, 2025

Description

This PR replaces FullyCompiledProgram used for testing and in to speed up compilation in move-analyzer with a much leaner per-module CompiledModuleInfo structure.

The effect on move-analyzer's memory consumption is quite dramatic - for a single package with default dependencies, memory footprint shrinks to ~350M vs. 1.4GB before this optimization was implemented.

The changes to move-analyzer are more involved than simply swapping FullyCompiledProgram with CompiledModuleInfo for the following reason. Prior to this PR we could use pre-compiled dependencies during first compilation as it contained full parsing and typing ASTs that could be directly plugged into the analysis even though the pre-analyzed dependencies were not available during this first compilation. Now we no longer have full ASTs available so we do the first compilation without pre-compiled dependencies (so that full ASTs for both user program and dependencies can be produced), and use both pre-compiled dependencies (for faster compilation) and pre-analyzed dependencies (to avoid re-analyzing them) during subsequent compilations. This results in the first compilation to be slower but I'd say it's an acceptable trade-off

Test plan

All CI tests must pass. Tested move-analyzer modifications manually

Copy link

vercel bot commented Jun 17, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sui-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 18, 2025 0:40am
2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
multisig-toolkit ⬜️ Ignored (Inspect) Visit Preview Jun 18, 2025 0:40am
sui-kiosk ⬜️ Ignored (Inspect) Visit Preview Jun 18, 2025 0:40am

@@ -19,7 +19,7 @@ function version(path: string, args?: readonly string[]): string | null {
const versionString = childProcess.spawnSync(
path, args, { encoding: 'utf8' },
);
return versionString.stdout;
return versionString.stdout || null;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unrelated change fixing a problem discovered when debugging move-analyzer changes for this PR

@@ -195,6 +195,14 @@ impl<'a> ParsingAnalysisContext<'a> {
assert!(self.current_mod_ident_str.is_none());
self.current_mod_ident_str = Some(mod_ident_str.clone());

if mod_use_defs.get(&mod_ident_str).is_none() {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This did not need handling before as we were doing compilation with pre-compiled libraries right from the start. Now we do the first. Now we do first compilation without pre-compiled libraries as explained in the PR description.

@awelc awelc force-pushed the aw/move-compiler-new-precompiled branch from 3bedb91 to 305fa04 Compare June 18, 2025 00:23
@awelc awelc temporarily deployed to sui-typescript-aws-kms-test-env June 18, 2025 00:23 — with GitHub Actions Inactive
@awelc awelc temporarily deployed to sui-typescript-aws-kms-test-env June 18, 2025 00:39 — with GitHub Actions Inactive
@awelc awelc self-assigned this Jun 18, 2025
@awelc awelc marked this pull request as ready for review June 18, 2025 01:31
@awelc awelc temporarily deployed to sui-typescript-aws-kms-test-env June 18, 2025 01:32 — with GitHub Actions Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant