r213933 - /branches/gcc-4_9-branch/libgo/runtim...

ian@gcc.gnu.org ian@gcc.gnu.org
Wed Aug 13 22:32:00 GMT 2014


Author: ian
Date: Wed Aug 13 22:32:32 2014
New Revision: 213933

URL: https://gcc.gnu.org/viewcvs?rev=213933&root=gcc&view=rev
Log:
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 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.

Modified:
    branches/gcc-4_9-branch/libgo/runtime/malloc.goc



More information about the Gcc-cvs mailing list