News for hackers. Stuff that matters.
Re:Stack unwinding in Rust by dbaupp on Friday October 31, 2014 @09:57AM (#8538719)
It is not nearly as simple as you are hoping. The threat of unwinding forces compilers to insert landing pads (increasing code size) and forgo some optimisations because they have to be careful to preserve semantics even during unwinding, restricting things like how much code can be reordered etc.
Re:Stack unwinding in Rust by qznc on Friday October 31, 2014 @10:58AM (#8539061)
It certainly makes things more complex for the compiler. However, I don't know an example where it would prevent an optimization.
Re:Stack unwinding in Rust by veddan on Friday October 31, 2014 @05:52PM (#8541285)
It's not just a matter of the compiler missing optimizations. Some (unsafe, low-level) algorithms have to be written differently (and less efficiently) because of the possibility of unwinding. Disallowed patterns typically look something like

  * Put an object in an invalid state
  * Perform some operation that might unwind
  * Fix the object again
If you unwind while the object is in an invalid state, and its destructor is called during unwinding, you can end up with undefined behavior.