Skip to content

add unique extension#116

Closed
riaqn wants to merge 5 commits intoocaml-flambda:mainfrom
riaqn:unique-linear-asap
Closed

add unique extension#116
riaqn wants to merge 5 commits intoocaml-flambda:mainfrom
riaqn:unique-linear-asap

Conversation

@riaqn
Copy link
Copy Markdown
Contributor

@riaqn riaqn commented Feb 3, 2023

This PR is based on the previous PR (#33), and tries to add support for the uniqueness extension.

  • Add two new axes to the mode system. The uniqueness axis contains unique < shared. The linearity axis contains many < once. To accomodate the new axes, some refactoring and renaming are done. More of that is due but I think it's better to merge this ASAP instead of rebasing weekily.
  • To check that variable uses declared to be unique are actually so, we add uniqueness_analysis.ml that checks the usage of each values (In particular, Texp_ident and Texp_field).

The extension still has many issues, our minimal goal in this PR is that existing code will translate to the same machine code when the unique extension is disabled. Existing code might be rejected by type checker due to some bugs we introduced, but that's less scary. To achieve this minimal goal, the following is needed:

  • We first make sure that this PR doesn't change the locality axis in the alloc_mode in the typedtree generated by typecore.ml.
  • In translcore.ml, add assertions that the two new lambda primitives (that overwrite fields in blocks), Preuseblock and Preusefloatblock are generated only when unique extension enabled.
  • Note that in lambda.ml, we add uniqueness to alloc_mode. uniqueness could be either alloc_unique or alloc_shared. The former is redirected to the latter when the extension is disabled. Further inspection is needed to ensure that translcore.ml retains old behaviour when uniqueness is alloc_shared.

@riaqn riaqn changed the title add unique extension add unique extension Feb 3, 2023
@riaqn riaqn force-pushed the unique-linear-asap branch 2 times, most recently from 883fc67 to 1f39746 Compare February 13, 2023 10:56
@riaqn riaqn requested review from lpw25 and stedolan February 13, 2023 11:25
@riaqn riaqn force-pushed the unique-linear-asap branch 3 times, most recently from 236c84d to d9c0078 Compare February 16, 2023 10:54
@riaqn riaqn force-pushed the unique-linear-asap branch 2 times, most recently from 046c8b8 to 8aeaa3c Compare March 3, 2023 11:52
@riaqn riaqn force-pushed the unique-linear-asap branch from a8ac51d to 8c7359e Compare March 6, 2023 16:04
@riaqn riaqn mentioned this pull request Mar 8, 2023
@riaqn
Copy link
Copy Markdown
Contributor Author

riaqn commented Mar 8, 2023

This is closed in favour of #138

@riaqn riaqn closed this Mar 8, 2023
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