Commit Graph

931 Commits (master)

Author SHA1 Message Date
David Allsopp 001c2d1283 Restore Cygwin64 support 2020-09-21 13:36:03 +01:00
David Allsopp 14300d3b1a Fix -fdebug-prefix-map when using flexlink
Prepend the -fdebug-prefix-map= option with -link if the "linker" is in
fact flexlink.
2020-09-21 10:11:39 +01:00
Nicolás Ojeda Bär 9f9cc29fd8 Rename Multiple_definition => Module_linked_twice 2020-07-20 08:31:18 +02:00
Nicolás Ojeda Bär 3fb5dbb250 Adapt ocamlc primitive check 2020-07-02 06:40:10 +02:00
Xavier Leroy 791fe017df
Merge pull request #9655 from xavierleroy/obj-bits
Introduce type Obj.raw_data and functions Obj.raw_field, Obj.set_raw_field to manipulate out-of-heap pointers in no-naked-pointers mode, and more generally  all other data that is not a well-formed OCaml value
2020-06-14 11:44:04 +02:00
Xavier Leroy c2db3288c1 Use type Obj.raw_data to represent code pointers in the REPL trace facility
Using Obj.t is incorrect in no-naked-pointer mode, as it exposes
code pointers as OCaml values.
2020-06-10 16:30:43 +02:00
Gabriel Scherer d260a79416 [refactoring] gives tailcall attributes a more standard structure
We want to start allowing more information in the payload of
[@tailcall] attributes (currently no payload is supported), for
example we could consider using [@tailcall false] to ask the code
generator to disable a tail call.

A first required step in this direction is to use a custom datatype to
represent the tail-call attribute, instead of a boolean. This is
consistent with the other application-site
attributes (inline_attribute, specialise_attribute, local_attribute),
so it makes the code more regular -- but the change itself is
boilerplate-y.
2020-06-08 15:39:50 +02:00
Xavier Leroy 9e128577a4 New representation of closures, bytecode part
Add a "closure information" field after each code pointer in
a closure.  This field generalizes the "arity" field used by
the native-code compiler, in that it has room both for an arity
(always 0 in bytecode) and for the distance from the closure
to the first environment variable in the closure block.

This makes closures "self-described" and easy to scan for pointers:
everything up to the first env var is out-of-heap code pointers or
integers; everything after the first env var is a well-formed value.

At this point a bootstrap is needed.
2020-06-05 17:42:08 +02:00
Stephen Dolan 0d44a6cfe6 Remove Const_pointer from Lambda and Clambda (#9585)
Lambda and Clambda distinguish Const_int from Const_pointer only so
that they can pass the information to Cmm. But now that that
Const_pointer is gone from Cmm (#9578), there's no need for the
distinction in Lambda either.

This PR requires a bootstrap, because the .cmo format changes:
Lambda.structured_constant has one fewer constructor.  The bootstrap
is in the following commit.
2020-06-02 11:19:20 +02:00
Nicolás Ojeda Bär a151e9187b
When bytecode linking fails due to a missing module, show which module requires it (#9583) 2020-05-21 05:37:09 +02:00
Stephen Dolan 0040c5d783 Print function names (derived from Lambda.scoped_location) in backtraces
Function names now appear in backtraces and are available via Printexc.
2020-04-27 12:58:53 +01:00
Stephen Dolan 2986beaa78 Replace Location.t with Lambda.scoped_location in Lambda code
This commit threads scopes through translation from Typedtree to
Lambda, extending the scopes when entering functions, modules,
classes and methods.
2020-04-27 12:58:53 +01:00
Nicolás Ojeda Bär 1e98c52e93
Link std_exit.cmo into binaries compiled with -output-complete-exe (#9495) 2020-04-25 13:01:03 +02:00
Anukriti12 7266b79d60 code review changes 2020-04-02 16:38:54 +05:30
Anukriti12 7feaeb52a1
Merge branch 'trunk' into trunk 2020-03-31 15:50:39 +05:30
Greta Yorsh 824ce35492
Replace caml_int_compare and caml_float_compare with primitives (#2324) 2020-03-26 10:58:10 +01:00
Anukriti12 8f235efdf5 call_linker now returns exit_code for better error response on linking_error, fixes #7141 2020-03-23 06:12:05 +05:30
Jérémie Dimino c7de942730
Fix #9344 (#9368)
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2020-03-17 11:38:45 +00:00
Jacques-Henri Jourdan c4d7bcd352 Memprof: get precise callstacks when memory is allocated directly in the bytecode interpreter.
This includes two changes: first, in bytegen.ml, we add a pseudo-event after every allocation or closure instruction. Second, in the interpreter, we save the current PC in the interpreter stack in [Setup_for_gc].
2020-01-15 11:59:51 +01:00
Jacques-Henri Jourdan 52661f14a4 Make ocamlc preserve events after primitives even if they are at tail position. 2020-01-09 00:16:42 +01:00
Stephen Dolan 2d21433573 Do not drop bytecode debug info after C calls 2020-01-07 10:32:41 +00:00
Drup 9c8b63f4ce Annotated Asttypes.constant's string with content location. 2019-11-13 16:08:40 +01:00
Gabriel Scherer c76edb9677 [refactoring] use named fields for Consistbl.Inconsistency exception 2019-11-07 15:07:46 +01:00
Nicolás Ojeda Bär 3aff5141fd Add a new -output-complete-exe option (#8872)
This option allows to build self-contained bytecode executable and is aimed to replace `-custom`. The main difference between the two is that executables produced by `-output-compete-exe` can be stripped.
2019-09-25 08:07:31 +01:00
Leo White 11edca8798 Fix #8769 (#8770)
* Don't generate illegal Pfield's when compiling alias coercions

* Simplify lambda code when compiling packs

* Add regression test for pr8769

* Add Changes entry
2019-06-28 16:17:00 +01:00
Gabriel Scherer 010d94cae2
Merge pull request #2309 from TheLortex/runtime-variant-path
Add -noruntime option
2019-06-19 16:12:28 +02:00
Lucas Pluvinage 198d650245 without-runtime: cosmetic tweaks 2019-06-11 10:06:56 +02:00
Damien Doligez 53d0cf6d3d Add error handling when finding and copying the camlheader file. 2019-06-10 11:17:54 +01:00
Stephen Dolan 3607562fd2 Code review fixes 2019-06-04 11:42:49 +01:00
Stephen Dolan d946686ffc Code generation and runtime fix for #8699, #8681 2019-06-04 10:33:17 +01:00
Lucas Pluvinage e61263c0ac Introduce the -without-runtime option. 2019-05-06 14:35:57 +02:00
David Allsopp 8838dc7527 Don't generate #! headers over 127 characters
A #! line should not exceed 128 characters (including the \0
terminator). This adds a test - both to the generation of the camlheader
files and also to the -use-runtime flag which falls back to #!/bin/sh
and uses exec to invoke the the interpreter.
2019-05-02 20:29:49 +02:00
Mark Shinwell 72ea849d2a
Move some middle-end files around (#2281)
* Various file moves in the middle end: this is the first stage of improving separation between the middle end and backend.
* Creation of file_formats/ directory (with associated file moves) to hold the definitions of compilation artifact formats.
* Creation of lambda/ directory (with associated file moves) to hold Lambda language definition files, transformation passes and construction passes from Typedtree.
* Disable (hopefully temporarily) dynlink, debugger and ocamldoc for the dune build.
2019-04-01 17:18:47 +01:00
Stephen Dolan 18edce3b5f Remove use of Obj.truncate from toplevel.
When running a script with "ocaml foo.ml", the toplevel needs to
run foo.ml with a different Sys.argv than the initial value, since
foo.ml must not see the initial "ocaml" argument.

Previously, this was done with Obj.truncate to shorten the Sys.argv
array. This patch changes it by introducing a primitive %sys_argv.
Uses of this primitive expand to a call to a new C primitive, which
returns the argv array (and can be modified by the toplevel).
2019-04-01 14:14:00 +01:00
Alain Frisch e350ebd7c9 Use Strict bindings when simplifying Lstaticraise (#8559)
Alias bindings were used before, but as #8558 shows this can be incorrect,
as the argument to `Lstaticraise` may be impure.

Adds a regression test.

Closes: #8558
2019-04-01 09:34:35 +02:00
Stephen Dolan 838e44a245
Update issue numbers in comments after Mantis -> Github migration. (#8505) 2019-03-18 09:42:23 +00:00
Mark Shinwell e141d9e240
Add a few utility functions in Misc (#2284) 2019-03-15 11:28:19 +00:00
Mark Shinwell 36c163248d Remove support for compiler plugins (#2276)
After consultation on the core developers' list I am proposing this patch to remove support for compiler plugins.

The main motivations for removing compiler plugins are:
- They are a potential security risk.
 - They increase the complexity of the build system and make maintenance of the Dynlink libraries more difficult (although actually, this complexity could probably be reduced after #2268 is merged).
 - Many applications of plugins should be able to be expressed by building custom compiler drivers that link against compilerlibs.

* Remove compiler plugins and hooks
* Add new function Dynlink.unsafe_get_global_symbol but keep it outside the documented API.
* Remove otherlibs/dynlink/nodynlink.ml
* Update Changes
2019-03-13 11:46:37 +01:00
Mark Shinwell d47ba6ec18
Functorize Consistbl (with some background info on Compilation_unit.t) (#2286) 2019-03-07 16:19:51 +00:00
Leo White eb98c8f5c5 Fix fatal error compiling module aliases 2019-02-21 13:57:30 +00:00
Pierre Chambart 1e6c739811
Merge pull request #1579 from chambart/split_backend_primitives
Use a different type for primitives in clambda and lambda
2019-02-14 15:30:37 +01:00
Gabriel Scherer 5a29ea7c2b
Merge pull request #1725 from stedolan/deprecate-set-tag
Deprecate Obj.set_tag
2019-02-14 15:16:48 +01:00
Fourchaux 1946594bd7 Fixing typos in various files (#2246)
Note: Typos found with https://github.com/codespell-project/codespell

Here is the (semi-manual) command used to get (and correct) the typos:

$ codespell -i 3 -w --skip=".png,.gif,./ocaml/boot,./ocaml/.git,./ocaml/manual/styles,./ocaml/manual/manual/htmlman" -L minimise,instal,contructor,"o'caml",cristal,pres,clos,cmo,uint,iff,te,objext,nto,nd,mut,upto,larg,exten,leage,mthod,delte,tim,atleast,langage,hten,iwth,mke,contant,succint,methids,eles,valu,clas,modul,que,classe,missings,froms,defaut,correspondance,differents,configury,reachs,cas,approche,normale,dur,millon,amin,oje,transfert
2019-02-13 14:04:56 +01:00
Stephen Dolan fa6304f6c3 check_typo fix 2019-02-12 16:46:06 +00:00
Stephen Dolan 51025d1729 Add optimisations in simplif.ml for Obj.with_tag. 2019-02-12 11:13:55 +00:00
Pierre Chambart 45b28a90b2 Move Semantics_of_primitives into asmcomp 2019-02-11 17:16:44 +01:00
Pierre Chambart 94b50698ce Rename for_primitive_clambda to for_primitive 2019-02-11 17:16:44 +01:00
Pierre Chambart f8058ac367 Remove lambda version of Semantics_of_primitives 2019-02-11 17:16:44 +01:00
Pierre Chambart 6dfd40f72f Push clambda_primitives to flambda 2019-02-11 17:16:44 +01:00
Pierre Chambart 7c5cc144a5 Clean string load/set primitives 2019-02-11 17:16:43 +01:00