]> Cypherpunks repositories - gostls13.git/commit
runtime: adjust errorCString definition to avoid allocation
authorRuss Cox <rsc@golang.org>
Sun, 24 Aug 2014 03:01:59 +0000 (23:01 -0400)
committerRuss Cox <rsc@golang.org>
Sun, 24 Aug 2014 03:01:59 +0000 (23:01 -0400)
commit48452a276d63639f54d3ce1a8d36663e26949526
tree9d0312ea25da4b50bea4a4bf678f7f5c5b3bbe96
parent5b70b7121968233cd953eba4d77b768400086d9c
runtime: adjust errorCString definition to avoid allocation

The low-level implementation of divide on ARM assumes that
it can panic with an error created by newErrorCString without
allocating. If we make interface data words require pointer values,
the current definition would require an allocation when stored
in an interface. Changing the definition to use unsafe.Pointer
instead of uintptr avoids the allocation. This change is okay
because the field really is a pointer (to a C string in rodata).

Update #8405.

This should make CL 133830043 safe to try again.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=dave, golang-codereviews, r
https://golang.org/cl/133820043
src/pkg/runtime/error.go