Skip to content

Native toploop consolidation#746

Closed
gerdstolpmann wants to merge 3 commits intoocaml:trunkfrom
gerdstolpmann:native-toploop
Closed

Native toploop consolidation#746
gerdstolpmann wants to merge 3 commits intoocaml:trunkfrom
gerdstolpmann:native-toploop

Conversation

@gerdstolpmann
Copy link
Copy Markdown

This PR gets rid of the separate toplevel/opt* modules and unifies all toploop functionality into the modules that are also used in the bytecode case. That way, the latest improvements for the bytecode toplevel are also available for the native version. Also, this makes it simpler to use the native toplevel (e.g. important for findlib). In particular:

  • Toploop is built from a single source toploop.mlp, which is preprocessed resulting into toploop.mlbyte and toploop.mlopt. The code sections that are only for one of the versions are marked with BEGIN_BYTE/END_BYTE and BEGIN_NATIVE/END_NATIVE, respectively.
  • Topdirs.load_file also went into Toploop
  • The tracing directives from Topdirs went into Trace
  • The cmx files of the toplevel are installed

There are two open issues:

  • No support for #use load_rec
  • No solution for the Windows problem that loaded DLLs cannot be unlinked

It is also not clear to me what happens when we get conflicting symbols, e.g. when modified versions of the same module are loaded. (If this does not work reliably, we should catch it and reject it.)

This branch is not yet super-well tested. I'm sending this PR in particular because I'm hoping for testers. Use make ocamlnat after make world.opt to build the native toplevel.

There is a findlib branch supporting the native toploop: https://gitlab.camlcity.org/gerd/lib-findlib/tree/ocamlnat

I did not include the .depends files in the PR, so you'll have run make depend before building.

as for the bytecode case. All differences byte/native are now done in
module Toploop (except tracing, which is still extra). There is only
one source for Toploop (toploop.mlp).
@lefessan
Copy link
Copy Markdown
Contributor

lefessan commented Aug 8, 2016

I am a bit concerned with the use of BEGIN_BYTE/END_BYTE and idem for native code. Wouldn't it be possible to create a shared functor (maybe in topdirs.ml), and instantiate it differently in toploop.mlbyte and toploop.mlopt ?

Also, since Compdynlink already has some different implementations in bytecode and native, and since ocamlnat is only available if compdynlink.mlopt is used, maybe it is possible to move some of the byte/native specific code to Compdynlink ?

@gerdstolpmann
Copy link
Copy Markdown
Author

I guess the functor approach would be possible, in order to isolate the code that is specific for byte/native. Not sure whether topdirs.ml is the right place for the functor (because Topdirs is a user of Toploop), this would probably be a new file (e.g. toploop_common.ml).

The core part are the different implementations of load_lambda and transl_toplevel_phrase. I don't see here immediately what could go to Compdynlink.

@gerdstolpmann
Copy link
Copy Markdown
Author

Will provide this externally. Sorry for disturbing you.

@alainfrisch
Copy link
Copy Markdown
Contributor

This sounded like a useful contribution. Any opposition to having it included if someone else wants to put some more effort to it?

@gerdstolpmann
Copy link
Copy Markdown
Author

Please take it if you want.

EduardoRFS pushed a commit to esy-ocaml/ocaml that referenced this pull request Dec 17, 2021
stedolan added a commit to stedolan/ocaml that referenced this pull request Sep 21, 2022
The modes for the function being applied were wrong in the case of a
Regional function, which can allow a heap closure to close over a
stack closure.
stedolan pushed a commit to stedolan/ocaml that referenced this pull request Sep 21, 2022
ce76e02 flambda-backend: Bugfix for type_application (ocaml#746)
44f3afb flambda-backend: PR580 for main branch (ocaml#743)
b851eaa flambda-backend: Backport first part of ocaml/ocaml PR10498 (ocaml#737)
fafb4bd flambda-backend: Fix return mode for eta-expanded function in type_argument (ocaml#735)
c31f6c3 flambda-backend: Fix treatment of functions called [@nontail] (ocaml#725)
847781e flambda-backend: Fix build_upstream post-PR703 (ocaml#712)
bfcbbf8 flambda-backend: Extend Pblock value kind to handle variants (ocaml#703)
b2cab95 flambda-backend: Merge ocaml-jst
a6d6e0e flambda-backend: Merge ocaml-jst
88a4f63 flambda-backend: Use Pmakearray for immutable arrays (ocaml#699)
eeaa44b flambda-backend: Install an ocamldoc binary (ocaml#695)
48d322b flambda-backend: Ensure that GC is not invoked from bounds check failures (ocaml#681)
4370fa1 flambda-backend: Review changes of term directory (ocaml#602)
65a4566 flambda-backend: Add code coverage using bisect_ppx (ocaml#352)
63ab65f flambda-backend: Bugfix for primitive inclusion (ocaml#662)
7e3e0c8 flambda-backend: Fix inclusion checks for primitives (ocaml#661)
96c68f9 flambda-backend: Speed up linking by changing cmxa format (ocaml#607)
1829150 flambda-backend: Bugfix for Translmod.all_idents (ocaml#659)

git-subtree-dir: ocaml
git-subtree-split: ce76e02
sadiqj pushed a commit to sadiqj/ocaml that referenced this pull request Feb 21, 2023
The modes for the function being applied were wrong in the case of a
Regional function, which can allow a heap closure to close over a
stack closure.
EmileTrotignon pushed a commit to EmileTrotignon/ocaml that referenced this pull request Jan 12, 2024
Added (10):

* Conex - establishing trust into data repositories
* Generic Programming in OCaml
* Improving the OCaml Web Stack: Motivations and Progress
* Learn OCaml: An Online Learning Center for OCaml
* Lock-free programming for the masses
* OCaml inside: a drop-in replacement for libtls
* Semantics of the Lambda intermediate language
* Sundials/ML: interfacing with numerical solvers
* The State of the OCaml Platform: September 2016
* Who's got your Mail? Mr. Mime

Still Missing (2):

* OPAM-builder: Continuous Monitoring of OPAM Repositories
* Statistically profiling memory in OCaml

Extra (1):

* What's new in OCamls 4.03: https://watch.ocaml.org/videos/watch/b967996a-3dab-415f-8e51-d8908361b2b2

Co-authored-by: Cuihtlauac ALVARADO <cuihtmlauac@tarides.com>
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.

3 participants