diff --git a/src/compiler/compilationCache.ml b/src/compiler/compilationCache.ml index e871480be51..9d3d4d2300a 100644 --- a/src/compiler/compilationCache.ml +++ b/src/compiler/compilationCache.ml @@ -88,11 +88,11 @@ class context_cache (index : int) (sign : Digest.t) = object(self) | _ -> let writer = HxbWriter.create config (Some string_pool) warn anon_identification in HxbWriter.write_module writer m; - + let chunks = HxbWriter.get_chunks writer in Hashtbl.replace binary_cache path { mc_path = path; mc_id = m.m_id; - mc_chunks = HxbWriter.get_chunks writer; + mc_chunks = chunks; mc_extra = { m.m_extra with m_cache_state = MSGood; m_display_deps = None } } diff --git a/src/compiler/hxb/hxbReader.ml b/src/compiler/hxb/hxbReader.ml index c7993abacf1..9cd365940fa 100644 --- a/src/compiler/hxb/hxbReader.ml +++ b/src/compiler/hxb/hxbReader.ml @@ -181,19 +181,13 @@ class hxb_reader method set_delayed_field_loading f = delayed_field_loading <- f :: delayed_field_loading - method add_dependency mdep = - match current_module.m_extra.m_display_deps with - | Some deps -> - if mdep != null_module && (current_module.m_path != mdep.m_path || current_module.m_extra.m_sign != mdep.m_extra.m_sign) then - current_module.m_extra.m_display_deps <- Some (PMap.add mdep.m_id ({md_sign = mdep.m_extra.m_sign; md_path = mdep.m_path; md_kind = mdep.m_extra.m_kind; md_origin = MDepFromTyping}) deps) - | None -> die "" __LOC__ - method resolve_type pack mname tname = try let mt = api#resolve_type pack mname tname in if not full_restore then begin - let tinfos = t_infos mt in - self#add_dependency tinfos.mt_module; + let mdep = (t_infos mt).mt_module in + if mdep != null_module && (current_module.m_path != mdep.m_path || current_module.m_extra.m_sign != mdep.m_extra.m_sign) then + current_module.m_extra.m_display_deps <- Some (PMap.add mdep.m_id (create_dependency mdep MDepFromTyping) (Option.get current_module.m_extra.m_display_deps)) end; mt with Not_found -> @@ -1947,15 +1941,13 @@ class hxb_reader if not full_restore then begin let r = ref (lazy_processing t_dynamic) in r := lazy_wait (fun() -> - begin match delayed_field_loading with - | [] -> () - | f :: [] -> + let rec loop = function + | [] -> [] + | f :: l -> f(); - delayed_field_loading <- [] - | l -> - List.iter (fun f -> f()) l; - delayed_field_loading <- [] - end; + loop l + in + delayed_field_loading <- loop delayed_field_loading; cf.cf_type ); cf.cf_type <- TLazy r; diff --git a/src/core/tFunctions.ml b/src/core/tFunctions.ml index 04dc04499b5..3073a4fcf98 100644 --- a/src/core/tFunctions.ml +++ b/src/core/tFunctions.ml @@ -303,13 +303,16 @@ let null_abstract = { a_enum = false; } +let create_dependency mdep origin = + {md_sign = mdep.m_extra.m_sign; md_path = mdep.m_path; md_kind = mdep.m_extra.m_kind; md_origin = origin} + let add_dependency ?(skip_postprocess=false) m mdep = function (* These module dependency origins should not add as a dependency *) | MDepFromMacroInclude -> () | origin -> if m != null_module && mdep != null_module && (m.m_path != mdep.m_path || m.m_extra.m_sign != mdep.m_extra.m_sign) then begin - m.m_extra.m_deps <- PMap.add mdep.m_id ({md_sign = mdep.m_extra.m_sign; md_path = mdep.m_path; md_kind = mdep.m_extra.m_kind; md_origin = origin}) m.m_extra.m_deps; + m.m_extra.m_deps <- PMap.add mdep.m_id (create_dependency mdep origin) m.m_extra.m_deps; (* In case the module is cached, we'll have to run post-processing on it again (issue #10635) *) if not skip_postprocess then m.m_extra.m_processed <- 0 end