123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384[%%import"debug.mlh"]openCore(* All [assert]s and other checks throughout the code are guarded by [if debug]. The
DEBUG variable is set in the lib [incremental] and unset in the lib
[incremental_debug], but apart from that they are identical. Tests are run with both
the production and debug lib, and users can choose to build with the debug library, if
they suspect they found a bug in incremental. *)[%%ifJSC_DEBUG]letdebug=true[%%else]letdebug=false[%%endif]letconcat=String.concatlettagnameasexp_of_a=(name,a)|>[%sexp_of:string*a]moduleStep_function=Incremental_step_functionmoduleTime_ns=structincludeTime_nsletsexp_of_t=Time_ns.Alternate_sexp.sexp_of_tendmoduleArray=structincludeArray(* Not defining aliases in production mode, since they break type specialization of
array accesses. *)[%%ifJSC_DEBUG]letunsafe_get=getletunsafe_set=set[%%endif](* Requires [len >= length t]. *)letrealloct~lena=letnew_t=create~lenainArray.blit~src:t~src_pos:0~dst:new_t~dst_pos:0~len:(lengtht);new_t;;endmoduleUopt=structincludeUoptletunsafe_value=ifdebugthenvalue_exnelseunsafe_valueendmoduleUniform_array=structincludeUniform_array[%%ifJSC_DEBUG]letunsafe_get=getletunsafe_set=set_with_caml_modify[%%else](* Uniform_array is being "smart" by checking if elements are integers, but Uopt.t
almost never contain integers, so the extra check to make generated code harder to
read and potentially slower. *)letunsafe_set=unsafe_set_with_caml_modifyletset=set_with_caml_modify[%%endif](* Requires [len >= length t]. *)letrealloct~len=letnew_t=create~lenUopt.noneinblit~src:t~src_pos:0~dst:new_t~dst_pos:0~len:(lengtht);new_t;;endmoduleAlarm_precision=Timing_wheel.Alarm_precision