“Arranging for Safety Checks with Hardware Traps” was the title of an article I wrote for a class project. It describes how to use the Alignment Checking feature of the x86/AMD64 architecture to get branchless dynamic type checks.
The article has not been published formally, although it was written in a style that makes it look like it could be published. I was unable to find anything in the literature that describes how to use alignment checking for dynamic type checks.
After writing the article I discovered that the idea is mentioned in passing in Olin Shiver’s dissertation and there are several mentions of it on Usenet. The method is old but has not been used on the x86 because it is difficult to make it work with other software.
And for what it’s worth: the branchless vector-ref is probably slower than the one with the branch. But it is cool.
“A hack is a terrible thing to waste, please give to the implementation of your choice…” – GJC