Hacker News new | past | comments | ask | show | jobs | submit login

In principle, yes, but then you'd need considerable coordination with the compiler. The two things you'd need

- "Don't use these registers in this scope": not out of the range of possibility, but not well supported to our knowledge.

- "Be OK with an unpredictable jump to this label at any time": not going to happen without a LOT of work. This means that the whole crit section can't change the stack pointer, can't stash a register value on the stack, can't...etc. It wouldn't be impossible by any means to write a compiler that does this, but I don't know anyone who has and good luck managing it now.

(Before someone mentions asm goto: a) not supported in Clang, which is a dealbreaker, b) only supports jumps from particular points, not anywhen. The compiler is free to require such a jump to emit cleanup code to match local state to the label being jumped to; we can't do that.)

But we definitely considered trying it that way--it's just not quite practicable, and the workarounds we came up with more expensive than just having the whole crit section be inline assembly. That does work pretty nicely in the latest version (to be posted sooner or later.)




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

Search: