This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

ivopts vs. garbage collection


The bug report https://golang.org/issue/13662 describes a case in
which ivopts appears to be breaking garbage collection for the Go
compiler.  There is an array allocated in memory, and there is a loop
over that array.  The ivopts optimization is taking the only pointer
to the array and subtracting 8 from it before entering the loop.
There are function calls in between this subtraction and the actual
use of the array.  During those function calls, a garbage collection
occurs.  Since the only pointer to the array no longer points to the
actual memory being used, the array is unexpectedly freed.

That all seems clear enough, although I'm not sure how best to fix it.
What I'm wondering in particular is whether Java does anything to
avoid this kind of problem.  I don't see anything obvious.  Thanks for
any pointers.

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]