|Anonymous | Login | Signup for a new account||2019-02-22 22:21 CET|
|Main | My View | View Issues | Change Log | Roadmap|
|View Issue Details|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0007655||OCaml||documentation||public||2017-10-09 15:37||2017-10-15 01:43|
|Priority||normal||Severity||text||Reproducibility||have not tried|
|Target Version||Fixed in Version||4.06.0 +dev/beta1/beta2/rc1|
|Summary||0007655: Unclear semantics of [@@noalloc]|
|Description||The manual does not seem to specify the behavior of external function declarations with the [@@noalloc] attribute if both a byte and native code entry point are declared. Though one would typically expect both entry points to have the same allocation behavior, this is eminently not the case when the function also declares that it returns unboxed values.|
E.g. many numeric functions in Pervasives return unboxed doubles, which have to be explicitly allocated for byte code but not for native code. The functions are nevertheless declared with [@@noalloc]. I guess the byte code interpreter always ignores this attribute, otherwise the current Pervasives implementation would not be safe.
I think the expected behavior of [@@noalloc] with byte and native code should be documented in the C-interface section of the manual.
|Tags||No tags attached.|
|Yes, [@@noalloc] and several other function attributes such as [@@unboxed] apply only in native code. Feel free to suggest a better wording for the reference manual to make this point clearer.|
Indeed, I just realized that the main section has a small note that it only applies to the native code compiler. But in its subsections (about unboxing and direct C-calls respectively) the text only refers to "the OCaml compiler". The note at the beginning of the main section is easy to miss. I knew that unboxing / untagging would only work with the native code compiler, but I always mistakenly believed that "noalloc" applied to byte code stubs, too.
I have just submitted a pull request that hopefully improves the wording in subsections.
|Fixed by merging Markus' pull request: https://github.com/ocaml/ocaml/pull/1422 [^]|
|2017-10-09 15:37||mottl||New Issue|
|2017-10-09 20:17||xleroy||Note Added: 0018523|
|2017-10-09 20:17||xleroy||Severity||minor => text|
|2017-10-09 20:17||xleroy||Status||new => acknowledged|
|2017-10-09 21:22||mottl||Note Added: 0018526|
|2017-10-15 01:43||gasche||Note Added: 0018567|
|2017-10-15 01:43||gasche||Status||acknowledged => resolved|
|2017-10-15 01:43||gasche||Fixed in Version||=> 4.06.0 +dev/beta1/beta2/rc1|
|2017-10-15 01:43||gasche||Resolution||open => fixed|
|2017-10-15 01:43||gasche||Assigned To||=> gasche|
|Copyright © 2000 - 2011 MantisBT Group|