Annotate Texp_function with an Ident.t for the parameter#831
Annotate Texp_function with an Ident.t for the parameter#831mshinwell merged 3 commits intoocaml:trunkfrom
Conversation
|
Did you consider moving the |
|
@gasche Only briefly. It wasn't clear to me that it was really necessary in this case. |
|
I understand how this fixes the problem, but it seems a bit weird conceptually to invent an Ident.t at the Typedtree level, even if it not used at that level at all, and only to serve as a lookup key later on. Shouldn't we aim for a more general approach which could apply to other cases as well? The need seems to be able to refer back to nodes in the Typedtree in later representations (cmm, lambda, etc). There might be other uses of such pointers, e.g. to retrieve some partial type information later in the compilation pipeline. So what about adding a uid (int, or a pair compilation_unit*int) to nodes in the Typedtree (an extra field added to Typedtree.expression, perhaps also Typedtree.pattern and co)? |
|
I don't think it's right to say that it's only used as a lookup key---it's also used for the actual identifier required for the parameter in Lambda (just as it was before). My feeling is that this alone doesn't call for a more general approach. This seems like a minor modification. However I think it is likely the case that in the future, at least in the context of generating debugging information, we may need to have some better method of either passing type information through to the backend or else retrieving it from earlier as you suggest. (This isn't needed now because we don't describe OCaml types in DWARF information; we instead retrieve them from the .cmt file.) I think it would be a mistake to try to design that scheme now for a couple of reasons: firstly, the need for it may be quite far out and how it would work hasn't yet been thought about; secondly, there is already a very large body of code involved with the first tranche of the debugging patches and I think we would do well to avoid adding any more. |
It's a lookup key at the Typedtree level in the sense that only its identity matters; you can create an arbitrary identifier -- it is not used anywhere else in the Typedtree representation. That said, I agree that the change is rather small and I'm not opposed to it if you don't think something more general should be considered now. I'd tend to second @gasche suggestion about switching to a record at the same time. It's not only about minimizing future changes, but also avoiding breaking external tools that works on .cmt files too often. |
|
I have changed |
|
I'm fine with the code as it is now (the use of |
|
I'm not sure human-eyes could reliably review such changes, so I'll trust Mark and let him merge. |
|
I have fixed the underscores. |
Revert changes to caml_floatarray_blit
Revert changes to caml_floatarray_blit
25188da flambda-backend: Missed comment from PR802 (ocaml#887) 9469765 flambda-backend: Improve the semantics of asynchronous exceptions (new simpler version) (ocaml#802) d9e4dd0 flambda-backend: Fix `make runtest` on NixOS (ocaml#874) 4bbde7a flambda-backend: Simpler symbols (ocaml#753) ef37262 flambda-backend: Add opaqueness to Obj.magic under Flambda 2 (ocaml#862) a9616e9 flambda-backend: Add build system hooks for ocaml-jst (ocaml#869) 045ef67 flambda-backend: Allow the compiler to build with stock Dune (ocaml#868) 3cac5be flambda-backend: Simplify Makefile logic for natdynlinkops (ocaml#866) c5b12bf flambda-backend: Remove unnecessary install lines (ocaml#860) ff12bbe flambda-backend: Fix unused variable warning in st_stubs.c (ocaml#861) c84976c flambda-backend: Static check for noalloc: attributes (ocaml#825) ca56052 flambda-backend: Build system refactoring for ocaml-jst (ocaml#857) 39eb7f9 flambda-backend: Remove integer comparison involving nonconstant polymorphic variants (ocaml#854) c102688 flambda-backend: Fix soundness bug by using currying information from typing (ocaml#850) 6a96b61 flambda-backend: Add a primitive to enable/disable the tick thread (ocaml#852) f64370b flambda-backend: Make Obj.dup use a new primitive, %obj_dup (ocaml#843) 9b78eb2 flambda-backend: Add test for ocaml#820 (include functor soundness bug) (ocaml#841) 8f24346 flambda-backend: Add `-dtimings-precision` flag (ocaml#833) 65c2f22 flambda-backend: Add test for ocaml#829 (ocaml#831) 7b27a49 flambda-backend: Follow-up PR#829 (comballoc fixes for locals) (ocaml#830) ad7ec10 flambda-backend: Use a custom condition variable implementation (ocaml#787) 3ee650c flambda-backend: Fix soundness bug in include functor (ocaml#820) 2f57378 flambda-backend: Static check noalloc (ocaml#778) aaad625 flambda-backend: Emit begin/end region only when stack allocation is enabled (ocaml#812) 17c7173 flambda-backend: Fix .cmt for included signatures (ocaml#803) e119669 flambda-backend: Increase delays in tests/lib-threads/beat.ml (ocaml#800) ccc356d flambda-backend: Prevent dynamic loading of the same .cmxs twice in private mode, etc. (ocaml#784) 14eb572 flambda-backend: Make local extension point equivalent to local_ expression (ocaml#790) 487d11b flambda-backend: Fix tast_iterator and tast_mapper for include functor. (ocaml#795) a50a818 flambda-backend: Reduce closure allocation in List (ocaml#792) 96c9c60 flambda-backend: Merge ocaml-jst a775b88 flambda-backend: Fix ocaml/otherlibs/unix 32-bit build (ocaml#767) f7c2679 flambda-backend: Create object files internally to avoid invoking GAS (ocaml#757) c7a46bb flambda-backend: Bugfix for Cmmgen.expr_size with locals (ocaml#756) b337cb6 flambda-backend: Fix build_upstream for PR749 (ocaml#750) 8e7e81c flambda-backend: Differentiate is_int primitive between generic and variant-only versions (ocaml#749) git-subtree-dir: ocaml git-subtree-split: 25188da
* minor changes to the playground example * add a better single-threaded Fibonacci implementation in the comment * make it more clear that the Playground is powered by OCaml 5 Co-authored-by: Sabine Schmaltz <[email protected]>
This patch ensures that (with the forthcoming gdb support) anonymous function parameters are printed correctly in the debugger. A notable case that is covered by this patch is that of a unit argument.
At present, the
Ident.tvalues used for function parameters are assigned duringTranslcore, which means there is no way of subsequently tying them back to the type of the corresponding pattern in the.cmtfile. This means that the debugger cannot print the value correctly as its type is unknown.This apparently difficult problem can be neatly sidestepped by moving the generation of the identifiers forward into the type checker. After this patch the stamps of function parameters can be correlated with the
.cmtfile by finding theTexp_functionnode with the corresponding stamped identifier and then looking at the types of the patterns therein.This patch requires a bootstrap.