Skip to content

Refactor of simplify-let-cont #968

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 47 commits into from
Jan 12, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
51507d8
Start refactor of simplify_let_cont
Ekdohibs Nov 10, 2022
52832c3
Continue refactor
Ekdohibs Nov 10, 2022
30b87a0
Continue refactor, comments
Ekdohibs Nov 14, 2022
c5dce6c
Non-rec continuations mostly working
Ekdohibs Nov 17, 2022
af72585
Remove cont_scope from uenv
Ekdohibs Nov 17, 2022
a1b25b0
Recursive continuations support (except aliases), but crashes
Ekdohibs Nov 18, 2022
f38208c
bugfix
Ekdohibs Nov 18, 2022
f79db17
Fix missing lifted constants
Ekdohibs Nov 21, 2022
0fcfd58
Handle most todos
Ekdohibs Nov 21, 2022
0764eb6
Inline gotos
Ekdohibs Nov 22, 2022
60b99f6
slight cleanup of join_points
Ekdohibs Nov 24, 2022
280a32f
Prepare invariant parameters
Ekdohibs Nov 24, 2022
fb01f69
Fix bug with code_age_relation in join_points
Ekdohibs Nov 25, 2022
c37ba21
start for rewrite for invariant params
Ekdohibs Nov 25, 2022
eb0cf27
Put simplify_handlers inside simplify_let_cont_stage2
Ekdohibs Nov 28, 2022
2c7649e
Reindent, remove invariant arguments
Ekdohibs Nov 28, 2022
2bc6c42
continue invariant params
Ekdohibs Nov 29, 2022
aab7a40
Add comments
Gbury Nov 29, 2022
86fed06
delete old code
Ekdohibs Nov 29, 2022
70deda9
use prepare_dacc_for_handlers
Ekdohibs Nov 29, 2022
244c276
fix
Ekdohibs Nov 29, 2022
e48c7be
make fmt
Ekdohibs Nov 29, 2022
7e5b575
Use Bound_parameters properly
Ekdohibs Nov 30, 2022
3d96e19
some cleanup
Ekdohibs Nov 30, 2022
0b991e6
Remove now unused bound_continuations_and_parameters
Ekdohibs Nov 30, 2022
d8613e6
Cleanup
Ekdohibs Nov 30, 2022
4e8ded8
Prepare for invariant parameters in apply_cont_rewrite
Ekdohibs Nov 30, 2022
1156a8f
correctly handle invariant params
Ekdohibs Dec 1, 2022
93f5a3a
invariant_params should be added to stage3
Ekdohibs Dec 1, 2022
70cb6fb
Cleanup & invariant args
Ekdohibs Dec 6, 2022
7298bbd
bugfix
Ekdohibs Dec 6, 2022
3787b65
Adapt to_cmm for invariant_params
Gbury Dec 6, 2022
132d92c
unbox invariant params
Ekdohibs Dec 6, 2022
03821ea
Fix failure with inlined continuations
Ekdohibs Dec 8, 2022
0793f34
Rewrite apply_cont_rewrite
Ekdohibs Dec 9, 2022
13ae2bf
Fix assert failure
Ekdohibs Dec 12, 2022
bd5aaae
Fix compare
Ekdohibs Dec 12, 2022
199d938
make fmt
Ekdohibs Dec 12, 2022
b6adb0a
Handle phantom params
Ekdohibs Dec 12, 2022
b2e95cf
cleanup names + ascii art
Ekdohibs Dec 15, 2022
fbd1eb2
make fmt
Ekdohibs Dec 15, 2022
c9fdccf
cleanup downwards
Ekdohibs Dec 15, 2022
703c1b2
fix rebase
Ekdohibs Dec 20, 2022
ef9df47
Remove TODO that was already done
Ekdohibs Jan 10, 2023
1008c63
Update middle_end/flambda2/simplify/apply_cont_rewrite.ml
Ekdohibs Jan 12, 2023
cf15cd3
review comments
Ekdohibs Jan 12, 2023
a2cfa6e
make fmt
Ekdohibs Jan 12, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
make fmt
  • Loading branch information
Ekdohibs committed Jan 12, 2023
commit a2cfa6e891410c018d10efbec830ff79873e7aa4
3 changes: 2 additions & 1 deletion middle_end/flambda2/simplify/apply_cont_rewrite.ml
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,8 @@ let make_rewrite rewrite ~ctx id args =
required extra args might not be needed as argument to the
continuation. But we want to keep the let bindings.
[required_by_other_extra_args] tracks that dependency. It is the set
of free variables of [extra_args_rev] and [extra_invariant_args_rev] *)
of free variables of [extra_args_rev] and
[extra_invariant_args_rev] *)
let extra_arg, extra_let, free_names, defined_names =
match arg with
| Already_in_scope simple ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,22 @@
(* *)
(**************************************************************************)

(** Unfold a continuation parameter's type into an unboxing decision tree. This
does not take account of the types of the corresponding arguments at the
continuation's use site(s). *)
(* Note that, if the continuation is recursive, we need to prevent generating
decisions that unbox variants and closures, as we cannot be sure that reasonable
extra_args can be computed for all use sites, since we have not yet seen all
use sites at this point. For instance: *)
decisions that unbox variants and closures, as we cannot be sure that
reasonable extra_args can be computed for all use sites, since we have not
yet seen all use sites at this point. For instance: *)
(*
* let rec cont k x y =
* switch y with
* | 0 -> k (Some x)
* | 1 -> k (f x) (* for some function f in scope *)
*)
(* In this case, even if we know that x is an option, to unbox it we'd need to
introduce a switch in the `1` branch. This is:
1) not implemented (although technically possible)
2) not efficient or beneficial in most cases. *)
introduce a switch in the `1` branch. This is: 1) not implemented (although
technically possible) 2) not efficient or beneficial in most cases. *)
(** Unfold a continuation parameter's type into an unboxing decision tree. This
does not take account of the types of the corresponding arguments at the
continuation's use site(s). *)
val make_optimistic_decision :
depth:int ->
recursive:bool ->
Expand Down