Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix race in creating new unassigned global
When a variable does not exist but we wish to acquire the GlobalVariable object for it, this logic will attempt to create a new GlobalVariable and add it to the map. Unfortunately it does this without any locking or atomicity, potentially overwriting a value written to the same name on a different thread. When the GlobalVariable returned by this method is cached, as it is in the JIT logic for global variable reads, it may never see updates because those writes are going to the winner of the race. This caused at least one set of specs, for Process.kill, to hang when the global variable used for indicating a signal had been damaged in this way. Instead we computeIfAbsent to ensure only one GlobalVariable will ever be inserted for this name.
- Loading branch information