This seems generally on the right track. A couple of thoughts:

* I can pretty much guarantee you that that simple of a static analysis to 
determine stack size is going to fail on any reasonable program.  I would just 
leave it out. If you're feeling ambitious, you could implement it as an LLVM 
pass to eliminate stack bounds checks on recursion-free leaves of the call 
graph. (LLVM is the right place to do it, as it can make these decisions 
post-inlining, and also knows the exact amount of stack space each function 
takes up.)

* Why not have the crate-level stack checking attribute be a function-level 
attribute instead? That way you could implement "tainting" easily: just require 
that any function tagged with "no stack check" be marked unsafe.

Overall, this is great--I like this direction :)

Patrick

Corey Richardson <co...@octayn.net> wrote:
>I've written a blog post about stack safety and a proposal for how I
>think it should be implemented in Rust:
>http://cmr.github.io/blog/2013/10/21/on-stack-safety/
>
>Thoughts, comments? I'm going to implement this after my (ill-kept)
>hiatus if there's consensus that this is a good idea.
>_______________________________________________
>Rust-dev mailing list
>Rust-dev@mozilla.org
>https://mail.mozilla.org/listinfo/rust-dev

-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to