panic in the unreachable stubs instead of forwarding to the pure code - #46
panic in the unreachable stubs instead of forwarding to the pure code#46BobDu wants to merge 1 commit into
Conversation
Signed-off-by: BobDu <i@bobdu.cc>
|
My reason for the fallback was that if there was some bug where the method does get called somehow (for example, we attempt to call the avx512 code on arm64), then the library still works, it's just slower than it should be. I prefer that outcome to a panic. Can we instead add a comment for future readers instead of the panic? Maybe we can use testing.Testing() and panic if that's true and fallback otherwise (I don't mind bumping to go1.21)? |
|
If the dispatch is split per architecture instead, The layout follows |
On arm64
hash_avx512.HashFforwards tohash_pure.HashF, which reads like a fallback, butconsts.HasAVX512is false there so the dispatch never reaches it. It is a placeholder that exists only so the package compiles. Working that out took me a while when I was getting familiar with the repository, and a panic would have said it outright.The
// +buildlines have not been needed since Go 1.17 and the go directive here is already 1.20, so they are gone. The files now take their constraint from their names rather than a tag inside, which leaves an explicit tag only where one is needed.