Two-phase configuration: freeze point and analysis-phase getters#1993
Two-phase configuration: freeze point and analysis-phase getters#1993
Conversation
Agent-Logs-Url: https://github.com/goblint/analyzer/sessions/e7f71803-86c8-4b4a-a4cc-78b9bce5ae4b Co-authored-by: michael-schwarz <13812333+michael-schwarz@users.noreply.github.com>
|
@copilot. This does not address the core issue, the problem is when values are used before the configuration has been built. So there should be two get functions, one for value to be used in the analysis, and one for getting values during building. If a value is modified after a call to the get variant for analysis, an exception should be raised. |
…-error detection Agent-Logs-Url: https://github.com/goblint/analyzer/sessions/1ccb990f-d34c-4830-a4fe-3127d58dabd4 Co-authored-by: michael-schwarz <13812333+michael-schwarz@users.noreply.github.com>
Agent-Logs-Url: https://github.com/goblint/analyzer/sessions/1ccb990f-d34c-4830-a4fe-3127d58dabd4 Co-authored-by: michael-schwarz <13812333+michael-schwarz@users.noreply.github.com>
Done in commit
Example: if privatization code calls |
|
@copilot: The tracking need not be per attribute. |
…ttribute hashtable Agent-Logs-Url: https://github.com/goblint/analyzer/sessions/1445f474-579c-45c1-ae37-d8bd066195d7 Co-authored-by: michael-schwarz <13812333+michael-schwarz@users.noreply.github.com>
Done in commit |
Config reads during
AfterConfig.run()(e.g. privatization module construction) see stale values because the autotuner runs afterward and modifies config. This introduces a two-phase configuration mechanism to separate config-building from analysis.Changes
src/config/gobConfig.mlfrozen : bool refflag andis_frozen ()/freeze ()functions —freeze ()permanently prevents furtherset_*callsanalysis_read : bool refflag — set totrueonce anyget_*_analysiscall is made; once set, anyset_*call raisesUsedForAnalysisexception UsedForAnalysis of string— raised by anyset_*call ifanalysis_readis set, making configuration timing errors immediately visibleget_int_analysis,get_bool_analysis,get_string_analysis,get_list_analysis,get_string_list_analysisclear_analysis_reads ()— resets theanalysis_readflag; called automatically bywith_immutable_confon exit so that server-mode config changes between analysis runs continue to worksrc/goblint.mlGobConfig.freeze ()after all config modifications (AutoSoundConfig+AutoTune.chooseConfig) and beforedo_analyzeHow it catches bugs
Analysis code should use
get_*_analysisinstead ofget_*for reads whose results feed into the analysis. Once any such call is made, all subsequentset_*calls raiseUsedForAnalysis, pinpointing the timing error immediately rather than silently producing wrong results.Server mode
freeze ()is only called in the non-server path. Server mode continues usingwith_immutable_conftemporarily per analysis run, which now also callsclear_analysis_reads ()on exit so that inter-run config changes viaset_*are not blocked by reads from the previous run.