Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file types.ml
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659(* This module has a giant [module rec] defining all the mutually recursive types used
in the implementation. The definition of each type is then repeated in its file;
comments belong there, not here.
We put just enough sexp converters here to display node ids. The detailed sexp
converters are generated via [with sexp] in the individual files. Defining the sexp
converters outside of the [module rec] makes it impossible to accidentally introduce a
sexp converter that would try to produce an infinite sexp.
*)openCore_kernelopenImportmodulerecAdjust_heights_heap:sigtypet={mutablelength:int;mutableheight_lower_bound:int;mutablemax_height_seen:int;mutablenodes_by_height:Node.Packed.tUopt.tarray}end=Adjust_heights_heapandAlarm:sigtypet=Alarm_value.tTiming_wheel.Alarm.tend=AlarmandAlarm_value:sigmoduleAction:sigtypet=|AtofAt.t|At_intervalsofAt_intervals.t|Snapshot:_Snapshot.t->t|Step_function:_Step_function_node.t->tendtypet={action:Action.t;mutablenext_fired:tUopt.t}end=Alarm_valueandArray_fold:sigtype('a,'acc)t={init:'acc;f:'acc->'a->'acc;children:'aNode.tarray}end=Array_foldandAt:sigtypet={main:Before_or_after.tNode.t;at:Time_ns.t;mutablealarm:Alarm.t;clock:Clock.t}end=AtandAt_intervals:sigtypet={main:unitNode.t;base:Time_ns.t;interval:Time_ns.Span.t;mutablealarm:Alarm.t;clock:Clock.t}end=At_intervalsandBind:sigtype('a,'b)t={main:'bNode.t;mutablef:'a->'bNode.t;lhs:'aNode.t;lhs_change:unitNode.t;mutablerhs:'bNode.tUopt.t;mutablerhs_scope:Scope.t;mutableall_nodes_created_on_rhs:Node.Packed.tUopt.t}end=BindandClock:sigtypet={timing_wheel:Alarm_value.tTiming_wheel.t;now:Time_ns.tVar.t;handle_fired:Alarm.t->unit;mutablefired_alarm_values:Alarm_value.tUopt.t}end=ClockandExpert:sigtype'aedge={child:'aNode.t;on_change:'a->unit;mutableindex:intUopt.t}typepacked_edge=E:'aedge->packed_edge[@@unboxed]type'at={f:unit->'a;on_observability_change:is_now_observable:bool->unit;mutablechildren:packed_edgeUopt.tArray.t;mutablenum_children:int;mutableforce_stale:bool;mutablenum_invalid_children:int;mutablewill_fire_all_callbacks:bool}end=ExpertandFreeze:sigtype'at={main:'aNode.t;child:'aNode.t;only_freeze_when:'a->bool}end=FreezeandIf_then_else:sigtype'at={main:'aNode.t;test:boolNode.t;test_change:unitNode.t;mutablecurrent_branch:'aNode.tUopt.t;then_:'aNode.t;else_:'aNode.t}end=If_then_elseandInternal_observer:sigmoduleState:sigtypet=|Created|In_use|Disallowed|Unlinkedendtype'at={mutablestate:State.t;observing:'aNode.t;mutableon_update_handlers:'aOn_update_handler.tlist;mutableprev_in_all:Internal_observer.Packed.tUopt.t;mutablenext_in_all:Internal_observer.Packed.tUopt.t;mutableprev_in_observing:'atUopt.t;mutablenext_in_observing:'atUopt.t}type'ainternal_observer='atmodulePacked:sigtypet=T:_internal_observer->t[@@unboxed]endend=Internal_observerandJoin:sigtype'at={main:'aNode.t;lhs:'aNode.tNode.t;lhs_change:unitNode.t;mutablerhs:'aNode.tUopt.t}end=JoinandKind:sigtype'at=|Array_fold:(_,'a)Array_fold.t->'at|At:At.t->Before_or_after.tt|At_intervals:At_intervals.t->unitt|Bind_lhs_change:(_,_)Bind.t->unitt|Bind_main:(_,'a)Bind.t->'at|Constof'a|Expertof'aExpert.t|Freezeof'aFreeze.t|If_test_change:_If_then_else.t->unitt|If_then_elseof'aIf_then_else.t|Invalid|Join_lhs_change:_Join.t->unitt|Join_mainof'aJoin.t|Map:('a1->'a)*'a1Node.t->'at|Snapshotof'aSnapshot.t|Step_functionof'aStep_function_node.t|Uninitialized|Unordered_array_fold:(_,'a)Unordered_array_fold.t->'at|Varof'aVar.t|Map2:('a1->'a2->'a)*'a1Node.t*'a2Node.t->'at|Map3:('a1->'a2->'a3->'a)*'a1Node.t*'a2Node.t*'a3Node.t->'at|Map4:('a1->'a2->'a3->'a4->'a)*'a1Node.t*'a2Node.t*'a3Node.t*'a4Node.t->'at|Map5:('a1->'a2->'a3->'a4->'a5->'a)*'a1Node.t*'a2Node.t*'a3Node.t*'a4Node.t*'a5Node.t->'at|Map6:('a1->'a2->'a3->'a4->'a5->'a6->'a)*'a1Node.t*'a2Node.t*'a3Node.t*'a4Node.t*'a5Node.t*'a6Node.t->'at|Map7:('a1->'a2->'a3->'a4->'a5->'a6->'a7->'a)*'a1Node.t*'a2Node.t*'a3Node.t*'a4Node.t*'a5Node.t*'a6Node.t*'a7Node.t->'at|Map8:('a1->'a2->'a3->'a4->'a5->'a6->'a7->'a8->'a)*'a1Node.t*'a2Node.t*'a3Node.t*'a4Node.t*'a5Node.t*'a6Node.t*'a7Node.t*'a8Node.t->'at|Map9:('a1->'a2->'a3->'a4->'a5->'a6->'a7->'a8->'a9->'a)*'a1Node.t*'a2Node.t*'a3Node.t*'a4Node.t*'a5Node.t*'a6Node.t*'a7Node.t*'a8Node.t*'a9Node.t->'at|Map10:('a1->'a2->'a3->'a4->'a5->'a6->'a7->'a8->'a9->'a10->'a)*'a1Node.t*'a2Node.t*'a3Node.t*'a4Node.t*'a5Node.t*'a6Node.t*'a7Node.t*'a8Node.t*'a9Node.t*'a10Node.t->'at|Map11:('a1->'a2->'a3->'a4->'a5->'a6->'a7->'a8->'a9->'a10->'a11->'a)*'a1Node.t*'a2Node.t*'a3Node.t*'a4Node.t*'a5Node.t*'a6Node.t*'a7Node.t*'a8Node.t*'a9Node.t*'a10Node.t*'a11Node.t->'at|Map12:('a1->'a2->'a3->'a4->'a5->'a6->'a7->'a8->'a9->'a10->'a11->'a12->'a)*'a1Node.t*'a2Node.t*'a3Node.t*'a4Node.t*'a5Node.t*'a6Node.t*'a7Node.t*'a8Node.t*'a9Node.t*'a10Node.t*'a11Node.t*'a12Node.t->'at|Map13:('a1->'a2->'a3->'a4->'a5->'a6->'a7->'a8->'a9->'a10->'a11->'a12->'a13->'a)*'a1Node.t*'a2Node.t*'a3Node.t*'a4Node.t*'a5Node.t*'a6Node.t*'a7Node.t*'a8Node.t*'a9Node.t*'a10Node.t*'a11Node.t*'a12Node.t*'a13Node.t->'at|Map14:('a1->'a2->'a3->'a4->'a5->'a6->'a7->'a8->'a9->'a10->'a11->'a12->'a13->'a14->'a)*'a1Node.t*'a2Node.t*'a3Node.t*'a4Node.t*'a5Node.t*'a6Node.t*'a7Node.t*'a8Node.t*'a9Node.t*'a10Node.t*'a11Node.t*'a12Node.t*'a13Node.t*'a14Node.t->'at|Map15:('a1->'a2->'a3->'a4->'a5->'a6->'a7->'a8->'a9->'a10->'a11->'a12->'a13->'a14->'a15->'a)*'a1Node.t*'a2Node.t*'a3Node.t*'a4Node.t*'a5Node.t*'a6Node.t*'a7Node.t*'a8Node.t*'a9Node.t*'a10Node.t*'a11Node.t*'a12Node.t*'a13Node.t*'a14Node.t*'a15Node.t->'atend=KindandNode:sigtype'at={id:Node_id.t;state:State.t;mutablerecomputed_at:Stabilization_num.t;mutablevalue_opt:'aUopt.t;mutablekind:'aKind.t;mutablecutoff:'aCutoff.t;mutablechanged_at:Stabilization_num.t;mutablenum_on_update_handlers:int;mutablenum_parents:int;mutableparent1_and_beyond:Node.Packed.tUopt.tarray;mutableparent0:Node.Packed.tUopt.t;mutablecreated_in:Scope.t;mutablenext_node_in_same_scope:Node.Packed.tUopt.t;mutableheight:int;mutableheight_in_recompute_heap:int;mutableprev_in_recompute_heap:Node.Packed.tUopt.t;mutablenext_in_recompute_heap:Node.Packed.tUopt.t;mutableheight_in_adjust_heights_heap:int;mutablenext_in_adjust_heights_heap:Node.Packed.tUopt.t;mutableold_value_opt:'aUopt.t;mutableobservers:'aInternal_observer.tUopt.t;mutableis_in_handle_after_stabilization:bool;mutableon_update_handlers:'aOn_update_handler.tlist;mutablemy_parent_index_in_child_at_index:intarray;mutablemy_child_index_in_parent_at_index:intarray;mutableforce_necessary:bool;mutableuser_info:Info.toption;creation_backtrace:Backtrace.toption}[@@derivingsexp_of]modulePacked:sigtype'anode='attypet=T:_node->t[@@derivingsexp_of][@@unboxed]endvalis_valid:_t->boolvalis_necessary:_t->boolvaltype_equal_if_phys_same:'at->'bt->('a,'b)Type_equal.toptionend=structinclude(Node:moduletypeofstructincludeNodeendwithmodulePacked:=Node.Packed)letsexp_of_t_t=concat["n";Node_id.to_stringt.id]|>[%sexp_of:string]modulePacked=structtype'anode='at[@@derivingsexp_of]typet=T:_node->t[@@unboxed]letsexp_of_t(Tt)=t|>[%sexp_of:_node]endletis_validt=matcht.kindwith|Invalid->false|_->true;;(* [is_necessary] is defined here because we need it before node.ml is available. It is
used during graph manipulation, and so is written with some care to be fast. *)letis_necessaryt=t.num_parents>0||Uopt.is_somet.observers||(matcht.kindwith|Freeze_->true|_->false)||t.force_necessary;;lett_is_injective(typeab)(T:(at,bt)Type_equal.t):(a,b)Type_equal.t=Tlettype_equal_if_phys_same(typeab)(t1:at)(t2:bt)=(* This is type-safe assuming no one can give the same incremental node two different
types. This is true because the field [mutable old_value_opt : 'a option] prevents
both subtyping and parameteric polymorphism. But this allows to break
abstractions, as in someone could write:
{[
type t
type u (* = t underneath *)
val create : unit -> t Incr.t * u Incr.t (* the two incrementals are phys_equal *)
]}
and we would figure out that type t = u. However, we could add a Type_equal.Id to
nodes and do the same, so it seems to be a more general issue. *)ifphys_samet1t2thenSome(t_is_injective(Obj.magic(T:_Type_equal.t):(at,bt)Type_equal.t))elseNone;;endandObserver:sigtype'at='aInternal_observer.trefend=ObserverandOnly_in_debug:sigtypet={mutablecurrently_running_node:Node.Packed.toption;mutableexpert_nodes_created_by_current_node:Node.Packed.tlist}end=Only_in_debugandPacked_weak_hashtbl:sigtypet=T:(_,_)Weak_hashtbl.t->tend=Packed_weak_hashtblandRecompute_heap:sigtypet={mutablelength:int;mutableheight_lower_bound:int;mutablenodes_by_height:Node.Packed.tUopt.tarray}end=Recompute_heapandRun_on_update_handlers:sigtypet=T:'aNode.t*'aOn_update_handler.Node_update.t->tend=Run_on_update_handlersandScope:sigtypet=|Top|Bind:(_,_)Bind.t->t[@@derivingsexp_of]end=structtypet=|Top|Bind:(_,_)Bind.t->tletsexp_of_t=function|Top->"Top"|>[%sexp_of:string]|Bindbind->bind.main|>[%sexp_of:_Node.t];;endandSnapshot:sigtype'at={main:'aNode.t;at:Time_ns.t;before:'a;value_at:'aNode.t;clock:Clock.t}end=SnapshotandState:sigtypet={mutablestatus:Status.t;bind_lhs_change_should_invalidate_rhs:bool;mutablestabilization_num:Stabilization_num.t;mutablecurrent_scope:Scope.t;recompute_heap:Recompute_heap.t;adjust_heights_heap:Adjust_heights_heap.t;propagate_invalidity:Node.Packed.tStack.t;mutablenum_active_observers:int;mutableall_observers:Internal_observer.Packed.tUopt.t;finalized_observers:Internal_observer.Packed.tThread_safe_queue.t;new_observers:Internal_observer.Packed.tStack.t;disallowed_observers:Internal_observer.Packed.tStack.t;set_during_stabilization:Var.Packed.tStack.t;handle_after_stabilization:Node.Packed.tStack.t;run_on_update_handlers:Run_on_update_handlers.tStack.t;mutableonly_in_debug:Only_in_debug.t;weak_hashtbls:Packed_weak_hashtbl.tThread_safe_queue.t;mutablekeep_node_creation_backtrace:bool;mutablenum_nodes_became_necessary:int;mutablenum_nodes_became_unnecessary:int;mutablenum_nodes_changed:int;mutablenum_nodes_created:int;mutablenum_nodes_invalidated:int;mutablenum_nodes_recomputed:int;mutablenum_nodes_recomputed_directly_because_one_child:int;mutablenum_nodes_recomputed_directly_because_min_height:int;mutablenum_var_sets:int}end=StateandStatus:sigtypet=|Stabilizing|Running_on_update_handlers|Not_stabilizing|Stabilize_previously_raisedofRaised_exn.tend=StatusandStep_function_node:sigtype'at={main:'aNode.t;mutablechild:'aStep_function.tNode.tUopt.t;mutableextracted_step_function_from_child_at:Stabilization_num.t;mutablevalue:'aUopt.t;mutableupcoming_steps:(Time_ns.t*'a)Sequence.t;mutablealarm:Alarm.t;mutablealarm_value:Alarm_value.t;clock:Clock.t}end=Step_function_nodeandUnordered_array_fold:sigtype('a,'acc)t={main:'accNode.t;init:'acc;f:'acc->'a->'acc;update:'acc->old_value:'a->new_value:'a->'acc;full_compute_every_n_changes:int;children:'aNode.tarray;mutablefold_value:'accUopt.t;mutablenum_changes_since_last_full_compute:int}end=Unordered_array_foldandVar:sigtype'at={mutablevalue:'a;mutablevalue_set_during_stabilization:'aUopt.t;mutableset_at:Stabilization_num.t;watch:'aNode.t}type'avar:='atmodulePacked:sigtypet=T:_var->t[@@unboxed]endend=Var