x86/x86asm: make x86asm.Decode thread-safe

Moves initialization of the decoderCover variable from happening
unconditionally to only being initialized by the test code using it so
that it does not cause a data race when not being used and Decode is
called in parallel.

Fixes golang/go#33532

Change-Id: I64d748f94d135f0c1f55f1456ff770ac5205c85a
GitHub-Last-Rev: 679e78ed1daf3ddbd03792155e3be90b7b498fc4
GitHub-Pull-Request: golang/arch#4
Reviewed-on: https://go-review.googlesource.com/c/arch/+/189919
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2 files changed
tree: 89518b4990f7bfa71324750038198ed584ecea5d
  1. arm/
  2. arm64/
  3. ppc64/
  4. vendor/
  5. x86/
  6. AUTHORS
  7. codereview.cfg
  8. CONTRIBUTING.md
  9. CONTRIBUTORS
  10. go.mod
  11. go.sum
  12. LICENSE
  13. PATENTS
  14. README.md
README.md

arch

This repository holds machine architecture information used by the Go toolchain. The parts needed in the main Go repository are copied in.

This repository requires Go 1.5+ with the vendor experiment enabled.