aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/race.go
diff options
context:
space:
mode:
authorMichael Anthony Knyszek <mknyszek@google.com>2019-06-28 16:44:07 +0000
committerMichael Knyszek <mknyszek@google.com>2019-11-04 23:41:34 +0000
commit383b447e0da5bd1fcdc2439230b5a1d3e3402117 (patch)
treec1dafd5c18d1d2ddc09d51dc6892087e3f506411 /src/runtime/race.go
parent2566e21f243387156e8e7f2acad0ce14d9712bbc (diff)
downloadgo-383b447e0da5bd1fcdc2439230b5a1d3e3402117.tar.gz
go-383b447e0da5bd1fcdc2439230b5a1d3e3402117.zip
runtime: clean up power-of-two rounding code with align functions
This change renames the "round" function to the more appropriately named "alignUp" which rounds an integer up to the next multiple of a power of two. This change also adds the alignDown function, which is almost like alignUp but rounds down to the previous multiple of a power of two. With these two functions, we also go and replace manual rounding code with it where we can. Change-Id: Ie1487366280484dcb2662972b01b4f7135f72fec Reviewed-on: https://go-review.googlesource.com/c/go/+/190618 Reviewed-by: Austin Clements <austin@google.com> Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/runtime/race.go')
-rw-r--r--src/runtime/race.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/runtime/race.go b/src/runtime/race.go
index d11dc9b5bf..52c9bd8201 100644
--- a/src/runtime/race.go
+++ b/src/runtime/race.go
@@ -385,7 +385,7 @@ func raceinit() (gctx, pctx uintptr) {
if end < firstmoduledata.ebss {
end = firstmoduledata.ebss
}
- size := round(end-start, _PageSize)
+ size := alignUp(end-start, _PageSize)
racecall(&__tsan_map_shadow, start, size, 0, 0)
racedatastart = start
racedataend = start + size