runtime: avoid write barriers with traceback info
commit423c6e0d58f30402c585830d9e1ec4bbd57876f6
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 13 Sep 2018 17:30:00 +0000 (13 17:30 +0000)
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 13 Sep 2018 17:30:00 +0000 (13 17:30 +0000)
treeffb6a90f3e684836545e8c93e21e30588428ca11
parentf1bac0a0bb604e5bd0515ffd6f989da5ecfa0f56
runtime: avoid write barriers with traceback info

    Unlike the gc runtime, libgo stores traceback information in location
    structs, which contain strings.  Therefore, copying location structs
    around appears to require write barriers, although in fact write
    barriers are never important because the strings are never allocated
    in Go memory.  They come from libbacktrace.

    Some of the generated write barriers come at times when write barriers
    are not permitted.  For example, exitsyscall, marked
    nowritebarrierrec, calls exitsyscallfast which calls traceGoSysExit
    which calls traceEvent which calls traceStackID which calls
    trace.stackTab.put which copies location values into memory allocated
    by tab.newStack.  This write barrier can be invoked when there is no
    p, causing a crash.

    This change fixes the problem by ensuring that location values are
    copied around in the tracing code with no write barriers.

    This was found by fixing the compiler to fully implement
    //go:nowritebarrierrec; CL to follow.

    Reviewed-on: https://go-review.googlesource.com/134226

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@264282 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/go/gofrontend/MERGE
libgo/go/runtime/proc.go
libgo/go/runtime/runtime2.go
libgo/go/runtime/trace.go
libgo/go/runtime/traceback_gccgo.go
libgo/runtime/proc.c