This is the mail archive of the
gcc-cvs@gcc.gnu.org
mailing list for the GCC project.
r273499 - in /trunk: gcc/go/gofrontend/MERGE li...
- From: ian at gcc dot gnu dot org
- To: gcc-cvs at gcc dot gnu dot org
- Date: Mon, 15 Jul 2019 21:17:16 -0000
- Subject: r273499 - in /trunk: gcc/go/gofrontend/MERGE li...
Author: ian
Date: Mon Jul 15 21:17:16 2019
New Revision: 273499
URL: https://gcc.gnu.org/viewcvs?rev=273499&root=gcc&view=rev
Log:
runtime: expose the g variable
Currently, getg is implemented in C, which loads the thread-local
g variable. The g variable is declared static in C.
This CL exposes the g variable, so it can be accessed from the Go
side. This allows the Go compiler to inline getg calls to direct
access of g.
Currently, the actual inlining is only implemented in the gollvm
compiler. The g variable is thread-local and the compiler backend
may choose to cache the TLS address in a register or on stack. If
a thread switch happens the cache may become invalid. I don't
know how to disable the TLS address cache in gccgo, therefore
the inlining of getg is not implemented. In the future gccgo may
gain this if we know how to do it safely.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/186238
Modified:
trunk/gcc/go/gofrontend/MERGE
trunk/libgo/runtime/proc.c