gcc/gcc/go
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
..
gofrontend compiler, runtime: Fix unexpected GC interfering with closure passing. 2014-08-13 22:31:44 +00:00
ChangeLog go-gcc.cc (Gcc_backend::compound_statement): Don't return NULL_TREE. 2014-08-08 17:40:51 +00:00
Make-lang.in go-backend.c: #include "diagnostics.h". 2014-05-01 01:20:07 +00:00
README.gcc
config-lang.in
gccgo.texi
go-backend.c go-backend.c: #include "diagnostics.h". 2014-05-01 01:20:07 +00:00
go-c.h compiler: Store flags for division checks in Gogo object instead of using global variables. 2014-05-06 13:50:01 +00:00
go-gcc.cc go-gcc.cc (Gcc_backend::compound_statement): Don't return NULL_TREE. 2014-08-08 17:40:51 +00:00
go-lang.c use templates instead of gengtype for typed allocation functions 2014-05-17 23:07:23 +00:00
go-linemap.cc
go-location.h
go-system.h
gospec.c re PR go/61496 (Many Go tests FAIL with ld warning about go$zerovalue) 2014-06-13 22:30:47 +00:00
lang-specs.h
lang.opt

README.gcc

The files in the gofrontend subdirectory are mirrored from the
gofrontend project hosted at http://code.google.com/p/gofrontend.
These files are the ones in the go subdirectory of that project.