Skip to content

codegen optimization: constant expression folding #7149

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

Draft
wants to merge 43 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
9a9a864
asm_generation: if a condition is constant, make jump unconditional
Dentosal Apr 15, 2025
7e576ac
Optimize using symbolic interpretation
Dentosal Apr 23, 2025
2f9ae92
Update tests
Dentosal Apr 23, 2025
a80b238
Fix typo
Dentosal Apr 23, 2025
2e3ecc5
Uncomment some tests
Dentosal Apr 23, 2025
f15e2fa
Eliminate instructions which do not produce a new value
Dentosal Apr 23, 2025
5fa3f51
Merge branch 'master' into dento/asm-gen-opt
Dentosal Apr 23, 2025
0547e61
Fix build_config args after merge
Dentosal Apr 23, 2025
1542cd3
clippy
Dentosal Apr 24, 2025
96c2336
Merge branch 'master' into dento/asm-gen-opt
Dentosal Apr 24, 2025
c0ae3dd
Fix cli output test pc values
Dentosal Apr 24, 2025
1bdcc16
Update contract ids and other hardcoded information
Dentosal Apr 24, 2025
db0494a
More test fixing
Dentosal Apr 24, 2025
077a343
More replacing of hard-coded test constants
Dentosal Apr 24, 2025
04254ee
Be more conservative on what effects instructions have
Dentosal Apr 24, 2025
da17436
Remove debug prints
Dentosal Apr 24, 2025
33570c9
Fix typo
Dentosal Apr 24, 2025
93dced8
More fixed address updates
Dentosal Apr 24, 2025
7d00bb2
And more
Dentosal Apr 24, 2025
a0aee80
and more...
Dentosal Apr 24, 2025
8b1b795
Update snap tests
Dentosal Apr 24, 2025
45a5921
Update some json snapshots
Dentosal Apr 24, 2025
bb98a7d
update-contract-ids.sh
Dentosal Apr 24, 2025
cee07c8
Additional optimizations
Dentosal Apr 25, 2025
6f790d9
Merge branch 'master' into dento/asm-gen-opt-2
Dentosal May 5, 2025
593ef28
Fix issues after merge
Dentosal May 5, 2025
b85b864
Re-integrate expr evaluation work
Dentosal May 5, 2025
1047ef0
Merge branch 'master' into dento/asm-gen-opt-2
Dentosal May 12, 2025
aaa319a
Add initial MUL support
Dentosal May 12, 2025
a50331c
Merge branch 'master' into dento/asm-gen-opt-2
Dentosal May 19, 2025
34c1ea7
Fix post-merge issues
Dentosal May 19, 2025
eed8015
Add symbolic EQ operation optimization
Dentosal May 19, 2025
4268c80
clippy
Dentosal May 19, 2025
5765e1e
Update contract ids in tests
Dentosal May 19, 2025
a77ec4d
Short-circuit multiplication-by-zero
Dentosal May 19, 2025
108f520
More test contractid updates
Dentosal May 19, 2025
eafbe4a
Even more test number changes
Dentosal May 19, 2025
e6e88c5
More contract id updates
Dentosal May 19, 2025
24de184
bugfix: Multiplication short circuit now produces zero and not one
Dentosal May 19, 2025
6f6ddd7
0 != 1
Dentosal May 19, 2025
071bca4
Update snapshots
Dentosal May 19, 2025
f3af63c
Update log tests once more
Dentosal May 19, 2025
a762ce1
Use value eq instead of structural eq
Dentosal May 19, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions forc-plugins/forc-client/tests/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ async fn test_simple_deploy() {
node.kill().unwrap();
let expected = vec![DeployedPackage::Contract(DeployedContract {
id: ContractId::from_str(
"edd41822e8df9b4db6f8ff5ec094926c1ca46f5aa8bc499155085b5b85e84726",
"2258c97f9903554e7e562f29068f139b57d9cbcd14b7967ff1c9476bde4d71a9",
)
.unwrap(),
proxy: None,
Expand Down Expand Up @@ -421,7 +421,7 @@ async fn test_deploy_submit_only() {
node.kill().unwrap();
let expected = vec![DeployedPackage::Contract(DeployedContract {
id: ContractId::from_str(
"edd41822e8df9b4db6f8ff5ec094926c1ca46f5aa8bc499155085b5b85e84726",
"2258c97f9903554e7e562f29068f139b57d9cbcd14b7967ff1c9476bde4d71a9",
)
.unwrap(),
proxy: None,
Expand Down Expand Up @@ -468,12 +468,12 @@ async fn test_deploy_fresh_proxy() {
node.kill().unwrap();
let impl_contract = DeployedPackage::Contract(DeployedContract {
id: ContractId::from_str(
"edd41822e8df9b4db6f8ff5ec094926c1ca46f5aa8bc499155085b5b85e84726",
"2258c97f9903554e7e562f29068f139b57d9cbcd14b7967ff1c9476bde4d71a9",
)
.unwrap(),
proxy: Some(
ContractId::from_str(
"f1c07ddc6181e46e9ba1a7ade21946cf9f0730aaf9a04c9ecdf91e528ba77f86",
"00d50cae825707b7b4b5cbf791f4fd27ebe1605bf1a44bdb5420a20d5ae56a3f",
)
.unwrap(),
),
Expand Down
8 changes: 4 additions & 4 deletions forc/tests/cli_integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ fn test_forc_test_raw_logs() -> Result<(), rexpect::error::Error> {
// Assert that the output is correct
process.exp_string(" test test_log_4")?;
process.exp_string("Raw logs:")?;
process.exp_string(r#"[{"LogData":{"data":"0000000000000004","digest":"8005f02d43fa06e7d0585fb64c961d57e318b27a145c857bcd3a6bdb413ff7fc","id":"0000000000000000000000000000000000000000000000000000000000000000","is":10368,"len":8,"pc":12248,"ptr":67107840,"ra":0,"rb":1515152261580153489}}]"#)?;
process.exp_string(r#"[{"LogData":{"data":"0000000000000004","digest":"8005f02d43fa06e7d0585fb64c961d57e318b27a145c857bcd3a6bdb413ff7fc","id":"0000000000000000000000000000000000000000000000000000000000000000","is":10368,"len":8,"pc":12204,"ptr":67107840,"ra":0,"rb":1515152261580153489}}]"#)?;
process.exp_string(" test test_log_2")?;
process.exp_string("Raw logs:")?;
process.exp_string(r#"[{"LogData":{"data":"0000000000000002","digest":"cd04a4754498e06db5a13c5f371f1f04ff6d2470f24aa9bd886540e5dce77f70","id":"0000000000000000000000000000000000000000000000000000000000000000","is":10368,"len":8,"pc":12248,"ptr":67107840,"ra":0,"rb":1515152261580153489}}]"#)?;
process.exp_string(r#"[{"LogData":{"data":"0000000000000002","digest":"cd04a4754498e06db5a13c5f371f1f04ff6d2470f24aa9bd886540e5dce77f70","id":"0000000000000000000000000000000000000000000000000000000000000000","is":10368,"len":8,"pc":12204,"ptr":67107840,"ra":0,"rb":1515152261580153489}}]"#)?;

process.process.exit()?;
Ok(())
Expand All @@ -74,11 +74,11 @@ fn test_forc_test_both_logs() -> Result<(), rexpect::error::Error> {
process.exp_string(" test test_log_4")?;
process.exp_string("Decoded log value: 4, log rb: 1515152261580153489")?;
process.exp_string("Raw logs:")?;
process.exp_string(r#"[{"LogData":{"data":"0000000000000004","digest":"8005f02d43fa06e7d0585fb64c961d57e318b27a145c857bcd3a6bdb413ff7fc","id":"0000000000000000000000000000000000000000000000000000000000000000","is":10368,"len":8,"pc":12248,"ptr":67107840,"ra":0,"rb":1515152261580153489}}]"#)?;
process.exp_string(r#"[{"LogData":{"data":"0000000000000004","digest":"8005f02d43fa06e7d0585fb64c961d57e318b27a145c857bcd3a6bdb413ff7fc","id":"0000000000000000000000000000000000000000000000000000000000000000","is":10368,"len":8,"pc":12204,"ptr":67107840,"ra":0,"rb":1515152261580153489}}]"#)?;
process.exp_string(" test test_log_2")?;
process.exp_string("Decoded log value: 2, log rb: 1515152261580153489")?;
process.exp_string("Raw logs:")?;
process.exp_string(r#"[{"LogData":{"data":"0000000000000002","digest":"cd04a4754498e06db5a13c5f371f1f04ff6d2470f24aa9bd886540e5dce77f70","id":"0000000000000000000000000000000000000000000000000000000000000000","is":10368,"len":8,"pc":12248,"ptr":67107840,"ra":0,"rb":1515152261580153489}}]"#)?;
process.exp_string(r#"[{"LogData":{"data":"0000000000000002","digest":"cd04a4754498e06db5a13c5f371f1f04ff6d2470f24aa9bd886540e5dce77f70","id":"0000000000000000000000000000000000000000000000000000000000000000","is":10368,"len":8,"pc":12204,"ptr":67107840,"ra":0,"rb":1515152261580153489}}]"#)?;
process.process.exit()?;
Ok(())
}
Loading
Loading