logoalt Hacker News

jonhohletoday at 2:25 PM0 repliesview on HN

What does an external function have to do with the C supporting or not supporting ASM? The symbol is just a symbol from another object. That could be written in any language that follows the ABI (not that ASM has any enforcement of ABi to begin with). The symbol resolves to an address and nothing more.

Saying inline ASM is no different than a function call is like saying standard control structures are no different from function calls. I suppose from a Smalltalk perspective that could be true, but is that the mental model most programmers use?

I work on a system from the 90s with custom instructions. GNU-as was patched to understand the instructions. They’re used through macros that ultimately expand to inline ASM. Without this, you’d need function inlining, which may or may not be possible with a linked object (it certainly wasn’t standard in the 90s). So now a single instruction turns into stack management, a jump, more stack management and a return. At that point any benefit to a specialized instruction may be erased, or in the case I’m dealing with talking to external hardware becomes unreasonably expensive.