Commit Graph

51 Commits (master)

Author SHA1 Message Date
Jeremy Yallop 491cc88b33 Mark Obj.tag [@@noalloc] 2020-08-21 10:29:31 +01:00
Gabriel Scherer bdbf5c30fd
Update camlinternalMod and Obj.new_block for new closure representation (#9691)
* camlinternalMod: use closure metadata for copying a closure over another

This change is careful to avoid writing a value into what was
previously a raw field or conversely, clearing fields that change
category first.

We also clear the end of the block, to make it easier to reason about
lifetime of values that could have been referenced there. (We don't
expect this to make a different in practice.)

* Obj: new submodule Closure giving basic access to closure metadata

* Ensure that Obj.new_block returns a sensible uninitialized closure

* Changes
2020-06-19 17:41:08 +02:00
Xavier Leroy ec33006c0a Add type Obj.raw_data and functions Obj.raw_field, Obj.set_raw_field
Some OCaml objects contain data that cannot be safely represented
as an OCaml value (type Obj.t).  For example, in no-naked-pointers mode,
this is the case for code pointers inside closures, and for the
"custom operations" pointers inside custom blocks.

This PR introduces a type Obj.raw_data (an alias for nativeint)
to encapsulate this data, and functions
Obj.raw_field / Obj.set_raw_field to read and write the "raw" contents
of fields of blocks.

Note: just like it is wrong to access code pointers and custom operations
using Obj.field / Obj.set_field, it is wrong to access regular fields
possibly containing pointers into the OCaml heap using
Obj.raw_field / Obj.set_raw_field.  The OCaml heap block can be
reclaimed or moved after its address was captured by Obj.raw_field.
Symmetrically, Obj.set_raw_field on a regular field bypasses the
write barrier of the GC.
2020-06-10 16:29:37 +02:00
Stephen Dolan c39f771a33 Deprecate Obj.set_tag.
- Adds Obj.with_tag as a partial replacement.
  - Adds caml_obj_make_forward for use of Camlinternal{Lazy,Mod}
2019-02-12 11:13:48 +00:00
Damien Doligez bc3942bbb8
Merge pull request #676 from bobot/ephemeron_c_api2
Ephemeron C API
2018-11-14 11:50:22 +01:00
François Bobot 0ed143afa4 [Weak] Changes from reviews
from Frédéric Bour (@let-def)
   from Mark Shinwell (@mshinwell)

  particularly:
    - in *_copy, avoid an infinite loop by triggering a minor collection
      after 8 rounds. But since truncation and tag setting will be
      deprecated we could soon remove this code.
2018-11-08 16:16:32 +01:00
François Bobot 9e34215044 [Weak] Move checks from C to Ocaml
Simpler to write and to optimize
2018-11-08 16:16:09 +01:00
yallop ee1c2a4d7e Add paths for built-in types (#1876)
* Add an Extension_constructor submodule to Obj.

Deprecate top-level functions extension_constructor / extension_name /
extension_id.

* Add 'true' and 'false' to the definition of Bool.t

* Add aliases for the built-in 'list' and 'array' types.

* Add an alias for 'exn' to Printexc.

* Changes entry: built-in type aliases

* Add a Unit module.

* Add paths for built-in exceptions.
2018-11-08 16:08:17 +01:00
Damien Doligez f086eda9c0 add -no-flat-float-array configure option 2017-09-15 18:24:36 +02:00
Demi Obenour 1f6722b022 Fix placement of `[@inline always]` 2016-05-02 20:11:21 -04:00
Demetri Obenour 8d5a80f620 Fix attributes, remove unneeded `|>`, and switch to C-style comments 2016-05-02 20:11:21 -04:00
Demetri Obenour 483a7be3e9 Reformat and note that caml_obj_is_block is unused 2016-05-02 20:11:21 -04:00
Demetri Obenour b1f93a660e Make Obj.is_block an inline OCaml function
instead of a C external
2016-05-02 20:11:21 -04:00
alainfrisch 10c555c681 Add a primitive (exposed in Obj) to compute the total size of heap blocks accessible from a given value. 2016-05-02 18:14:33 +02:00
Damien Doligez 5401ce8473 Update headers for the new license.
Remains to be done: remove all headers in testsuite/tests.
2016-02-18 16:59:16 +01:00
François Bobot 9e85e6cb4d [Stdlib] Rename Obj.Ephemeron.eph in .t
An ugly obj_t is needed for the shadowing of Obj.t
2016-01-25 08:33:55 +01:00
François Bobot 03ed6a0f51 [Stdlib] Ephemeron: add the module in the stdlib 2016-01-25 08:33:54 +01:00
Damien Doligez 0225ca01e3 GC latency improvements 2015-12-21 14:27:46 +01:00
Jeremie Dimino d3b60c8dce Use the extension_constructor type in Obj
Rename Obj.extension_slot to Obj.extension_constructor as well
2015-11-27 17:57:41 +00:00
Damien Doligez 860c670848 merge branch 4.02 from 4.02.1 (rev 15540) to a few fixes after 4.02.2 (rev 16205)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16214 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-07-17 14:31:05 +00:00
Damien Doligez a18bc7950b merge changes of version/4.02 from r15121 to r15155
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15168 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-08-29 17:14:00 +00:00
Jacques Garrigue b56dc4b3df PR#5584: merge open extensible types, extension-patch-4.0.2
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14737 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-05-04 23:08:45 +00:00
Damien Doligez 5b8df637d2 merge branch "safe-string"
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14705 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-04-29 11:56:17 +00:00
Damien Doligez def31744f9 remove all $Id keywords
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13013 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2012-10-15 17:50:56 +00:00
Damien Doligez 3b507dd1aa renaming of Objective Caml to OCaml and cleanup of copyright headers
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@11156 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2011-07-27 14:17:02 +00:00
Damien Doligez 7539834933 big bug in Obj.add_offset
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@9561 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2010-01-25 11:55:30 +00:00
Damien Doligez bdc0fadee2 merge changes from release/3.11.1 to release/3.11.2
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@9540 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2010-01-20 16:26:46 +00:00
Damien Doligez 99ef8c802e add unaligned_tag
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@8795 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2008-01-29 13:11:15 +00:00
Damien Doligez 5a678d29f5 depollution suite (PR#1914 et PR#1956)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@6045 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2004-01-01 16:42:43 +00:00
Damien Doligez e969e8ad9f PR#1878
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@5873 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2003-10-16 23:22:23 +00:00
Damien Doligez 198b607114 rajout final_tag (deprecated)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@4304 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2002-01-23 17:51:41 +00:00
Damien Doligez 0dbce74fc8 lazy a la Tolmach
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@4291 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2002-01-20 17:39:10 +00:00
Xavier Leroy 7501784c80 MAJ en-tetes pour mentionner la 'special exception' sur la LGPL
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@4144 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2001-12-07 13:41:02 +00:00
Xavier Leroy 555c7f8022 Ajout de la primitive %obj_is_int
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@2686 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
1999-12-12 16:29:31 +00:00
Jacques Garrigue 77d4f18ce6 changed label_pattern syntax
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@2677 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
1999-12-08 08:21:57 +00:00
Xavier Leroy cc0f32b054 Changement de la licence
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@2553 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
1999-11-17 18:59:06 +00:00
Xavier Leroy 67971438ee Noms symboliques pour les tags speciaux
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@2107 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
1998-10-01 12:34:32 +00:00
Damien Doligez a8b9073f28 Makefile: portabilite echo -n
obj.mli, obj.ml: ajout primitive Obj.truncate


git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@2083 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
1998-08-27 12:13:10 +00:00
Jérôme Vouillon 87b17301f4 Nouvelle syntaxe des classes
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@1997 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
1998-06-24 19:22:26 +00:00
Xavier Leroy 29754eb4cb Obj.unmarshal n'etait pas compatible avec l'ancienne version (1.05)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@1798 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
1997-11-21 13:47:38 +00:00
Xavier Leroy 32664ffdc0 Ajout de String.[r]index_from, Obj.[un]marshal
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@1744 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
1997-10-28 13:17:11 +00:00
Xavier Leroy b149e67a88 Nouveau module Marshal dans stdlib
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@1633 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
1997-07-02 18:16:15 +00:00
Jérôme Vouillon a7dd559a68 Ajout de Obj.obj : t -> 'a.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@1440 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
1997-03-22 20:27:26 +00:00
Xavier Leroy 2301d778e7 Renommage en Objective Caml
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@782 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
1996-04-30 14:53:58 +00:00
Xavier Leroy 758adc066d obj: ajout de marshal et unmarshal.
pervasives: close_out fait maintenant flush en ML, plus en C
sys: ajout de sigprof (pour les interval timers du module Unix)


git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@751 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
1996-04-18 16:33:41 +00:00
Xavier Leroy e4066357b1 Ajout des notices de copyright
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@195 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
1995-08-09 15:06:35 +00:00
Xavier Leroy 3843b0cddb Declarations des primitives flottantes.
Declaration des primitives sur les objets.


git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@154 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
1995-07-27 17:44:04 +00:00
Xavier Leroy 41bd2b6153 Fermetures representees en un seul bloc
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@49 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
1995-06-22 10:11:18 +00:00
Xavier Leroy 101bb8b8a7 Changement representation des constructeurs constants.
list: ajout de nth
obj: %is_block devient une fonction C.
parsing: le tableau transl est coupe en transl_const et transl_block.


git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@41 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
1995-06-18 14:45:56 +00:00
Xavier Leroy 9ef4bd08d1 Passage de {Array,String}.{get,set} en primitives C.
Renommage %array_get -> %array_unsafe_get, etc.


git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@31 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
1995-06-15 08:10:01 +00:00