Currently `avo` uses `BP` as a standard general-purpose register. However, `BP` is used for the frame pointer and should be callee-save. Under some circumstances, the Go assembler will do this automatically, but not always. At the moment `avo` can produce code that clobbers the `BP` register. Since Go 1.16 this code will also fail a new `go vet` check. This PR provides a (currently sub-optimal) fix for the issue. It introduces an `EnsureBasePointerCalleeSaved` pass which will check if the base pointer is written to by a function, and if so will artificially ensure that the function has a non-zero frame size. This will trigger the Go assembler to automatically save and restore the BP register. In addition, we update the `asmdecl` tool to `asmvet`, which includes the `framepointer` vet check. Updates #156
25 lines
447 B
ArmAsm
25 lines
447 B
ArmAsm
// Code generated by command: go run asm.go -out fnv1a.s -stubs stub.go. DO NOT EDIT.
|
|
|
|
#include "textflag.h"
|
|
|
|
// func Hash64(data []byte) uint64
|
|
TEXT ·Hash64(SB), NOSPLIT, $8-32
|
|
MOVQ data_base+0(FP), CX
|
|
MOVQ data_len+8(FP), BX
|
|
MOVQ $0xcbf29ce484222325, AX
|
|
MOVQ $0x00000100000001b3, BP
|
|
|
|
loop:
|
|
CMPQ BX, $0x00
|
|
JE done
|
|
MOVBQZX (CX), DX
|
|
XORQ DX, AX
|
|
MULQ BP
|
|
INCQ CX
|
|
DECQ BX
|
|
JMP loop
|
|
|
|
done:
|
|
MOVQ AX, ret+24(FP)
|
|
RET
|