internal/core/runtime: add lock protection to loaded map
The Runtime.loaded map was accessed without synchronization, causing
data races when Value.Syntax() calls BuildData() while other goroutines
call SetBuildData().
Fix by adding index.lock protection to SetBuildData and BuildData,
matching the pattern already used for imports, importsByPath, and
importsByBuild maps in the same index.
Updates #2733
Signed-off-by: Marcel van Lohuizen <mpvl@gmail.com>
Change-Id: I457d62b1ba70676042a9339bee85d606a0417933
Reviewed-on: https://cue.gerrithub.io/c/cue-lang/cue/+/1230713
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
Reviewed-by: Roger Peppe <rogpeppe@gmail.com>