Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Programming defensively in this way is possible but has a huge cost (extra saves and restores). The caller is supposed to be able to trust that certain registers persist across the call. If it can't, it has to save everything to memory before the call and restore it. I suppose a compiler could add a special annotation for "this is an assembler routine and I don't trust that they know the rules", which would generate extra saves and restores, but presumably the routine was coded in assembly for extra speed, so 6 to 8 extra saves and restores would cancel that out.

If someone is trying to use the same assembler routine on Windows as on Linux, it's likely to be wrong for one of them.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: