runtime: remove the dummy arg of getcallersp
This is a port of https://golang.org/cl/109596 to the gofrontend, in preparation for updating libgo to 1.11. Original CL description: getcallersp is intrinsified, and so the dummy arg is no longer needed. Remove it, as well as a few dummy args that are solely to feed getcallersp. Reviewed-on: https://go-review.googlesource.com/131116 From-SVN: r263840
This commit is contained in:
parent
9ca2ac699a
commit
1d29bb0408
@ -1,4 +1,4 @@
|
|||||||
274c88df4d6f9360dcd657b6e069a3b5a1d37a90
|
8deaafd14414bb5cbbdf3e2673f61b6d836d7d2a
|
||||||
|
|
||||||
The first line of this file holds the git revision number of the last
|
The first line of this file holds the git revision number of the last
|
||||||
merge done from the gofrontend repository.
|
merge done from the gofrontend repository.
|
||||||
|
@ -9635,13 +9635,9 @@ Call_expression::do_lower(Gogo* gogo, Named_object* function,
|
|||||||
"__builtin_return_address",
|
"__builtin_return_address",
|
||||||
0);
|
0);
|
||||||
}
|
}
|
||||||
else if (this->args_ != NULL
|
else if ((this->args_ == NULL || this->args_->size() == 0)
|
||||||
&& this->args_->size() == 1
|
|
||||||
&& n == "getcallersp")
|
&& n == "getcallersp")
|
||||||
{
|
{
|
||||||
// The actual argument to getcallersp is always the
|
|
||||||
// address of a parameter; we don't need that for the
|
|
||||||
// GCC builtin function, so we just ignore it.
|
|
||||||
static Named_object* builtin_frame_address;
|
static Named_object* builtin_frame_address;
|
||||||
return this->lower_to_builtin(&builtin_frame_address,
|
return this->lower_to_builtin(&builtin_frame_address,
|
||||||
"__builtin_frame_address",
|
"__builtin_frame_address",
|
||||||
|
@ -47,7 +47,7 @@ func Cgocall() {
|
|||||||
mp := getg().m
|
mp := getg().m
|
||||||
mp.ncgocall++
|
mp.ncgocall++
|
||||||
mp.ncgo++
|
mp.ncgo++
|
||||||
entersyscall(0)
|
entersyscall()
|
||||||
mp.incgo = true
|
mp.incgo = true
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ func CgocallDone() {
|
|||||||
// If we are invoked because the C function called _cgo_panic,
|
// If we are invoked because the C function called _cgo_panic,
|
||||||
// then _cgo_panic will already have exited syscall mode.
|
// then _cgo_panic will already have exited syscall mode.
|
||||||
if readgstatus(gp)&^_Gscan == _Gsyscall {
|
if readgstatus(gp)&^_Gscan == _Gsyscall {
|
||||||
exitsyscall(0)
|
exitsyscall()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ func CgocallBack() {
|
|||||||
|
|
||||||
lockOSThread()
|
lockOSThread()
|
||||||
|
|
||||||
exitsyscall(0)
|
exitsyscall()
|
||||||
gp.m.incgo = false
|
gp.m.incgo = false
|
||||||
|
|
||||||
if gp.m.ncgo == 0 {
|
if gp.m.ncgo == 0 {
|
||||||
@ -134,7 +134,7 @@ func CgocallBackDone() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
gp.m.incgo = true
|
gp.m.incgo = true
|
||||||
entersyscall(0)
|
entersyscall()
|
||||||
|
|
||||||
if drop {
|
if drop {
|
||||||
mp.dropextram = false
|
mp.dropextram = false
|
||||||
@ -144,7 +144,7 @@ func CgocallBackDone() {
|
|||||||
|
|
||||||
// _cgo_panic may be called by SWIG code to panic.
|
// _cgo_panic may be called by SWIG code to panic.
|
||||||
func _cgo_panic(p *byte) {
|
func _cgo_panic(p *byte) {
|
||||||
exitsyscall(0)
|
exitsyscall()
|
||||||
panic(gostringnocopy(p))
|
panic(gostringnocopy(p))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -236,8 +236,8 @@ func notetsleepg(n *note, ns int64) bool {
|
|||||||
throw("notetsleepg on g0")
|
throw("notetsleepg on g0")
|
||||||
}
|
}
|
||||||
|
|
||||||
entersyscallblock(0)
|
entersyscallblock()
|
||||||
ok := notetsleep_internal(n, ns)
|
ok := notetsleep_internal(n, ns)
|
||||||
exitsyscall(0)
|
exitsyscall()
|
||||||
return ok
|
return ok
|
||||||
}
|
}
|
||||||
|
@ -289,8 +289,8 @@ func notetsleepg(n *note, ns int64) bool {
|
|||||||
throw("notetsleepg on g0")
|
throw("notetsleepg on g0")
|
||||||
}
|
}
|
||||||
semacreate(gp.m)
|
semacreate(gp.m)
|
||||||
entersyscallblock(0)
|
entersyscallblock()
|
||||||
ok := notetsleep_internal(n, ns, nil, 0)
|
ok := notetsleep_internal(n, ns, nil, 0)
|
||||||
exitsyscall(0)
|
exitsyscall()
|
||||||
return ok
|
return ok
|
||||||
}
|
}
|
||||||
|
@ -621,7 +621,7 @@ func mallocgc(size uintptr, typ *_type, needzero bool) unsafe.Pointer {
|
|||||||
// callback.
|
// callback.
|
||||||
incallback := false
|
incallback := false
|
||||||
if gomcache() == nil && getg().m.ncgo > 0 {
|
if gomcache() == nil && getg().m.ncgo > 0 {
|
||||||
exitsyscall(0)
|
exitsyscall()
|
||||||
incallback = true
|
incallback = true
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -709,7 +709,7 @@ func mallocgc(size uintptr, typ *_type, needzero bool) unsafe.Pointer {
|
|||||||
mp.mallocing = 0
|
mp.mallocing = 0
|
||||||
releasem(mp)
|
releasem(mp)
|
||||||
if incallback {
|
if incallback {
|
||||||
entersyscall(0)
|
entersyscall()
|
||||||
}
|
}
|
||||||
return x
|
return x
|
||||||
}
|
}
|
||||||
@ -835,7 +835,7 @@ func mallocgc(size uintptr, typ *_type, needzero bool) unsafe.Pointer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if incallback {
|
if incallback {
|
||||||
entersyscall(0)
|
entersyscall()
|
||||||
}
|
}
|
||||||
|
|
||||||
return x
|
return x
|
||||||
|
@ -34,12 +34,12 @@ func benchmarkSyscall(b *testing.B, work, excess int) {
|
|||||||
b.RunParallel(func(pb *testing.PB) {
|
b.RunParallel(func(pb *testing.PB) {
|
||||||
foo := 42
|
foo := 42
|
||||||
for pb.Next() {
|
for pb.Next() {
|
||||||
runtime.Entersyscall(0)
|
runtime.Entersyscall()
|
||||||
for i := 0; i < work; i++ {
|
for i := 0; i < work; i++ {
|
||||||
foo *= 2
|
foo *= 2
|
||||||
foo /= 2
|
foo /= 2
|
||||||
}
|
}
|
||||||
runtime.Exitsyscall(0)
|
runtime.Exitsyscall()
|
||||||
}
|
}
|
||||||
_ = foo
|
_ = foo
|
||||||
})
|
})
|
||||||
|
@ -1168,7 +1168,7 @@ func kickoff() {
|
|||||||
goexit1()
|
goexit1()
|
||||||
}
|
}
|
||||||
|
|
||||||
func mstart1(dummy int32) {
|
func mstart1() {
|
||||||
_g_ := getg()
|
_g_ := getg()
|
||||||
|
|
||||||
if _g_ != _g_.m.g0 {
|
if _g_ != _g_.m.g0 {
|
||||||
@ -2774,7 +2774,7 @@ func entersyscallblock_handoff() {
|
|||||||
//
|
//
|
||||||
//go:nosplit
|
//go:nosplit
|
||||||
//go:nowritebarrierrec
|
//go:nowritebarrierrec
|
||||||
func exitsyscall(dummy int32) {
|
func exitsyscall() {
|
||||||
_g_ := getg()
|
_g_ := getg()
|
||||||
|
|
||||||
_g_.m.locks++ // see comment in entersyscall
|
_g_.m.locks++ // see comment in entersyscall
|
||||||
@ -2984,13 +2984,13 @@ func exitsyscallclear(gp *g) {
|
|||||||
//go:linkname syscall_entersyscall syscall.Entersyscall
|
//go:linkname syscall_entersyscall syscall.Entersyscall
|
||||||
//go:nosplit
|
//go:nosplit
|
||||||
func syscall_entersyscall() {
|
func syscall_entersyscall() {
|
||||||
entersyscall(0)
|
entersyscall()
|
||||||
}
|
}
|
||||||
|
|
||||||
//go:linkname syscall_exitsyscall syscall.Exitsyscall
|
//go:linkname syscall_exitsyscall syscall.Exitsyscall
|
||||||
//go:nosplit
|
//go:nosplit
|
||||||
func syscall_exitsyscall() {
|
func syscall_exitsyscall() {
|
||||||
exitsyscall(0)
|
exitsyscall()
|
||||||
}
|
}
|
||||||
|
|
||||||
func beforefork() {
|
func beforefork() {
|
||||||
|
@ -199,16 +199,14 @@ func publicationBarrier()
|
|||||||
// getcallerpc returns the program counter (PC) of its caller's caller.
|
// getcallerpc returns the program counter (PC) of its caller's caller.
|
||||||
// getcallersp returns the stack pointer (SP) of its caller's caller.
|
// getcallersp returns the stack pointer (SP) of its caller's caller.
|
||||||
// argp must be a pointer to the caller's first function argument.
|
// argp must be a pointer to the caller's first function argument.
|
||||||
// The implementation may or may not use argp, depending on
|
// The implementation may be a compiler intrinsic; there is not
|
||||||
// the architecture. The implementation may be a compiler
|
// necessarily code implementing this on every platform.
|
||||||
// intrinsic; there is not necessarily code implementing this
|
|
||||||
// on every platform.
|
|
||||||
//
|
//
|
||||||
// For example:
|
// For example:
|
||||||
//
|
//
|
||||||
// func f(arg1, arg2, arg3 int) {
|
// func f(arg1, arg2, arg3 int) {
|
||||||
// pc := getcallerpc()
|
// pc := getcallerpc()
|
||||||
// sp := getcallersp(unsafe.Pointer(&arg1))
|
// sp := getcallersp()
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// These two lines find the PC and SP immediately following
|
// These two lines find the PC and SP immediately following
|
||||||
@ -230,7 +228,7 @@ func publicationBarrier()
|
|||||||
func getcallerpc() uintptr
|
func getcallerpc() uintptr
|
||||||
|
|
||||||
//go:noescape
|
//go:noescape
|
||||||
func getcallersp(argp unsafe.Pointer) uintptr
|
func getcallersp() uintptr
|
||||||
|
|
||||||
func asmcgocall(fn, arg unsafe.Pointer) int32 {
|
func asmcgocall(fn, arg unsafe.Pointer) int32 {
|
||||||
throw("asmcgocall")
|
throw("asmcgocall")
|
||||||
@ -309,9 +307,9 @@ func setSupportAES(v bool) {
|
|||||||
// Here for gccgo.
|
// Here for gccgo.
|
||||||
func errno() int
|
func errno() int
|
||||||
|
|
||||||
// Temporary for gccgo until we port proc.go.
|
// For gccgo these are written in C.
|
||||||
func entersyscall(int32)
|
func entersyscall()
|
||||||
func entersyscallblock(int32)
|
func entersyscallblock()
|
||||||
|
|
||||||
// For gccgo to call from C code, so that the C code and the Go code
|
// For gccgo to call from C code, so that the C code and the Go code
|
||||||
// can share the memstats variable for now.
|
// can share the memstats variable for now.
|
||||||
|
@ -382,7 +382,7 @@ extern void kickoff(void)
|
|||||||
__asm__(GOSYM_PREFIX "runtime.kickoff");
|
__asm__(GOSYM_PREFIX "runtime.kickoff");
|
||||||
extern void minit(void)
|
extern void minit(void)
|
||||||
__asm__(GOSYM_PREFIX "runtime.minit");
|
__asm__(GOSYM_PREFIX "runtime.minit");
|
||||||
extern void mstart1(int32)
|
extern void mstart1()
|
||||||
__asm__(GOSYM_PREFIX "runtime.mstart1");
|
__asm__(GOSYM_PREFIX "runtime.mstart1");
|
||||||
extern void stopm(void)
|
extern void stopm(void)
|
||||||
__asm__(GOSYM_PREFIX "runtime.stopm");
|
__asm__(GOSYM_PREFIX "runtime.stopm");
|
||||||
@ -542,7 +542,7 @@ runtime_mstart(void *arg)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
mstart1(0);
|
mstart1();
|
||||||
|
|
||||||
// mstart1 does not return, but we need a return statement
|
// mstart1 does not return, but we need a return statement
|
||||||
// here to avoid a compiler warning.
|
// here to avoid a compiler warning.
|
||||||
@ -621,12 +621,12 @@ makeGContext(G* gp, byte* sp, uintptr spsize) {
|
|||||||
// make g->sched refer to the caller's stack segment, because
|
// make g->sched refer to the caller's stack segment, because
|
||||||
// entersyscall is going to return immediately after.
|
// entersyscall is going to return immediately after.
|
||||||
|
|
||||||
void runtime_entersyscall(int32) __attribute__ ((no_split_stack));
|
void runtime_entersyscall() __attribute__ ((no_split_stack));
|
||||||
static void doentersyscall(uintptr, uintptr)
|
static void doentersyscall(uintptr, uintptr)
|
||||||
__attribute__ ((no_split_stack, noinline));
|
__attribute__ ((no_split_stack, noinline));
|
||||||
|
|
||||||
void
|
void
|
||||||
runtime_entersyscall(int32 dummy __attribute__ ((unused)))
|
runtime_entersyscall()
|
||||||
{
|
{
|
||||||
// Save the registers in the g structure so that any pointers
|
// Save the registers in the g structure so that any pointers
|
||||||
// held in registers will be seen by the garbage collector.
|
// held in registers will be seen by the garbage collector.
|
||||||
@ -638,8 +638,8 @@ runtime_entersyscall(int32 dummy __attribute__ ((unused)))
|
|||||||
// callee-saved registers to access the TLS variable g. We
|
// callee-saved registers to access the TLS variable g. We
|
||||||
// don't want to put the ucontext_t on the stack because it is
|
// don't want to put the ucontext_t on the stack because it is
|
||||||
// large and we can not split the stack here.
|
// large and we can not split the stack here.
|
||||||
doentersyscall((uintptr)runtime_getcallerpc(&dummy),
|
doentersyscall((uintptr)runtime_getcallerpc(),
|
||||||
(uintptr)runtime_getcallersp(&dummy));
|
(uintptr)runtime_getcallersp());
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -672,15 +672,15 @@ static void doentersyscallblock(uintptr, uintptr)
|
|||||||
|
|
||||||
// The same as runtime_entersyscall(), but with a hint that the syscall is blocking.
|
// The same as runtime_entersyscall(), but with a hint that the syscall is blocking.
|
||||||
void
|
void
|
||||||
runtime_entersyscallblock(int32 dummy __attribute__ ((unused)))
|
runtime_entersyscallblock()
|
||||||
{
|
{
|
||||||
// Save the registers in the g structure so that any pointers
|
// Save the registers in the g structure so that any pointers
|
||||||
// held in registers will be seen by the garbage collector.
|
// held in registers will be seen by the garbage collector.
|
||||||
getcontext(ucontext_arg(&g->gcregs[0]));
|
getcontext(ucontext_arg(&g->gcregs[0]));
|
||||||
|
|
||||||
// See comment in runtime_entersyscall.
|
// See comment in runtime_entersyscall.
|
||||||
doentersyscallblock((uintptr)runtime_getcallerpc(&dummy),
|
doentersyscallblock((uintptr)runtime_getcallerpc(),
|
||||||
(uintptr)runtime_getcallersp(&dummy));
|
(uintptr)runtime_getcallersp());
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -268,7 +268,7 @@ void* runtime_sysAlloc(uintptr, uint64*)
|
|||||||
void runtime_sysFree(void*, uintptr, uint64*)
|
void runtime_sysFree(void*, uintptr, uint64*)
|
||||||
__asm__ (GOSYM_PREFIX "runtime.sysFree");
|
__asm__ (GOSYM_PREFIX "runtime.sysFree");
|
||||||
void runtime_mprofinit(void);
|
void runtime_mprofinit(void);
|
||||||
#define runtime_getcallersp(p) __builtin_frame_address(0)
|
#define runtime_getcallersp() __builtin_frame_address(0)
|
||||||
void runtime_mcall(FuncVal*)
|
void runtime_mcall(FuncVal*)
|
||||||
__asm__ (GOSYM_PREFIX "runtime.mcall");
|
__asm__ (GOSYM_PREFIX "runtime.mcall");
|
||||||
int32 runtime_timediv(int64, int32, int32*)
|
int32 runtime_timediv(int64, int32, int32*)
|
||||||
@ -305,12 +305,10 @@ void runtime_schedtrace(bool)
|
|||||||
void runtime_goparkunlock(Lock*, String, byte, intgo)
|
void runtime_goparkunlock(Lock*, String, byte, intgo)
|
||||||
__asm__ (GOSYM_PREFIX "runtime.goparkunlock");
|
__asm__ (GOSYM_PREFIX "runtime.goparkunlock");
|
||||||
void runtime_tsleep(int64, const char*);
|
void runtime_tsleep(int64, const char*);
|
||||||
void runtime_entersyscall(int32)
|
void runtime_entersyscall()
|
||||||
__asm__ (GOSYM_PREFIX "runtime.entersyscall");
|
__asm__ (GOSYM_PREFIX "runtime.entersyscall");
|
||||||
void runtime_entersyscallblock(int32)
|
void runtime_entersyscallblock()
|
||||||
__asm__ (GOSYM_PREFIX "runtime.entersyscallblock");
|
__asm__ (GOSYM_PREFIX "runtime.entersyscallblock");
|
||||||
void runtime_exitsyscall(int32)
|
|
||||||
__asm__ (GOSYM_PREFIX "runtime.exitsyscall");
|
|
||||||
G* __go_go(void (*pfn)(void*), void*);
|
G* __go_go(void (*pfn)(void*), void*);
|
||||||
int32 runtime_callers(int32, Location*, int32, bool keep_callers);
|
int32 runtime_callers(int32, Location*, int32, bool keep_callers);
|
||||||
int64 runtime_nanotime(void) // monotonic time
|
int64 runtime_nanotime(void) // monotonic time
|
||||||
@ -385,7 +383,7 @@ bool runtime_notetsleepg(Note*, int64) // false - timeout
|
|||||||
#define runtime_munmap munmap
|
#define runtime_munmap munmap
|
||||||
#define runtime_madvise madvise
|
#define runtime_madvise madvise
|
||||||
#define runtime_memclr(buf, size) __builtin_memset((buf), 0, (size))
|
#define runtime_memclr(buf, size) __builtin_memset((buf), 0, (size))
|
||||||
#define runtime_getcallerpc(p) __builtin_return_address(0)
|
#define runtime_getcallerpc() __builtin_return_address(0)
|
||||||
|
|
||||||
#ifdef __rtems__
|
#ifdef __rtems__
|
||||||
void __wrap_rtems_task_variable_add(void **);
|
void __wrap_rtems_task_variable_add(void **);
|
||||||
|
Loading…
Reference in New Issue
Block a user