Skip to content

Commit

Permalink
change AST
Browse files Browse the repository at this point in the history
  • Loading branch information
evan-schott committed Oct 4, 2023
1 parent 52bb785 commit 0348e61
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 30 deletions.
2 changes: 1 addition & 1 deletion compiler/passes/src/function_inlining/function_inliner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub struct FunctionInliner<'a> {
/// A wrapper around an Assigner used to create unique variable assignments.
pub(crate) assignment_renamer: AssignmentRenamer<'a>,
/// A map of reconstructed functions in the current program scope.
pub(crate) reconstructed_functions: IndexMap<Symbol, Function>,
pub(crate) reconstructed_functions: Vec<(Symbol, Function)>,
}

impl<'a> FunctionInliner<'a> {
Expand Down
2 changes: 1 addition & 1 deletion compiler/passes/src/function_inlining/inline_expression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ impl ExpressionReconstructor for FunctionInliner<'_> {

// Lookup the reconstructed callee function.
// Since this pass processes functions in post-order, the callee function is guaranteed to exist in `self.reconstructed_functions`
let callee = self.reconstructed_functions.get(&function_name).unwrap();
let (_, callee) = self.reconstructed_functions.iter().find(|(symbol, _)| *symbol == function_name).unwrap();

// Inline the callee function, if required, otherwise, return the call expression.
match callee.variant {
Expand Down
14 changes: 7 additions & 7 deletions tests/expectations/compiler/constants/constant_finalize.out
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ expectation: Pass
outputs:
- - initial_symbol_table: 77b127880b95652f948bc184d24fb51eb368cc2ccb022093cd27c2fbc03bb70e
type_checked_symbol_table: be1bdc9825b662e2070dabbd8e16d24d51ed989e91e385f9ebf27e11dc12b902
unrolled_symbol_table: 435f5b6da45d68cf00a82aca5b9bd6e326c5d7d2252811db0e96afd1de00a727
initial_ast: 7a198a2494fdf3d024929e3b226e2224e467113902322165f9ebbe7a9d6efe28
unrolled_ast: 43a9265edc4c3d7f085b1ff324ac84623a23e1902261b710be40bf79c3165559
ssa_ast: 2f44a9100711404013984bca5e5f9dcea0b41f10b6f4c7e6457e9d87fe6af9dd
flattened_ast: 36e01ba88e97e69090afa47f0f44bab28c2182b38b246800a22f12dee3599564
inlined_ast: 36e01ba88e97e69090afa47f0f44bab28c2182b38b246800a22f12dee3599564
dce_ast: 36e01ba88e97e69090afa47f0f44bab28c2182b38b246800a22f12dee3599564
unrolled_symbol_table: be1bdc9825b662e2070dabbd8e16d24d51ed989e91e385f9ebf27e11dc12b902
initial_ast: ce694c713a045e43b54b3317f23dec52681d32e9e364161620d163335bb6e50a
unrolled_ast: a1d639ea9ca0d7cd95c06e17bf4549e7f801dd77934ce1108c9e1eb008ce6bcb
ssa_ast: 5b8ef2b6fb6121db2dd7cae61cf23927ab59f05968afe8dc4c3eab64630678d0
flattened_ast: c0e05807cc7b529da87f10f768c620be71ac7d418cda8dbace6d2cf524efa95a
inlined_ast: c0e05807cc7b529da87f10f768c620be71ac7d418cda8dbace6d2cf524efa95a
dce_ast: c0e05807cc7b529da87f10f768c620be71ac7d418cda8dbace6d2cf524efa95a
bytecode: 88de5519495f51852482cfc5ab129cde77b8d2b53fd2eebfd66472c6fe0cdafe
warnings: ""
14 changes: 7 additions & 7 deletions tests/expectations/compiler/constants/constant_loop_bound.out
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ expectation: Pass
outputs:
- - initial_symbol_table: d1eed24f01e5256fec3b444fd3a38b7e25756c5fb20010872884a34d54ef888c
type_checked_symbol_table: 89c060252a9e229b91f2ac52e5e3823e04400f3e060ead04999aa4911f42c731
unrolled_symbol_table: c00e0818651bd9e2c068becdf3819b8d46238e0cfad46c87791efa9c97c6f9de
initial_ast: 064721479ca1f1002f795fe2286b19cd30130b486004c04cc0b65b6537332276
unrolled_ast: f6686b6690f957d6bab9fabde31a7e152bc77e529626fee1ba29b2035d7d35aa
ssa_ast: 1f9cb362c185a895e4a0021580db7962aa803a19a22b5f3936262321d200c783
flattened_ast: ceb2ad5deaa807b651ac3ac79ce9c14ca706856198ae6a42ce79792a1474a70d
inlined_ast: ceb2ad5deaa807b651ac3ac79ce9c14ca706856198ae6a42ce79792a1474a70d
dce_ast: ceb2ad5deaa807b651ac3ac79ce9c14ca706856198ae6a42ce79792a1474a70d
unrolled_symbol_table: 26537147843c8e9daeda6a7af59b2b4bca86c6f067b08a4f4c3a7b7ffe30e59a
initial_ast: e62fc22b5eb4828b75e3ecd29aacd035ec8bcd746ca941ea9cb5242a432023c4
unrolled_ast: d9a488819582c5139ec60a94c5502eeb48b4373a0c96340582480b2b9fc460c1
ssa_ast: 49a274b5aee96f0cf40db3913dc5d3ad4ce5a574186e2191cfdca2d3e8d8ddad
flattened_ast: 7005d6c4c92f7b421e345714d85c1f0543b173cf8cc2601cfd0fede5f6fd0986
inlined_ast: 7005d6c4c92f7b421e345714d85c1f0543b173cf8cc2601cfd0fede5f6fd0986
dce_ast: 7005d6c4c92f7b421e345714d85c1f0543b173cf8cc2601cfd0fede5f6fd0986
bytecode: a6350aaded46f7047061f7e68a8ae41eb8aa0d29f02560257ecdc582a6c684f9
warnings: ""
14 changes: 7 additions & 7 deletions tests/expectations/compiler/constants/loop_unrolling.out
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ expectation: Pass
outputs:
- - initial_symbol_table: c6a4e40ae8f466c3ff6bf5d356d6ba89684438f88015e8ea23ff43eadb662b49
type_checked_symbol_table: 0b88104308fe0b9e390a59a4359d6245170347557911b21ba04cd1d9124da14d
unrolled_symbol_table: af56532f8dd6c6ca6f5fc8af3667202298898a54fe2f871a7874684a712f141d
initial_ast: 073156180f17eb97f74a550fad09db2a97f0c6f2fb731384186d9f2df561cecf
unrolled_ast: c320a18349a9dc1f73a1d694733aabe364176e7a6744d7db3674d1fdaf30f10b
ssa_ast: 42315652d19b89a59857507e03ec426f17c633ef6dfd6523d284dd6f279181ac
flattened_ast: 8c8a488425a63ab7e66e2a68e82a8e5a8e4bf50a49652e2aad318e6ecc7adcc2
inlined_ast: 8c8a488425a63ab7e66e2a68e82a8e5a8e4bf50a49652e2aad318e6ecc7adcc2
dce_ast: 8c8a488425a63ab7e66e2a68e82a8e5a8e4bf50a49652e2aad318e6ecc7adcc2
unrolled_symbol_table: 0f5bcb03574cbdb2a6a0f335693d8bc0bca4926ce259fa0e0acc09baba07bcdd
initial_ast: eef62bc4abea94dcfe2d2be2e1ef1be67d6049635b9c80ed9a42e1232398cf00
unrolled_ast: 098e93a2c32b1512e8fb161e34c18136db7144a913924510958405721f983aeb
ssa_ast: 6ef68c21f242d18c99c784498d9bbc267153fad905c9319d48d2b256fe0a5ee9
flattened_ast: dfa51e3acb674a27f99cb4d41d94a00676348b382addd7a158b487d2067cf870
inlined_ast: dfa51e3acb674a27f99cb4d41d94a00676348b382addd7a158b487d2067cf870
dce_ast: 92cd4180c29221483b1f5a85807130748bf450f77ba8ba3cfef9b3b24c31282f
bytecode: d9595550f8a3d55b350b4f46059fb01bf63308aa4b4416594c2eb20231f6483a
warnings: ""
15 changes: 15 additions & 0 deletions tests/expectations/compiler/constants/tuple_definition.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
namespace: Compile
expectation: Pass
outputs:
- - initial_symbol_table: d698a6988e2f4caf3321c2a5b0c0228721f13930b072f738e97747b7d3ade0de
type_checked_symbol_table: 88168597bb3de8d73a3ada9b63c026594d716c75f2deb4b7d20abd2758d6b4d3
unrolled_symbol_table: 88168597bb3de8d73a3ada9b63c026594d716c75f2deb4b7d20abd2758d6b4d3
initial_ast: 7d6f5a65fc409b01b94eaf7ec537d16e8f946ee50e26ec6655ed15fb5a6b3d0b
unrolled_ast: db2c439efef6103d9d7ed707a44ca1a0c9cb1c08a21304ef32355b1ab27de6f4
ssa_ast: db2c439efef6103d9d7ed707a44ca1a0c9cb1c08a21304ef32355b1ab27de6f4
flattened_ast: 44a9ec566f0b84c8cdf133cc2ee9ae4f9dd55d86cf35e7697bf8d8082d5857f6
inlined_ast: 44a9ec566f0b84c8cdf133cc2ee9ae4f9dd55d86cf35e7697bf8d8082d5857f6
dce_ast: 44a9ec566f0b84c8cdf133cc2ee9ae4f9dd55d86cf35e7697bf8d8082d5857f6
bytecode: 91d9f12af3f91ba9332bdf7303424e4369e14db4b713c13f43afc72a55cfcd4a
warnings: ""
14 changes: 7 additions & 7 deletions tests/expectations/execution/counter.out
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ expectation: Pass
outputs:
- - initial_symbol_table: 4194c6207c716b52d30529becd081afc9b7313e8e1ce400cc65c33fac50fab31
type_checked_symbol_table: 51dec1877b8da96c81929eabd624019ae50c181362703756b68d94d002cb2f56
unrolled_symbol_table: 0b6340ef766a4154f31b5fa00d9bebe8478a8e3c81f091b8433e870ad7213b25
initial_ast: 40475813e3504e84b34352130d1a54e9480d73afa3995801d03c24d315d710cc
unrolled_ast: 6757faa19ffcaa549c376165dd4154c278bb8f28527d1491ec9bca8467c6c557
ssa_ast: dba16f838232238e78f9d6fcfe6477195a270950f25670227d7ba63ac7c7354e
flattened_ast: e7e1acecec4717cebee63e90d9e7de8217031ed3e715be7c6b0f0155438814ff
inlined_ast: e7e1acecec4717cebee63e90d9e7de8217031ed3e715be7c6b0f0155438814ff
dce_ast: e7e1acecec4717cebee63e90d9e7de8217031ed3e715be7c6b0f0155438814ff
unrolled_symbol_table: f62721c061790b66cf66c0dbac8f85ca582bb420e6b315e081e7894bb81e8cdf
initial_ast: fea2ee7658bbedd9ec63e374e3156684ce765145bb1d648ff394f5ef7be1cb83
unrolled_ast: 3163751aa919b500d72df1ba3698cf4e6718ce7c725cb69cd39af9e2e4017eaa
ssa_ast: b8fd721ad8640ed982e5ca8ddbad91b251c3b27786382db9b7fc21e48b2cf273
flattened_ast: fcb6269c7559318b13e56b087272f6e8edcd99e4566ac10922758f23c4f544e8
inlined_ast: fcb6269c7559318b13e56b087272f6e8edcd99e4566ac10922758f23c4f544e8
dce_ast: fcb6269c7559318b13e56b087272f6e8edcd99e4566ac10922758f23c4f544e8
bytecode: 6f468335c2ba73721aece1b1018fff421437eee9d52956368d33822d46e8c012
warnings: ""
results:
Expand Down

0 comments on commit 0348e61

Please sign in to comment.