aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchainhelen <chainhelen@gmail.com>2020-09-08 03:36:19 +0000
committerAustin Clements <austin@google.com>2020-09-08 15:07:20 +0000
commit565ad134c994b7a831e1bea336fdc64f0aeefc85 (patch)
tree6daab5ba52b4a5fa82f75c0eb3674a6f3ec8389d
parentf98f3b0c306634e850975c5972ceb8519404edae (diff)
downloadgo-565ad134c994b7a831e1bea336fdc64f0aeefc85.tar.gz
go-565ad134c994b7a831e1bea336fdc64f0aeefc85.zip
runtime: make PCDATA_RegMapUnsafe more clear and remove magic number
Change-Id: Ibf3ee755c3fbec03a9396840dc92ce148c49d9f7 GitHub-Last-Rev: 945d8aaa136003dc381c6aa48bff9ea7ca2c6991 GitHub-Pull-Request: golang/go#41262 Reviewed-on: https://go-review.googlesource.com/c/go/+/253377 Reviewed-by: Austin Clements <austin@google.com> Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
-rw-r--r--src/cmd/internal/objabi/funcdata.go2
-rw-r--r--src/runtime/debugcall.go2
-rw-r--r--src/runtime/preempt.go2
-rw-r--r--src/runtime/symtab.go3
4 files changed, 6 insertions, 3 deletions
diff --git a/src/cmd/internal/objabi/funcdata.go b/src/cmd/internal/objabi/funcdata.go
index d5bacb5900..c9480bf2f0 100644
--- a/src/cmd/internal/objabi/funcdata.go
+++ b/src/cmd/internal/objabi/funcdata.go
@@ -35,7 +35,7 @@ const (
// PCDATA_RegMapIndex values.
//
// Only if !go115ReduceLiveness.
- PCDATA_RegMapUnsafe = -2 // Unsafe for async preemption
+ PCDATA_RegMapUnsafe = PCDATA_UnsafePointUnsafe // Unsafe for async preemption
// PCDATA_UnsafePoint values.
PCDATA_UnsafePointSafe = -1 // Safe for async preemption
diff --git a/src/runtime/debugcall.go b/src/runtime/debugcall.go
index 6c285ec829..b5480c73ae 100644
--- a/src/runtime/debugcall.go
+++ b/src/runtime/debugcall.go
@@ -87,7 +87,7 @@ func debugCallCheck(pc uintptr) string {
pcdata = 0 // in prologue
}
stkmap := (*stackmap)(funcdata(f, _FUNCDATA_RegPointerMaps))
- if pcdata == -2 || stkmap == nil {
+ if pcdata == _PCDATA_RegMapUnsafe || stkmap == nil {
// Not at a safe point.
ret = debugCallUnsafePoint
return
diff --git a/src/runtime/preempt.go b/src/runtime/preempt.go
index 761856576a..17ef2c90d3 100644
--- a/src/runtime/preempt.go
+++ b/src/runtime/preempt.go
@@ -406,7 +406,7 @@ func isAsyncSafePoint(gp *g, pc, sp, lr uintptr) (bool, uintptr) {
var startpc uintptr
if !go115ReduceLiveness {
smi := pcdatavalue(f, _PCDATA_RegMapIndex, pc, nil)
- if smi == -2 {
+ if smi == _PCDATA_RegMapUnsafe {
// Unsafe-point marked by compiler. This includes
// atomic sequences (e.g., write barrier) and nosplit
// functions (except at calls).
diff --git a/src/runtime/symtab.go b/src/runtime/symtab.go
index ddb5ea82b4..fa8d17035e 100644
--- a/src/runtime/symtab.go
+++ b/src/runtime/symtab.go
@@ -284,6 +284,9 @@ const (
)
const (
+ // Only if !go115ReduceLiveness.
+ _PCDATA_RegMapUnsafe = _PCDATA_UnsafePointUnsafe // Unsafe for async preemption
+
// PCDATA_UnsafePoint values.
_PCDATA_UnsafePointSafe = -1 // Safe for async preemption
_PCDATA_UnsafePointUnsafe = -2 // Unsafe for async preemption