]> Cypherpunks repositories - gostls13.git/commit
runtime: don't use FP when calling nextSample in the Plan 9 sighandler
authorDavid du Colombier <0intro@gmail.com>
Wed, 28 Oct 2015 05:44:26 +0000 (06:44 +0100)
committerDavid du Colombier <0intro@gmail.com>
Wed, 28 Oct 2015 05:45:24 +0000 (05:45 +0000)
commit31430bda0988aed3dab6ee48c00afc1b0fb65093
treec0ff1cf120bb88d2f0da6adaa7bf2fda2be016c9
parent6736cb0df122fdcb0e23c9aba16ebf49ae47b12c
runtime: don't use FP when calling nextSample in the Plan 9 sighandler

In the Go signal handler on Plan 9, when a signal with
the _SigThrow flag is received, we call startpanic before
printing the stack trace.

The startpanic function calls systemstack which calls
startpanic_m. In the startpanic_m function, we call
allocmcache to allocate _g_.m.mcache. The problem is
that allocmcache calls nextSample, which does a floating
point operation to return a sampling point for heap profiling.

However, Plan 9 doesn't support floating point in the
signal handler.

This change adds a new function nextSampleNoFP, only
called when in the Plan 9 signal handler, which is
similar to nextSample, but avoids floating point.

Change-Id: Iaa30437aa0f7c8c84d40afbab7567ad3bd5ea2de
Reviewed-on: https://go-review.googlesource.com/16307
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/runtime/malloc.go