diff options
author | Ian Lance Taylor <iant@golang.org> | 2018-01-09 01:23:08 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2018-01-09 01:23:08 +0000 |
commit | 1a2f01efa63036a5104f203a4789e682c0e0915d (patch) | |
tree | 373e15778dc8295354584e1f86915ae493b604ff /libgo/runtime/proc.c | |
parent | 8799df67f2dab88f9fda11739c501780a85575e2 (diff) | |
download | gcc-1a2f01efa63036a5104f203a4789e682c0e0915d.zip gcc-1a2f01efa63036a5104f203a4789e682c0e0915d.tar.gz gcc-1a2f01efa63036a5104f203a4789e682c0e0915d.tar.bz2 |
libgo: update to Go1.10beta1
Update the Go library to the 1.10beta1 release.
Requires a few changes to the compiler for modifications to the map
runtime code, and to handle some nowritebarrier cases in the runtime.
Reviewed-on: https://go-review.googlesource.com/86455
gotools/:
* Makefile.am (go_cmd_vet_files): New variable.
(go_cmd_buildid_files, go_cmd_test2json_files): New variables.
(s-zdefaultcc): Change from constants to functions.
(noinst_PROGRAMS): Add vet, buildid, and test2json.
(cgo$(EXEEXT)): Link against $(LIBGOTOOL).
(vet$(EXEEXT)): New target.
(buildid$(EXEEXT)): New target.
(test2json$(EXEEXT)): New target.
(install-exec-local): Install all $(noinst_PROGRAMS).
(uninstall-local): Uninstasll all $(noinst_PROGRAMS).
(check-go-tool): Depend on $(noinst_PROGRAMS). Copy down
objabi.go.
(check-runtime): Depend on $(noinst_PROGRAMS).
(check-cgo-test, check-carchive-test): Likewise.
(check-vet): New target.
(check): Depend on check-vet. Look at cmd_vet-testlog.
(.PHONY): Add check-vet.
* Makefile.in: Rebuild.
From-SVN: r256365
Diffstat (limited to 'libgo/runtime/proc.c')
-rw-r--r-- | libgo/runtime/proc.c | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/libgo/runtime/proc.c b/libgo/runtime/proc.c index d6e42e6..6d2adb8 100644 --- a/libgo/runtime/proc.c +++ b/libgo/runtime/proc.c @@ -32,6 +32,8 @@ extern void *__splitstack_makecontext(size_t, void *context[10], size_t *); extern void * __splitstack_resetcontext(void *context[10], size_t *); +extern void __splitstack_releasecontext(void *context[10]); + extern void *__splitstack_find(void *, void *, size_t *, void **, void **, void **); @@ -269,6 +271,9 @@ runtime_newosproc(M *mp) runtime_printf("pthread_create failed: %d\n", ret); runtime_throw("pthread_create"); } + + if(pthread_attr_destroy(&attr) != 0) + runtime_throw("pthread_attr_destroy"); } // Switch context to a different goroutine. This is like longjmp. @@ -377,10 +382,12 @@ extern void kickoff(void) __asm__(GOSYM_PREFIX "runtime.kickoff"); extern void minit(void) __asm__(GOSYM_PREFIX "runtime.minit"); -extern void mstart1(void) +extern void mstart1(int32) __asm__(GOSYM_PREFIX "runtime.mstart1"); extern void stopm(void) __asm__(GOSYM_PREFIX "runtime.stopm"); +extern void mexit(bool) + __asm__(GOSYM_PREFIX "runtime.mexit"); extern void handoffp(P*) __asm__(GOSYM_PREFIX "runtime.handoffp"); extern void wakep(void) @@ -519,6 +526,11 @@ runtime_mstart(void *arg) *(int*)0x21 = 0x21; } + if(mp->exiting) { + mexit(true); + return nil; + } + // Initial call to getcontext--starting thread. #ifdef USING_SPLIT_STACK @@ -528,7 +540,7 @@ runtime_mstart(void *arg) } #endif - mstart1(); + mstart1(0); // mstart1 does not return, but we need a return statement // here to avoid a compiler warning. @@ -751,6 +763,30 @@ runtime_malg(bool allocatestack, bool signalstack, byte** ret_stack, uintptr* re return newg; } +void stackfree(G*) + __asm__(GOSYM_PREFIX "runtime.stackfree"); + +// stackfree frees the stack of a g. +void +stackfree(G* gp) +{ +#if USING_SPLIT_STACK + __splitstack_releasecontext((void*)(&gp->stackcontext[0])); +#else + // If gcstacksize is 0, the stack is allocated by libc and will be + // released when the thread exits. Otherwise, in 64-bit mode it was + // allocated using sysAlloc and in 32-bit mode it was allocated + // using garbage collected memory. + if (gp->gcstacksize != 0) { + if (sizeof(void*) == 8) { + runtime_sysFree(gp->gcinitialsp, gp->gcstacksize, &getMemstats()->stacks_sys); + } + gp->gcinitialsp = nil; + gp->gcstacksize = 0; + } +#endif +} + void resetNewG(G*, void **, uintptr*) __asm__(GOSYM_PREFIX "runtime.resetNewG"); |