-
Notifications
You must be signed in to change notification settings - Fork 78
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
Unboxed tuples #2879
Unboxed tuples #2879
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nearly done with jkind.ml.
ocaml/testsuite/tests/typing-layouts-products/unboxed_tuples.ml
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was hoping to get further here before my vacation -- and I may return during some downtime if no one beats me to it -- but I wanted to post where I had gotten in case someone else wants to pick up.
I have reviewed:
- All the testsuite changes
- All files alphabetically from typing/jkind.ml to typing/patterns.ml
- typedtree.ml{i}
- types.ml{i}
- utils/misc.ml{i}
Its possible that there are places in the compilation of
The important part, I think, is to ensure that |
Thanks for this summary, @lthls. In the interest of keeping things simple, I am tempted to make a PR that just bans any pattern variable in a value let-rec from having a non-value layout. I think that considering the existence of What do you think? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A little bit more: ctype, btype, and all the files in typing up to and including printtyped.
Banning non-value layouts in recursive declarations seems reasonable. |
I rebased (my own branch of this) onto |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've reviewed the following files:
ocaml/parsing/ast_helper.ml | 5 ++++
ocaml/parsing/ast_helper.mli | 7 ++++++
ocaml/parsing/ast_iterator.ml | 24 ++++++++------------
ocaml/parsing/ast_mapper.ml | 27 +++++++++++-----------
ocaml/parsing/depend.ml | 18 +++++++++------
ocaml/parsing/jane_syntax.ml | 6 +++++
ocaml/parsing/jane_syntax.mli | 1 +
ocaml/parsing/lexer.mll | 1 +
ocaml/parsing/parser.mly | 41 ++++++++++++++++++++++++++++++++-
ocaml/parsing/parsetree.mli | 23 +++++++++++++++++++
ocaml/parsing/pprintast.ml | 1 +
ocaml/parsing/printast.ml | 13 +++++++++++
ocaml/toplevel/genprintval.ml | 4 ++++
ocaml/typing/subst.ml | 9 ++++++--
ocaml/typing/tast_iterator.ml | 3 +++
ocaml/typing/tast_mapper.ml | 9 ++++++++
ocaml/typing/typecore.ml | 163 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
ocaml/typing/typedecl.ml | 86 ++++++++++++++++++++++++++++++++++++++++++++++-----------------------
ocaml/typing/typedecl.mli | 1 +
ocaml/typing/typedecl_separability.ml | 3 +++
ocaml/typing/typedecl_variance.ml | 2 ++
ocaml/typing/typemod.ml | 10 ++++----
ocaml/typing/typeopt.ml | 100 ++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------
ocaml/typing/typeopt.mli | 4 ++--
ocaml/typing/typetexp.ml | 17 +++++++++++++-
ocaml/typing/uniqueness_analysis.ml | 14 ++++++++++++
ocaml/typing/untypeast.ml | 10 ++++++++
ocaml/typing/value_rec_check.ml | 6 +++++
printer/printast_with_mappings.ml | 13 +++++++++++
I'm unconfident about typedecl.ml
and typeopt.ml
, which we will discuss via other channels.
8f8f034
to
ad85854
Compare
Would it be helpful for me to review typedecl and typeopt? |
I believe @riaqn has reviewed everything remaining, but you are of course welcome to take a look! I plan to clean this up this week. |
bf4f79b
to
6d6c68f
Compare
e9f7e60
to
b800dcc
Compare
This PR is ready for final review and merging. I have squashed all the changes in response to review down into one commit, mainly to make rebasing easier, and this has been rebased on current main. Tests suggested in review turned up a few issues, all of which have been fixed except one - see Test 11 in One open question is @riaqn Please take the following steps:
|
I reviewed the chagnes to all |
I have resolved all the outstanding conversations here so we can merge, but @goldfirere you will probably find it useful to go through and read the responses at some point. |
This adds our first composite layout, products, and a type that uses it, unboxed tuples. There are two commits, the first is some middle-end fixes that will be reviewed in #2837 and can be ignored.
Known remaining issues
let rec
that crashes closure conversion in the native code compiler. We should do something about this before merging this PR, but I'm still discussing with the middle end team. It's an odd example, because the value rec check today will never reject a let rec that's not actually recursive, and it seems we need to start doing that.(* XXX modes *)
in some places where someone more expert on our mode inference should check what I've done.Some notes about the design and implementation
constrain_type_jkind
into multiple functions - one which checks layouts and traverses types deeply to handle products, and another which handles the rest of the kind and can be shallower. I have not done that. It was not necessary, and while this means the new implementation ofconstrain_type_jkind
does some unnecessary checking of the other kind bits when dealing with unboxed products, it allows for (in my view) a pretty clean and understandable implementation of kind checking. It's possible we should split this up in the future, but I think that will require adjusting how we think about kind errors and histories, as right now they live at the level of the whole kind but the checks wouldn't be operating on whole kinds. Either way, we should probably leave that exploration for a future PR, as this one already makes enough changes to kind checking.Review: @goldfirere