-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Portabilize Stdlib #3393
base: stable_val_modalities
Are you sure you want to change the base?
Portabilize Stdlib #3393
Conversation
569c742
to
8096435
Compare
ce744e4
to
b14c2da
Compare
[@@alert unsynchronized_access | ||
"GC parameters are a mutable global state." | ||
] | ||
(** Return the current values of the GC parameters in a [control] record. *) | ||
|
||
external set : control -> unit = "caml_gc_set" | ||
external set : control -> unit @@ nonportable = "caml_gc_set" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should these be alerted?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think we can remove the alert now. Feel free to do it here or in another PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I meant should these be alerted as [@@alert unsafe_multidomain]
? They are unsafe w.r.t. portability/contention, but there's no "safe" version that's easily writable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it unsafe if annotated with nonportable
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Continuing discussion in Slack, but basically these functions use atomic_load_relaxed
/atomic_store_relaxed
, which I think are unsafe in general without some kind of fencing (though I really don't understand this stuff well).
Signed-off-by: Thomas Del Vecchio <[email protected]>
Signed-off-by: Thomas Del Vecchio <[email protected]>
Signed-off-by: Thomas Del Vecchio <[email protected]>
Signed-off-by: Thomas Del Vecchio <[email protected]>
Signed-off-by: Thomas Del Vecchio <[email protected]>
Signed-off-by: Thomas Del Vecchio <[email protected]>
Signed-off-by: Thomas Del Vecchio <[email protected]>
Signed-off-by: Thomas Del Vecchio <[email protected]>
Signed-off-by: Thomas Del Vecchio <[email protected]>
Signed-off-by: Thomas Del Vecchio <[email protected]>
Signed-off-by: Thomas Del Vecchio <[email protected]>
Signed-off-by: Thomas Del Vecchio <[email protected]>
Signed-off-by: Thomas Del Vecchio <[email protected]>
Signed-off-by: Thomas Del Vecchio <[email protected]>
Signed-off-by: Thomas Del Vecchio <[email protected]>
Signed-off-by: Thomas Del Vecchio <[email protected]>
Signed-off-by: Thomas Del Vecchio <[email protected]>
Signed-off-by: Thomas Del Vecchio <[email protected]>
Signed-off-by: Thomas Del Vecchio <[email protected]>
Signed-off-by: Thomas Del Vecchio <[email protected]>
Signed-off-by: Thomas Del Vecchio <[email protected]>
Signed-off-by: Thomas Del Vecchio <[email protected]>
Signed-off-by: Thomas Del Vecchio <[email protected]>
Signed-off-by: Thomas Del Vecchio <[email protected]>
Signed-off-by: Thomas Del Vecchio <[email protected]>
Signed-off-by: Thomas Del Vecchio <[email protected]>
Signed-off-by: Thomas Del Vecchio <[email protected]>
Signed-off-by: Thomas Del Vecchio <[email protected]>
Signed-off-by: Thomas Del Vecchio <[email protected]>
Signed-off-by: Thomas Del Vecchio <[email protected]>
Signed-off-by: Thomas Del Vecchio <[email protected]>
Signed-off-by: Thomas Del Vecchio <[email protected]>
Signed-off-by: Thomas Del Vecchio <[email protected]>
Signed-off-by: Thomas Del Vecchio <[email protected]>
Signed-off-by: Thomas Del Vecchio <[email protected]>
Signed-off-by: Thomas Del Vecchio <[email protected]>
Signed-off-by: Thomas Del Vecchio <[email protected]>
Signed-off-by: Thomas Del Vecchio <[email protected]>
0b26357
to
529cbf5
Compare
Signed-off-by: Thomas Del Vecchio <[email protected]>
Signed-off-by: Thomas Del Vecchio <[email protected]>
Signed-off-by: Thomas Del Vecchio <[email protected]>
Signed-off-by: Thomas Del Vecchio <[email protected]>
Signed-off-by: Thomas Del Vecchio <[email protected]>
Replace the [@@unsafe_allow_any_kind_in_{impl,intf}] attributes with a new [@@unsafe_allow_any_mode_crossing] attribute. This is different in that it: 1. Works on the type declaration, not the inclusion check, so is more powerful - it can be used to illegally mode cross types defined in the same module, or illegally mode cross non-abstract types in interfaces. The latter especially is necessary to fully subsume -allow-illegal-crossing in stdlib 2. Only allows changing the modal bounds of a kind, not the layout - it's unclear that anyone should ever want to unsafely change the layout of a kind; I personally can't think of any sound reason to do so. Some [past discussion][0] on the specific syntax for this attribute suggested specifying the bounds directly on the attribute, rather than using the jkind annotation, but I and others feel reasonably strongly that this way of doing things is a better design for the sake of consistency. [0]: #3385 (comment)
Signed-off-by: Thomas Del Vecchio <[email protected]>
Signed-off-by: Thomas Del Vecchio <[email protected]>
Does the tree build with this PR? |
Could you move the |
@@ -28,6 +30,8 @@ type raw_data = nativeint (* @since 4.12 *) | |||
external repr : 'a -> t = "%obj_magic" | |||
external obj : t -> 'a = "%obj_magic" | |||
external magic : 'a -> 'b = "%obj_magic" | |||
external magic_portable : 'a -> 'a @ portable = "%identity" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think those should have alerts, even if Obj.magic
does not have one.
This commit comes from #3424 . Updated PR description to mention this. |
Working on it, but not yet; there's a few bugs I'm working with @riaqn on. |
This PR updates stdlib in three main ways:
portable
when possible.[@alert unsafe_multidomain "Use [...]."]
.Safe
submodules when necessary to redefine unsafe functions from (2) with necessary mode annotations.One place in particular that needed some work is
Domain
, which needed a rework of theDLS
module to fit more in line with the capsule model.Portable versions of functors in
Set
,Map
,Hashtbl
, andEphemeron
are also created, which takeportable
input modules and produceportable
output modules.Tests are updated to disable the "unsafe_multidomain" alert rather than moving tests to the new "safe" versions.
This PR currently depends on #3391 and #3424 .
Changes should be reviewed as a whole, not by commit.