Commit 14c8143c authored by Keith Randall's avatar Keith Randall

runtime: fix gogetcallerpc.

Make assembly govet-clean.
Clean up fixes for CL 93380044.

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/107160047
parent b559392e
......@@ -782,9 +782,9 @@ TEXT runtime·getcallerpc(SB),NOSPLIT,$0-4
RET
TEXT runtime·gogetcallerpc(SB),NOSPLIT,$0-8
MOVL x+0(FP),AX // addr of first arg
MOVL p+0(FP),AX // addr of first arg
MOVL -4(AX),AX // get calling pc
MOVL AX, r+4(FP)
MOVL AX, ret+4(FP)
RET
TEXT runtime·setcallerpc(SB),NOSPLIT,$0-8
......
......@@ -858,10 +858,10 @@ TEXT runtime·getcallerpc(SB),NOSPLIT,$0-8
MOVQ -8(AX),AX // get calling pc
RET
TEXT runtime·gogetcallerpc(SB),NOSPLIT,$0-8
MOVQ x+0(FP),AX // addr of first arg
TEXT runtime·gogetcallerpc(SB),NOSPLIT,$0-16
MOVQ p+0(FP),AX // addr of first arg
MOVQ -8(AX),AX // get calling pc
MOVQ AX,r+4(FP)
MOVQ AX,ret+8(FP)
RET
TEXT runtime·setcallerpc(SB),NOSPLIT,$0-16
......
......@@ -664,9 +664,9 @@ TEXT runtime·getcallerpc(SB),NOSPLIT,$0-8
RET
TEXT runtime·gogetcallerpc(SB),NOSPLIT,$0-8
MOVL x+0(FP),AX // addr of first arg
MOVL p+0(FP),AX // addr of first arg
MOVL -8(AX),AX // get calling pc
MOVL AX, r+4(FP)
MOVL AX, ret+4(FP)
RET
TEXT runtime·setcallerpc(SB),NOSPLIT,$0-16
......@@ -686,7 +686,7 @@ TEXT runtime·cputicks(SB),NOSPLIT,$0-0
ADDQ DX, AX
RET
TEXT runtime·stackguard(SB),NOSPLIT,$0-16
TEXT runtime·stackguard(SB),NOSPLIT,$0-8
MOVL SP, DX
MOVL DX, sp+0(FP)
get_tls(CX)
......
......@@ -561,7 +561,7 @@ TEXT runtime·getcallerpc(SB),NOSPLIT,$-4-4
RET
TEXT runtime·gogetcallerpc(SB),NOSPLIT,$-4-8
MOVW R14, 4(FP)
MOVW R14, ret+4(FP)
RET
TEXT runtime·setcallerpc(SB),NOSPLIT,$-4-8
......
......@@ -143,15 +143,19 @@ func slicerunetostring(a []rune) string {
return s[:size2]
}
type stringStruct struct {
str *byte
len int
}
func cstringToGo(str uintptr) (s string) {
// Note: we need i to be the same type as _string.len and to start at 0.
i := _string{}.len
i := 0
for ; ; i++ {
if *(*byte)(unsafe.Pointer(str + uintptr(i))) == 0 {
break
}
}
t := (*_string)(unsafe.Pointer(&s))
t := (*stringStruct)(unsafe.Pointer(&s))
t.str = (*byte)(unsafe.Pointer(str))
t.len = i
return
......
......@@ -19,9 +19,8 @@ package runtime
// out to only NOSPLIT functions (recursively).
// 2) Functions should not block.
// During conversion, we can still call out to splittable
// functions. But once conversion is done the invariants
// above should hold.
// These invariants do not hold yet but will be established once we have
// finished converting runtime support code from C to Go.
#pragma textflag NOSPLIT
func rawstring(size intgo) (s String, b Slice) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment