From: Russ Cox
Date: Mon, 31 Jul 2023 18:01:00 +0000 (-0400)
Subject: doc/go_mem: explain arrays, structs, and complex numbers
X-Git-Tag: go1.22rc1~1468
X-Git-Url: http://www.git.cypherpunks.ru/?a=commitdiff_plain;h=977e23a70766f8d0801e43bbfb68136bf54a84b7;p=gostls13.git
doc/go_mem: explain arrays, structs, and complex numbers
Arrays, structs, and complex numbers are collections of values that
are handled separately by the memory model.
An earlier version may have said this, but the current version does not.
Say it.
Change-Id: If3928bed6659e58e688f88aa0dde05423cbb3820
Reviewed-on: https://go-review.googlesource.com/c/go/+/514476
Run-TryBot: Russ Cox
TryBot-Result: Gopher Robot
Reviewed-by: Matthew Dempsky
Reviewed-by: Ian Lance Taylor
---
diff --git a/doc/go_mem.html b/doc/go_mem.html
index 661e1e781c..e0a7539472 100644
--- a/doc/go_mem.html
+++ b/doc/go_mem.html
@@ -221,7 +221,7 @@ for programs that do contain races.
-First, any implementation can, upon detecting a data race,
+Any implementation can, upon detecting a data race,
report the race and halt execution of the program.
Implementations using ThreadSanitizer
(accessed with âgo
build
-race
â)
@@ -229,7 +229,18 @@ do exactly this.
-Otherwise, a read r of a memory location x
+A read of an array, struct, or complex number
+may by implemented as a read of each individual sub-value
+(array element, struct field, or real/imaginary component),
+in any order.
+Similarly, a write of an array, struct, or complex number
+may be implemented as a write of each individual sub-value,
+in any order.
+
+
+
+A read r of a memory location x
+holding a value
that is not larger than a machine word must observe
some write w such that r does not happen before w
and there is no write w' such that w happens before w'