]> Cypherpunks repositories - gostls13.git/commit
runtime: change arm software div/mod call sequence not to modify stack
authorRuss Cox <rsc@golang.org>
Thu, 30 Jul 2015 14:45:01 +0000 (10:45 -0400)
committerRuss Cox <rsc@golang.org>
Thu, 30 Jul 2015 16:14:05 +0000 (16:14 +0000)
commitb2dfacf35e162f7ddcc5b1ed4c1e8e87096e06a9
tree7f788a758f50065664c7d7064aebcd773ade26a0
parent7904946eeb35faece61bbf6f5b3cc8be2f519c17
runtime: change arm software div/mod call sequence not to modify stack

Instead of pushing the denominator argument on the stack,
the denominator is now passed in m.

This fixes a variety of bugs related to trying to take stack traces
backwards from the middle of the software div/mod routines.
Some of those bugs have been kludged around in the past,
but others have not. Instead of trying to patch up after breaking
the stack, this CL stops breaking the stack.

This is an update of https://golang.org/cl/19810043,
which was rolled back in https://golang.org/cl/20350043.

The problem in the original CL was that there were divisions
at bad times, when m was not available. These were divisions
by constant denominators, either in C code or in assembly.
The Go compiler knows how to generate division by multiplication
for constant denominators, but the C compiler did not.
There is no longer any C code, so that's taken care of.
There was one problematic DIV in runtime.usleep (assembly)
but https://golang.org/cl/12898 took care of that one.
So now this approach is safe.

Reject DIV/MOD in NOSPLIT functions to keep them from
coming back.

Fixes #6681.
Fixes #6699.
Fixes #10486.

Change-Id: I09a13c76ad08ba75b3bd5d46a3eb78e66a84ab38
Reviewed-on: https://go-review.googlesource.com/12899
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/cmd/internal/obj/arm/obj5.go
src/runtime/runtime2.go
src/runtime/vlop_arm.s
test/fixedbugs/issue10486.go [new file with mode: 0644]