gcc/libgo/runtime
Ian Lance Taylor 798c183f7f compiler, runtime: Fix unexpected GC interfering with closure passing.
The Go frontend passes closures through to functions using the
functions __go_set_closure and __go_get_closure.  The
expectation is that there are no function calls between
set_closure and get_closure.  However, it turns out that there
can be function calls if some of the function arguments
require type conversion to an interface type.  Converting to
an interface type can allocate memory, and that can in turn
trigger a garbage collection, and that can in turn call pool
cleanup functions that may call __go_set_closure.  So the
called function can see the wrong closure value, which is bad.

This patch fixes the problem in two different ways.  First, we
move all type conversions in function arguments into temporary
variables so that they can not appear before the call to
__go_set_closure.  (This required shifting the flatten phase
after the simplify_thunk phase, since the latter expects to
work with unconverted argument types.)  Second, we fix the
memory allocation function to preserve the closure value
across any possible garbage collection.

A test case is the libgo database/sql check run with the
environment variable GOGC set to 1.

From-SVN: r213932
2014-08-13 22:31:44 +00:00
..
arch.h
array.h
chan.c libgo: Update to Go 1.3 release. 2014-07-19 08:53:52 +00:00
chan.goc libgo: Update to Go 1.3 release. 2014-07-19 08:53:52 +00:00
chan.h runtime: Merge master revision 19185. 2014-07-12 00:01:09 +00:00
cpuprof.c libgo: Update to Go 1.3 release. 2014-07-19 08:53:52 +00:00
cpuprof.goc libgo: Update to Go 1.3 release. 2014-07-19 08:53:52 +00:00
defs.h
env_posix.c libgo: Update to Go 1.3 release. 2014-07-19 08:53:52 +00:00
getncpu-bsd.c
getncpu-irix.c
getncpu-linux.c
getncpu-none.c
getncpu-solaris.c
go-alloc.h
go-append.c libgo: Merge to master revision 19184. 2014-06-06 22:37:27 +00:00
go-assert-interface.c
go-assert.c
go-assert.h
go-breakpoint.c
go-byte-array-to-string.c
go-caller.c re PR other/61895 (libbacktrace crashes with bus error with empty file argv[0]) 2014-08-02 00:54:15 +00:00
go-callers.c reflect, runtime: Use libffi closures to implement reflect.MakeFunc. 2014-07-19 21:36:26 +00:00
go-can-convert-interface.c
go-cdiv.c
go-cgo.c runtime: Merge master revision 19185. 2014-07-12 00:01:09 +00:00
go-check-interface.c
go-construct-map.c
go-convert-interface.c
go-copy.c
go-defer.c libgo: Merge to master revision 19184. 2014-06-06 22:37:27 +00:00
go-defer.h libgo: Merge to master revision 19184. 2014-06-06 22:37:27 +00:00
go-deferred-recover.c
go-eface-compare.c runtime: Drop reflectFlags tests. 2014-07-11 00:26:25 +00:00
go-eface-val-compare.c runtime: Drop reflectFlags tests. 2014-07-11 00:26:25 +00:00
go-ffi.c reflect, runtime: Use libffi closures to implement reflect.MakeFunc. 2014-07-19 21:36:26 +00:00
go-ffi.h reflect, runtime: Use libffi closures to implement reflect.MakeFunc. 2014-07-19 21:36:26 +00:00
go-fieldtrack.c
go-iface.goc runtime: Rename iface.goc to go-iface.goc. 2014-07-11 00:39:03 +00:00
go-int-array-to-string.c
go-int-to-string.c
go-interface-compare.c
go-interface-eface-compare.c runtime: Drop reflectFlags tests. 2014-07-11 00:26:25 +00:00
go-interface-val-compare.c
go-main.c
go-make-slice.c
go-map-delete.c re PR go/61620 (FAIL: go.test/test/fixedbugs/bug242.go execution, -O2 -g) 2014-07-02 14:23:45 +00:00
go-map-index.c
go-map-len.c
go-map-range.c
go-matherr.c
go-memcmp.c
go-nanotime.c
go-new-map.c
go-new.c
go-nosys.c
go-now.c libgo: Update to Go 1.3 release. 2014-07-19 08:53:52 +00:00
go-panic.c libgo: Merge to master revision 19184. 2014-06-06 22:37:27 +00:00
go-panic.h reflect, runtime: Use libffi closures to implement reflect.MakeFunc. 2014-07-19 21:36:26 +00:00
go-print.c
go-recover.c reflect, runtime: Use libffi closures to implement reflect.MakeFunc. 2014-07-19 21:36:26 +00:00
go-reflect-call.c reflect, runtime: Use libffi closures to implement reflect.MakeFunc. 2014-07-19 21:36:26 +00:00
go-reflect-map.c libgo: Merge from revision 18783:00cce3a34d7e of master library. 2014-06-04 23:15:33 +00:00
go-rune.c
go-runtime-error.c
go-setenv.c libgo: Merge to master revision 19184. 2014-06-06 22:37:27 +00:00
go-signal.c libgo: Update to Go 1.3 release. 2014-07-19 08:53:52 +00:00
go-strcmp.c
go-string-to-byte-array.c libgo: Merge to master revision 19184. 2014-06-06 22:37:27 +00:00
go-string-to-int-array.c libgo: Merge to master revision 19184. 2014-06-06 22:37:27 +00:00
go-string.h
go-strplus.c
go-strslice.c
go-traceback.c reflect, runtime: Use libffi closures to implement reflect.MakeFunc. 2014-07-19 21:36:26 +00:00
go-trampoline.c
go-type-complex.c
go-type-eface.c runtime: Drop reflectFlags tests. 2014-07-11 00:26:25 +00:00
go-type-error.c
go-type-float.c
go-type-identity.c
go-type-interface.c
go-type-string.c
go-type.h runtime: Drop reflectFlags tests. 2014-07-11 00:26:25 +00:00
go-typedesc-equal.c
go-unsafe-new.c
go-unsafe-newarray.c
go-unsafe-pointer.c libgo: Merge from revision 18783:00cce3a34d7e of master library. 2014-06-04 23:15:33 +00:00
go-unwind.c libgo: Merge to master revision 19184. 2014-06-06 22:37:27 +00:00
go-varargs.c libgo: Merge to master revision 19184. 2014-06-06 22:37:27 +00:00
goc2c.c runtime: Merge master revision 19185. 2014-07-12 00:01:09 +00:00
heapdump.c libgo: Update to Go 1.3 release. 2014-07-19 08:53:52 +00:00
interface.h
lfstack.c libgo: Update to Go 1.3 release. 2014-07-19 08:53:52 +00:00
lfstack.goc runtime: Merge master revision 19185. 2014-07-12 00:01:09 +00:00
lock_futex.c libgo: Merge to master revision 19184. 2014-06-06 22:37:27 +00:00
lock_sema.c libgo: Update to Go 1.3 release. 2014-07-19 08:53:52 +00:00
malloc.goc compiler, runtime: Fix unexpected GC interfering with closure passing. 2014-08-13 22:31:44 +00:00
malloc.h libgo: Update to Go 1.3 release. 2014-07-19 08:53:52 +00:00
map.goc
map.h
mcache.c libgo: Update to Go 1.3 release. 2014-07-19 08:53:52 +00:00
mcentral.c libgo: Update to Go 1.3 release. 2014-07-19 08:53:52 +00:00
mem_posix_memalign.c
mem.c runtime: Add casts to mincore call to compile on Solaris. 2014-08-04 17:54:09 +00:00
mfixalloc.c
mgc0.c libgo: Update to Go 1.3 release. 2014-07-19 08:53:52 +00:00
mgc0.h libgo: Update to Go 1.3 release. 2014-07-19 08:53:52 +00:00
mheap.c libgo: Update to Go 1.3 release. 2014-07-19 08:53:52 +00:00
mprof.goc reflect, runtime: Use libffi closures to implement reflect.MakeFunc. 2014-07-19 21:36:26 +00:00
msize.c libgo: Merge to master revision 19184. 2014-06-06 22:37:27 +00:00
netpoll_epoll.c libgo: Update to Go 1.3 release. 2014-07-19 08:53:52 +00:00
netpoll_kqueue.c libgo: Update to Go 1.3 release. 2014-07-19 08:53:52 +00:00
netpoll_select.c libgo: Merge to master revision 19184. 2014-06-06 22:37:27 +00:00
netpoll_stub.c libgo: Merge to master revision 19184. 2014-06-06 22:37:27 +00:00
netpoll.goc libgo: Update to Go 1.3 release. 2014-07-19 08:53:52 +00:00
panic.c libgo: Update to Go 1.3 release. 2014-07-19 08:53:52 +00:00
parfor.c runtime: Merge master revision 19185. 2014-07-12 00:01:09 +00:00
print.c runtime: also disable split stacks for runtime_snprintf function under Clang 2014-07-20 09:24:16 +00:00
proc.c reflect, runtime: Use libffi closures to implement reflect.MakeFunc. 2014-07-19 21:36:26 +00:00
race.h libgo: Update to Go 1.3 release. 2014-07-19 08:53:52 +00:00
rdebug.goc libgo: Update to Go 1.3 release. 2014-07-19 08:53:52 +00:00
reflect.goc runtime: Drop reflectFlags tests. 2014-07-11 00:26:25 +00:00
rtems-task-variable-add.c
runtime1.goc runtime: Merge master revision 19185. 2014-07-12 00:01:09 +00:00
runtime.c libgo: Update to Go 1.3 release. 2014-07-19 08:53:52 +00:00
runtime.h reflect, runtime: Use libffi closures to implement reflect.MakeFunc. 2014-07-19 21:36:26 +00:00
sema.goc libgo: Merge to master revision 19184. 2014-06-06 22:37:27 +00:00
signal_unix.c libgo: Merge to master revision 19184. 2014-06-06 22:37:27 +00:00
signal_unix.h
sigqueue.goc
string.goc runtime: Merge master revision 19185. 2014-07-12 00:01:09 +00:00
thread-linux.c
thread-sema.c
thread.c
time.goc libgo: Update to Go 1.3 release. 2014-07-19 08:53:52 +00:00
yield.c runtime: Use _mm_pause rather than __builtin_ia32_pause. 2014-05-30 13:53:58 +00:00