Skip to content

[RFC] add caml_modify_field and caml_initialize_field#120

Closed
gasche wants to merge 1 commit intoocaml:trunkfrom
gasche:caml_modify_field
Closed

[RFC] add caml_modify_field and caml_initialize_field#120
gasche wants to merge 1 commit intoocaml:trunkfrom
gasche:caml_modify_field

Conversation

@gasche
Copy link
Member

@gasche gasche commented Nov 28, 2014

Stephen Dolan reported that he had to do a related change as part of his Multicore-OCaml work, and it seems applicable independently of it.

This patch does not remove all uses of Field(...) as a lvalue, or all &Field(..) constructs, but only those that fit into the following patterns:

caml_modify(&Field(v, idx), w) => caml_modify_field(v, idx, w)
caml_initialize(&Field(v, idx, w) => caml_initialize_field(v, idx, w)

This is an exploratory patch from someone that doesn't know the runtime very well. I had some questions when working on the code, which are marked with
/* GS: ... */ comments.

All feedback and comments are welcome.

Stephen Dolan reported that he had to do this change as part of his
Multicore-OCaml work, and it seems applicable independently of it.

This patch does not remove all uses of Field as a lvalue, or all
&Field(..) constructs, but only those that fit into the following
patterns:
  caml_modify(&Field(v, idx), w)
  caml_initialize(&Field(v, idx, w)

I had some questions when working on the code, which are marked with
"/* GS: ..." comments.
@gasche
Copy link
Member Author

gasche commented Nov 30, 2014

@stedolan, is this close to what you had in mind?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one looks wrong: the destination pointer p used to vary with the loop, now it's a constant. Also, you're still increasing p, which is useless. Try this:

       for (i = 0; i < nvars; i++)
         caml_initialize_field(accu, nfuncs * 2 - 1 + i, sp[i]);

Also, try to write a test that triggers the problem.

@damiendoligez damiendoligez added this to the 4.04-or-later milestone Jan 25, 2016
@bobot
Copy link
Contributor

bobot commented Jul 26, 2016

@gasche do you want so help for moving on this issue?

@gasche
Copy link
Member Author

gasche commented Jul 26, 2016

@bobot please feel free to adopt the issue if you want to push for it now.

@damiendoligez damiendoligez removed this from the 4.04 milestone Aug 3, 2016
@damiendoligez
Copy link
Member

please feel free to adopt the issue if you want to push for it now.

@gasche can you do that within Github?

@gasche
Copy link
Member Author

gasche commented Aug 3, 2016

Well I was thinking of closing this PR and opening another one. If you want to keep a given PR, whoever is interested can send me a PR against my personal branch gasche:caml_modify_field, and I'd update the PR.

The reason why I would like to give this PR to someone else (I still think it's a good think to do as soon as possible) are:

  • I don't have the runtime expertise to write code that I trust is correct
  • When I subimtted this PR I expected some feedback from @stedolan but, probably because of miscommunication on my part, it never quite happened.

@mshinwell
Copy link
Contributor

I'm going to close this, since @stedolan and @kayceesrk are going to submit a revised proposal for C API changes for 4.05.

@stedolan Please take note of comments here anyway, in case they are useful.

@mshinwell mshinwell closed this Dec 27, 2016
@stedolan
Copy link
Contributor

Sorry I missed this at the time!

I've created #1003 with the revised proposal, which is a bit more far-reaching.

stedolan pushed a commit to stedolan/ocaml that referenced this pull request Jun 9, 2017
chambart pushed a commit to chambart/ocaml-1 that referenced this pull request Aug 4, 2021
stedolan pushed a commit to stedolan/ocaml that referenced this pull request Oct 5, 2021
stedolan pushed a commit to stedolan/ocaml that referenced this pull request Mar 21, 2023
c703f5f Incorporate upstream comments into type-variable refactor (ocaml#121)
362ba23 Constrain curry modes to increase along applications (ocaml#108)
b1f0cf9 Simplify the extension handling (ocaml#114)
4fd53a1 Remove pat_mode from typedtree (ocaml#105)
cf6fcbc Handle attributes on lambdas with locally abstract types (ocaml#120)
5fa80fe Don't track attributes inside attributes for warning 53 (ocaml#115)
8a69777 Handle unclosed `[: ... :]` patterns (via `Generic_array` machinery) (ocaml#117)
b0737f4 Add promote-one Makefile target (ocaml#118)
c6ad684 Refactoring and fixes around module lookup (ocaml#107)
b0a6495 Add documentation for global constructor arguments (ocaml#69)
dd79aec Print `nlocal` in the `-d(raw)lambda` output (ocaml#112)
8035026 Fix `nlocal` in the generated Lambda for list comprehensions (ocaml#113)
afbcdf0 Immutable arrays (ocaml#47)
bfe1490 fix several issues when removing exp_mode (ocaml#110)
8f46060 Better error message for under-applied functions (ocaml#74)
27331d8 Consistently use Lmutvar or Lvar in comprehensions (ocaml#111)
01e965b Skip failing test for now
0131357 Fix test case to use comprehensions_experimental
22a7368 Temporarily disable list comprehensions tests due to locals bug
e08377d Make `comprehensions` into `comprehensions_experimental` for now (ocaml#109)
947cf89 List and array comprehensions (ocaml#46)
bd9e051 remove exp_mode from typedtree (ocaml#100)
a9268d2 Fix misplaced attribute warning when using external parser (and some cleanup) (ocaml#101)
2b33f24 Refactor toplevel local escape check (ocaml#104)
ed2aec6 Comment functions exported from TyVarEnv.
87838ba Move new variable creation into TyVarEnv.
a3f60ab Encapsulate functions that work with tyvars
43d83a6 Prevent possibility of forgetting to re-widen
2f3dd34 Encapsulate context when narrowing type env't
d78ff6d Make immediate64 things mode cross (ocaml#97)
aa25ab9 Fix version number (ocaml#94)
d01ffa0 Fix .depend file (ocaml#93)
942f2ab Bootstrap (ocaml#92)
05f7e38 Check Menhir version (ocaml#91)
1569b58 Move the CI jobs from 4.12 to 4.14. (ocaml#90)

git-subtree-dir: ocaml
git-subtree-split: c703f5f
EmileTrotignon pushed a commit to EmileTrotignon/ocaml that referenced this pull request Jan 12, 2024
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.

5 participants