3 ms·
The trick of switching the implementation of owning_ptr and constraint_ptr based on a compile flag is very neat. Is there any risk of the compile flag influenc
by cevans01 6y ago
The trick of switching the implementation of owning_ptr and constraint_ptr based on a compile flag is very neat.
Is there any risk of the compile flag influencing which object owns the reference, and therefore causing a kind of "heisenbug" where it doesn't crash during the safe mode but still has dangling pointers in the fast mode?
- verdagon 6y agoThanks! We stand on the shoulders of giants, this method has been in use in the wild for a while, and Gel introduced it back in 2007. Behavior will be the same in all three modes. There is however a chance that testing and development didn't cover a certain code path, and we would trigger unsafety in production, similar to unsafe blocks in Rust. When one encounters unsafety in Vale, they'll be able to just re-run in normal mode to instantly identify what caused it. Normal Mode is very conservative (halts early when a constraint ref becomes dangling, rather than when it's dereferenced), so combined with test coverage, it can give high confidence in safety, and is strictly better than even C++ and ASan. If that's not enough, Resilient Mode has zero unsafety, and with the optimizations we'll be using (nonatomic RC, Lobster's algorithm, immutable region borrowing, bump calling, etc) should be incredibly fast in practice, possibly on par with Rust and C++, and exceeding them in certain cases, with bump calling.