diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2016-09-30 13:45:08 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2016-09-30 13:45:08 +0000 |
commit | c0401cf78c555ef38d2d2fba94ebffeaef7c6bc9 (patch) | |
tree | d1646c0c4bb59624dfdc04420f835270129cc18e /libgo/runtime/proc.c | |
parent | 9e28a77462f81a9a2ab9064d768bd7c9484047e1 (diff) | |
download | gcc-c0401cf78c555ef38d2d2fba94ebffeaef7c6bc9.zip gcc-c0401cf78c555ef38d2d2fba94ebffeaef7c6bc9.tar.gz gcc-c0401cf78c555ef38d2d2fba94ebffeaef7c6bc9.tar.bz2 |
runtime: copy internal locking code from Go 1.7 runtime
Remove the old locking code written in C.
Add a shell script mkrsysinfo.sh to generate the runtime_sysinfo.go
file, so that we can get Go copies of the system time structures and
other types.
Tweak the compiler so that when compiling the runtime package the
address operator does not cause local variables to escape. When the gc
compiler compiles the runtime, an escaping local variable is treated as
an error. We should implement that, instead of this change, when escape
analysis is turned on.
Tweak the compiler so that the generated C header does not include names
that start with an underscore followed by a non-upper-case letter,
except for the special cases of _defer and _panic. Otherwise we
translate C types to Go in runtime_sysinfo.go and then generate those Go
types back as C types in runtime.inc, which is useless and painful for
the C code.
Change entersyscall and friends to take a dummy argument, as the gc
versions do, to simplify calls from the shared code.
Reviewed-on: https://go-review.googlesource.com/30079
From-SVN: r240657
Diffstat (limited to 'libgo/runtime/proc.c')
-rw-r--r-- | libgo/runtime/proc.c | 57 |
1 files changed, 26 insertions, 31 deletions
diff --git a/libgo/runtime/proc.c b/libgo/runtime/proc.c index 32d0fb2..dac32eb 100644 --- a/libgo/runtime/proc.c +++ b/libgo/runtime/proc.c @@ -2021,11 +2021,11 @@ goexit0(G *gp) // make g->sched refer to the caller's stack segment, because // entersyscall is going to return immediately after. -void runtime_entersyscall(void) __attribute__ ((no_split_stack)); +void runtime_entersyscall(int32) __attribute__ ((no_split_stack)); static void doentersyscall(void) __attribute__ ((no_split_stack, noinline)); void -runtime_entersyscall() +runtime_entersyscall(int32 dummy __attribute__ ((unused))) { // Save the registers in the g structure so that any pointers // held in registers will be seen by the garbage collector. @@ -2095,7 +2095,7 @@ doentersyscall() // The same as runtime_entersyscall(), but with a hint that the syscall is blocking. void -runtime_entersyscallblock(void) +runtime_entersyscallblock(int32 dummy __attribute__ ((unused))) { P *p; @@ -2133,7 +2133,7 @@ runtime_entersyscallblock(void) // This is called only from the go syscall library, not // from the low-level system calls used by the runtime. void -runtime_exitsyscall(void) +runtime_exitsyscall(int32 dummy __attribute__ ((unused))) { G *gp; @@ -2254,6 +2254,28 @@ exitsyscall0(G *gp) schedule(); // Never returns. } +void syscall_entersyscall(void) + __asm__(GOSYM_PREFIX "syscall.Entersyscall"); + +void syscall_entersyscall(void) __attribute__ ((no_split_stack)); + +void +syscall_entersyscall() +{ + runtime_entersyscall(0); +} + +void syscall_exitsyscall(void) + __asm__(GOSYM_PREFIX "syscall.Exitsyscall"); + +void syscall_exitsyscall(void) __attribute__ ((no_split_stack)); + +void +syscall_exitsyscall() +{ + runtime_exitsyscall(0); +} + // Called from syscall package before fork. void syscall_runtime_BeforeFork(void) __asm__(GOSYM_PREFIX "syscall.runtime_BeforeFork"); @@ -2323,33 +2345,6 @@ runtime_malg(int32 stacksize, byte** ret_stack, uintptr* ret_stacksize) return newg; } -/* For runtime package testing. */ - - -// Create a new g running fn with siz bytes of arguments. -// Put it on the queue of g's waiting to run. -// The compiler turns a go statement into a call to this. -// Cannot split the stack because it assumes that the arguments -// are available sequentially after &fn; they would not be -// copied if a stack split occurred. It's OK for this to call -// functions that split the stack. -void runtime_testing_entersyscall(int32) - __asm__ (GOSYM_PREFIX "runtime.entersyscall"); -void -runtime_testing_entersyscall(int32 dummy __attribute__ ((unused))) -{ - runtime_entersyscall(); -} - -void runtime_testing_exitsyscall(int32) - __asm__ (GOSYM_PREFIX "runtime.exitsyscall"); - -void -runtime_testing_exitsyscall(int32 dummy __attribute__ ((unused))) -{ - runtime_exitsyscall(); -} - G* __go_go(void (*fn)(void*), void* arg) { |