Skip to content

Mark Obj_dup as not having effects and handle in Cfg #3766

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

Merged
merged 3 commits into from
Mar 31, 2025

Conversation

mshinwell
Copy link
Collaborator

This marks Obj_dup as not having effects in the primitive translation out of Flambda 2. Then Cfg.can_raise_terminator is modified to take account of the new effects propagation from #3765. The result is that the included test case now passes, whereas before it failed, by virtue of To_cmm not having wrapped the C.extcall for Obj_dup with an extra argument wrapper (such wrapper always being redundant).

This PR has to change the C stub caml_obj_dup so it never has effects: prior to this PR there is a corner case where an exception may be raised, but I think it's fine for this to change to a CAMLassert. Otherwise it is just like an allocation, which never raises (except for asynchronous effects, but that isn't relevant here).

Based on #3765, only the second commit here is new.

@mshinwell mshinwell added bug Something isn't working flambda2 Prerequisite for, or part of, flambda2 cfg labels Mar 31, 2025
@mshinwell mshinwell force-pushed the to-cmm-obj-dup-extra-args branch 2 times, most recently from 26ba1f9 to 4f49fdf Compare March 31, 2025 09:47
@mshinwell mshinwell force-pushed the to-cmm-obj-dup-extra-args branch from ad67d05 to 547b0a5 Compare March 31, 2025 10:32
@mshinwell mshinwell merged commit 19ed208 into ocaml-flambda:main Mar 31, 2025
22 checks passed
gretay-js pushed a commit to gretay-js/flambda-backend that referenced this pull request Apr 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cfg flambda2 Prerequisite for, or part of, flambda2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants