Skip to content

Commit 19e6a40

Browse files
Tianhan Lufacebook-github-bot
authored andcommitted
Save / Load type environment without saving / loading dependency keys
Summary: The dependency keys (which are used for pyre incremental) are too large to be saved in the shared memory -- each value in a shared memory entry must not exceed 2 GB. Since Pysa does not use the dependency keys in any way, we can skip saving them into the shared memory. Reviewed By: alexkassil Differential Revision: D49068488 fbshipit-source-id: 0056099ee969decf2bcae3019b246c5a130d50ea
1 parent 61ea349 commit 19e6a40

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

source/analysis/typeEnvironment.ml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,4 +238,8 @@ let load configuration =
238238
CheckResultsTable.load configuration
239239

240240

241+
let store_without_dependency_keys = CheckResultsTable.store
242+
243+
let load_without_dependency_keys = CheckResultsTable.load
244+
241245
module TypeEnvironmentReadOnly = ReadOnly

source/analysis/typeEnvironment.mli

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,7 @@ val ast_environment : t -> AstEnvironment.t
5050
val module_tracker : t -> ModuleTracker.t
5151

5252
val populate_for_modules : scheduler:Scheduler.t -> t -> Ast.Reference.t list -> unit
53+
54+
val store_without_dependency_keys : t -> unit
55+
56+
val load_without_dependency_keys : EnvironmentControls.t -> t

source/interprocedural_analyses/taint/cache.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ let load_type_environment ~scheduler ~configuration =
223223
SaveLoadSharedMemory.exception_to_error
224224
~error:SharedMemoryStatus.TypeEnvironmentLoadError
225225
~message:"Loading type environment"
226-
~f:(fun () -> Ok (TypeEnvironment.load controls))
226+
~f:(fun () -> Ok (TypeEnvironment.load_without_dependency_keys controls))
227227
>>= fun type_environment ->
228228
let old_module_tracker =
229229
TypeEnvironment.ast_environment type_environment |> AstEnvironment.module_tracker
@@ -255,7 +255,7 @@ let save_type_environment ~scheduler ~configuration ~environment =
255255
Memory.SharedMemory.collect `aggressive;
256256
let module_tracker = TypeEnvironment.module_tracker environment in
257257
Interprocedural.ChangedPaths.save_current_paths ~scheduler ~configuration ~module_tracker;
258-
TypeEnvironment.store environment;
258+
TypeEnvironment.store_without_dependency_keys environment;
259259
Log.info "Saved type environment to cache shared memory.";
260260
Ok ())
261261

0 commit comments

Comments
 (0)