-
Notifications
You must be signed in to change notification settings - Fork 0
DCE cleanup #8
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
base: master
Are you sure you want to change the base?
DCE cleanup #8
Changes from all commits
7926bee
d5e2cc1
4183326
6adae89
bab4af9
9748813
e77d9df
3442961
d9079af
f399489
b607181
58881af
96eec83
3b524c6
d7e3fb7
0fde7b9
8a3989a
79cb287
4875980
8115b5f
f724fdd
fc9a119
c02633f
0352606
b3d08ab
43c60d5
250c180
5330642
65fb4b0
2204004
8101f3e
4965d4e
45dbd7f
c041798
8e74388
e843dbb
9164d94
dfcf8b9
592fe62
16d5740
6199133
8182d8c
3a69af6
d6794ab
92a56bc
470287c
4e3e270
36e7b23
8b2eb65
bad5555
a433ac5
3bf943c
f8a7802
81a69c7
629f971
1677ced
f2afdbf
764230d
0f35d00
4411f50
5ef9ca5
cd7bf43
f8c67b1
3ea9dc2
47438f0
5a34796
e5d5dc7
d257a44
50ff761
39e7327
dc0cbf8
728fe6b
ab435a2
fe7ccea
377e201
ff2f8fe
f5a9ffc
0b2084e
0d9d4cf
992ede9
06b4ff6
42bf7d5
fca06e9
549bbcc
0628a79
cb69c20
f6c704e
5813dfe
5da36b6
678bb37
75b4704
25390c6
dec8c5d
7880688
420664c
88ebcf5
a7e0b14
efd1fe4
7a00407
d40e758
332d29a
a1a8b1b
07c1215
3c91dee
9295a0c
5146d17
aad9a3b
c130612
85a76b4
40dbf79
fba6366
3bfebb2
d16ca32
fdbe9c3
cab9f6b
776ddda
480e708
61ce615
86ea981
94b4cc7
c36c7f8
8d41522
a684e06
9fdf5f4
e7a1e9c
2681f9a
281bb82
575c5db
4725b5e
61ef8a9
28659d3
8b7d710
da0903b
f4e96cf
a87dcfb
f9f20ee
1255408
3db4299
12206d4
220e675
634449d
dea85ba
de06899
31a1dcc
b0d5773
29214ec
44dda5d
d4d008d
d03d317
60c41e2
3146029
c3564c4
42773b4
c1f2e4f
3030b02
3864b90
697d486
88ff69a
237d5fd
5512ec7
8282068
27975b1
d4039b1
9c7f294
a70028d
cae950b
65b434c
643457a
bd4f861
ff1867c
d9ab0e7
cc8e43c
cd65766
7acb783
91c992d
b41f3b4
7a0bb42
d20275d
094b8c2
42fea08
bb25604
1a9ff6f
25d4d86
4cc3ca9
e334b06
df4b2cc
cae2dfa
a7b3e87
c05a03a
0348e21
bf7a2cf
5499095
7f4df5b
233c4c8
551753c
69efd3c
87ab438
dd8833e
8c8294f
a24fe29
df879b4
c8ae11e
9cc6b61
5d9c3d3
a14bf9f
cbc5179
ec30a41
9dab4fa
4746f43
9d9b4b2
4d25b06
8ee8257
bcd1f66
1b1e3f6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -108,3 +108,6 @@ package.tgz | |
|
|
||
| # AI Agents | ||
| .claude/settings.local.json | ||
|
|
||
| # reanalyze DCE report output | ||
| _dce/ | ||
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,12 +18,6 @@ type ('k, 'v) delta = | |
| val set : 'k -> 'v -> 'k * 'v option | ||
| (** Create a batch entry that sets a key *) | ||
|
|
||
| val remove : 'k -> 'k * 'v option | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. DCE: trimmed dead APIs; trimmed reactive interfaces; removed unused reactive exports. |
||
| (** Create a batch entry that removes a key *) | ||
|
|
||
| val delta_to_entries : ('k, 'v) delta -> ('k * 'v option) list | ||
| (** Convert delta to batch entries *) | ||
|
|
||
| (** {1 Statistics} *) | ||
|
|
||
| type stats = { | ||
|
|
@@ -45,41 +39,6 @@ type stats = { | |
| } | ||
| (** Per-node statistics for diagnostics *) | ||
|
|
||
| val create_stats : unit -> stats | ||
|
|
||
| (** {1 Node Registry} *) | ||
|
|
||
| module Registry : sig | ||
| type node_info | ||
| (** Information about a registered node *) | ||
|
|
||
| val clear : unit -> unit | ||
| (** Clear all registered nodes *) | ||
|
|
||
| val to_mermaid : unit -> string | ||
| (** Generate a Mermaid diagram of the pipeline *) | ||
|
|
||
| val print_stats : unit -> unit | ||
| (** Print timing statistics for all nodes *) | ||
| end | ||
|
|
||
| (** {1 Scheduler} *) | ||
|
|
||
| module Scheduler : sig | ||
| val propagate : unit -> unit | ||
| (** Process all dirty nodes in topological order. | ||
| Called automatically when a source emits. *) | ||
|
|
||
| val is_propagating : unit -> bool | ||
| (** Returns true if currently in a propagation wave *) | ||
|
|
||
| val wave_count : unit -> int | ||
| (** Number of propagation waves executed *) | ||
|
|
||
| val reset_wave_count : unit -> unit | ||
| (** Reset the wave counter *) | ||
| end | ||
|
|
||
| (** {1 Collection Interface} *) | ||
|
|
||
| type ('k, 'v) t = { | ||
|
|
@@ -97,8 +56,6 @@ val iter : ('k -> 'v -> unit) -> ('k, 'v) t -> unit | |
| val get : ('k, 'v) t -> 'k -> 'v option | ||
| val length : ('k, 'v) t -> int | ||
| val stats : ('k, 'v) t -> stats | ||
| val level : ('k, 'v) t -> int | ||
| val name : ('k, 'v) t -> string | ||
|
|
||
| (** {1 Source Collection} *) | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,23 +39,6 @@ let to_collection t : (string, 'v) Reactive.t = t.collection | |
| (** Emit a delta *) | ||
| let emit t delta = t.emit delta | ||
|
|
||
| (** Process a file if changed. Emits delta to subscribers. *) | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. DCE: trimmed dead APIs; trimmed reactive interfaces. Covers reactive_file_collection.mli too. |
||
| let process_if_changed t path = | ||
| let new_id = get_file_id path in | ||
| match Hashtbl.find_opt t.internal.cache path with | ||
| | Some (old_id, _) when not (file_changed ~old_id ~new_id) -> | ||
| false (* unchanged *) | ||
| | _ -> | ||
| let raw = t.internal.read_file path in | ||
| let value = t.internal.process path raw in | ||
| Hashtbl.replace t.internal.cache path (new_id, value); | ||
| emit t (Reactive.Set (path, value)); | ||
| true (* changed *) | ||
|
|
||
| (** Process multiple files (emits individual deltas) *) | ||
| let process_files t paths = | ||
| List.iter (fun path -> ignore (process_if_changed t path)) paths | ||
|
|
||
| (** Process a file without emitting. Returns batch entry if changed. *) | ||
| let process_file_silent t path = | ||
| let new_id = get_file_id path in | ||
|
|
@@ -77,11 +60,6 @@ let process_files_batch t paths = | |
| if entries <> [] then emit t (Reactive.Batch entries); | ||
| List.length entries | ||
|
|
||
| (** Remove a file *) | ||
| let remove t path = | ||
| Hashtbl.remove t.internal.cache path; | ||
| emit t (Reactive.Remove path) | ||
|
|
||
| (** Remove multiple files as a batch *) | ||
| let remove_batch t paths = | ||
| let entries = | ||
|
|
@@ -95,17 +73,5 @@ let remove_batch t paths = | |
| if entries <> [] then emit t (Reactive.Batch entries); | ||
| List.length entries | ||
|
|
||
| (** Clear all cached data *) | ||
| let clear t = Hashtbl.clear t.internal.cache | ||
|
|
||
| (** Invalidate a path *) | ||
| let invalidate t path = Hashtbl.remove t.internal.cache path | ||
|
|
||
| let get t path = | ||
| match Hashtbl.find_opt t.internal.cache path with | ||
| | Some (_, v) -> Some v | ||
| | None -> None | ||
|
|
||
| let mem t path = Hashtbl.mem t.internal.cache path | ||
| let length t = Reactive.length t.collection | ||
| let iter f t = Reactive.iter f t.collection | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,33 +39,17 @@ val to_collection : ('raw, 'v) t -> (string, 'v) Reactive.t | |
|
|
||
| (** {1 Processing} *) | ||
|
|
||
| val process_files : ('raw, 'v) t -> string list -> unit | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. DCE: trimmed dead APIs; trimmed reactive interfaces. |
||
| (** Process files, emitting individual deltas for each changed file. *) | ||
|
|
||
| val process_files_batch : ('raw, 'v) t -> string list -> int | ||
| (** Process files, emitting a single [Batch] delta with all changes. | ||
| Returns the number of files that changed. | ||
| More efficient than [process_files] when processing many files at once, | ||
| as downstream combinators can process all changes together. *) | ||
|
|
||
| val process_if_changed : ('raw, 'v) t -> string -> bool | ||
| (** Process a file if changed. Returns true if file was processed. *) | ||
|
|
||
| val remove : ('raw, 'v) t -> string -> unit | ||
| (** Remove a file from the collection. *) | ||
|
|
||
| val remove_batch : ('raw, 'v) t -> string list -> int | ||
| (** Remove multiple files as a batch. Returns the number of files removed. | ||
| More efficient than calling [remove] multiple times. *) | ||
|
|
||
| (** {1 Cache Management} *) | ||
|
|
||
| val invalidate : ('raw, 'v) t -> string -> unit | ||
| val clear : ('raw, 'v) t -> unit | ||
|
|
||
| (** {1 Access} *) | ||
|
|
||
| val get : ('raw, 'v) t -> string -> 'v option | ||
| val mem : ('raw, 'v) t -> string -> bool | ||
| val length : ('raw, 'v) t -> int | ||
| val iter : (string -> 'v -> unit) -> ('raw, 'v) t -> unit | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,15 +8,11 @@ type t = {issues: Issue.t list} | |
|
|
||
| let empty = {issues = []} | ||
|
|
||
| let add_issue result issue = {issues = issue :: result.issues} | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. DCE: removed unused result helpers. Covers analysis_result.mli too. |
||
|
|
||
| let add_issues result new_issues = | ||
| {issues = List.rev_append new_issues result.issues} | ||
|
|
||
| let get_issues result = result.issues |> List.rev | ||
|
|
||
| let issue_count result = List.length result.issues | ||
|
|
||
| (** Create a dead code issue *) | ||
| let make_dead_issue ~loc ~dead_warning ~path ~message : Issue.t = | ||
| { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,18 +9,12 @@ type t | |
| val empty : t | ||
| (** Empty result with no issues *) | ||
|
|
||
| val add_issue : t -> Issue.t -> t | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. DCE: removed unused result helpers. |
||
| (** Add a single issue to the result *) | ||
|
|
||
| val add_issues : t -> Issue.t list -> t | ||
| (** Add multiple issues to the result *) | ||
|
|
||
| val get_issues : t -> Issue.t list | ||
| (** Get all issues in order they were added *) | ||
|
|
||
| val issue_count : t -> int | ||
| (** Count of issues *) | ||
|
|
||
| (** {2 Issue constructors} *) | ||
|
|
||
| val make_dead_issue : | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -90,19 +90,17 @@ let collect_export_locations ~state ~config ~do_gentype = | |
| ({cd_attributes; cd_loc; cd_args} : | ||
| Typedtree.constructor_declaration) | ||
| -> | ||
| let _process_inline_records = | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. DCE: dropped inline record bindings. |
||
| match cd_args with | ||
| | Cstr_record flds -> | ||
| List.iter | ||
| (fun ({ld_attributes; ld_loc} : Typedtree.label_declaration) | ||
| -> | ||
| toplevel_attrs @ cd_attributes @ ld_attributes | ||
| |> process_attributes ~scope_default:!current_scope_default | ||
| ~state ~config ~do_gentype:false ~name:"" | ||
| ~pos:ld_loc.loc_start) | ||
| flds | ||
| | Cstr_tuple _ -> () | ||
| in | ||
| (match cd_args with | ||
| | Cstr_record flds -> | ||
| List.iter | ||
| (fun ({ld_attributes; ld_loc} : Typedtree.label_declaration) | ||
| -> | ||
| toplevel_attrs @ cd_attributes @ ld_attributes | ||
| |> process_attributes ~scope_default:!current_scope_default | ||
| ~state ~config ~do_gentype:false ~name:"" | ||
| ~pos:ld_loc.loc_start) | ||
| flds | ||
| | Cstr_tuple _ -> ()); | ||
| toplevel_attrs @ cd_attributes | ||
| |> process_attributes ~scope_default:!current_scope_default ~state | ||
| ~config ~do_gentype:false ~name:"" ~pos:cd_loc.loc_start) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,13 +15,6 @@ val of_frozen : Cross_file_items.t -> t | |
| val of_reactive : (string, Cross_file_items.t) Reactive.t -> t | ||
| (** Wrap reactive collection directly (no intermediate collection) *) | ||
|
|
||
| val iter_optional_arg_calls : | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. DCE: hid item store iterators. |
||
| t -> (Cross_file_items.optional_arg_call -> unit) -> unit | ||
| (** Iterate over all optional arg calls *) | ||
|
|
||
| val iter_function_refs : t -> (Cross_file_items.function_ref -> unit) -> unit | ||
| (** Iterate over all function refs *) | ||
|
|
||
| val compute_optional_args_state : | ||
| t -> | ||
| find_decl:(Lexing.position -> Decl.t option) -> | ||
|
|
||
This file was deleted.
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.
DCE-confirmed cleanup: removed unused reactive exports. Covers reactive.mli too.