Skip to content

Commit 565ad13

Browse files
chainhelenaclements
authored andcommitted
runtime: make PCDATA_RegMapUnsafe more clear and remove magic number
Change-Id: Ibf3ee755c3fbec03a9396840dc92ce148c49d9f7 GitHub-Last-Rev: 945d8aa GitHub-Pull-Request: #41262 Reviewed-on: https://go-review.googlesource.com/c/go/+/253377 Reviewed-by: Austin Clements <[email protected]> Run-TryBot: Austin Clements <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
1 parent f98f3b0 commit 565ad13

File tree

4 files changed

+6
-3
lines changed

4 files changed

+6
-3
lines changed

src/cmd/internal/objabi/funcdata.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const (
3535
// PCDATA_RegMapIndex values.
3636
//
3737
// Only if !go115ReduceLiveness.
38-
PCDATA_RegMapUnsafe = -2 // Unsafe for async preemption
38+
PCDATA_RegMapUnsafe = PCDATA_UnsafePointUnsafe // Unsafe for async preemption
3939

4040
// PCDATA_UnsafePoint values.
4141
PCDATA_UnsafePointSafe = -1 // Safe for async preemption

src/runtime/debugcall.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ func debugCallCheck(pc uintptr) string {
8787
pcdata = 0 // in prologue
8888
}
8989
stkmap := (*stackmap)(funcdata(f, _FUNCDATA_RegPointerMaps))
90-
if pcdata == -2 || stkmap == nil {
90+
if pcdata == _PCDATA_RegMapUnsafe || stkmap == nil {
9191
// Not at a safe point.
9292
ret = debugCallUnsafePoint
9393
return

src/runtime/preempt.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ func isAsyncSafePoint(gp *g, pc, sp, lr uintptr) (bool, uintptr) {
406406
var startpc uintptr
407407
if !go115ReduceLiveness {
408408
smi := pcdatavalue(f, _PCDATA_RegMapIndex, pc, nil)
409-
if smi == -2 {
409+
if smi == _PCDATA_RegMapUnsafe {
410410
// Unsafe-point marked by compiler. This includes
411411
// atomic sequences (e.g., write barrier) and nosplit
412412
// functions (except at calls).

src/runtime/symtab.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,9 @@ const (
284284
)
285285

286286
const (
287+
// Only if !go115ReduceLiveness.
288+
_PCDATA_RegMapUnsafe = _PCDATA_UnsafePointUnsafe // Unsafe for async preemption
289+
287290
// PCDATA_UnsafePoint values.
288291
_PCDATA_UnsafePointSafe = -1 // Safe for async preemption
289292
_PCDATA_UnsafePointUnsafe = -2 // Unsafe for async preemption

0 commit comments

Comments
 (0)