• Russ Cox's avatar
    runtime: change arm software div/mod call sequence not to modify stack · b2dfacf3
    Russ Cox authored
    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/12899Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
    b2dfacf3
obj5.go 21.4 KB