Name lambdas by their locations #977

Merged
zxq9 merged 2 commits from gh-485 into master 2023-09-05 01:50:38 +09:00
zxq9 commented 2023-09-03 00:33:14 +09:00 (Migrated from gitlab.com)

Created by: radrow

fixes #485

Previously names for lambdas were generated with use of a global counter. Since fcode functions are stored in maps, the order of processing local lambdas was unspecified. This resulted in lambdas getting names assigned non-deterministically during lifting.

This PR fixes that by naming lambdas according to their locations. Counters are still used to handle cases where locations are not available. However, those counters are now function-local. Inner AST has deterministic structure, thus lambdas will be numbered in DFS order.

PR is sponsored by ACF.

*Created by: radrow* fixes #485 Previously names for lambdas were generated with use of a global counter. Since fcode functions are stored in maps, the order of processing local lambdas was unspecified. This resulted in lambdas getting names assigned non-deterministically during lifting. This PR fixes that by naming lambdas according to their locations. Counters are still used to handle cases where locations are not available. However, those counters are now function-local. Inner AST has deterministic structure, thus lambdas will be numbered in DFS order. PR is sponsored by ACF.
ghallak (Migrated from gitlab.com) approved these changes 2023-09-03 00:33:14 +09:00
zxq9 commented 2023-09-03 00:48:44 +09:00 (Migrated from gitlab.com)

Created by: radrow

Just checked in HTTP that it does not reproduce on the provided example

*Created by: radrow* Just checked in HTTP that it does not reproduce on the provided example
zxq9 commented 2023-09-04 15:24:48 +09:00 (Migrated from gitlab.com)

Created by: hanssv

Review: Approved

Great job finding and fixing this one 👍

*Created by: hanssv* **Review:** Approved Great job finding and fixing this one 👍
ghallak commented 2023-09-05 01:47:07 +09:00 (Migrated from gitlab.com)

approved this merge request

approved this merge request
zxq9 commented 2023-09-05 01:50:38 +09:00 (Migrated from gitlab.com)

Merged by: radrow at 2023-09-04 16:50:38 UTC

*Merged by: radrow at 2023-09-04 16:50:38 UTC*
Sign in to join this conversation.
No description provided.