pub struct TailCallInfo {
pub recursive_words: HashSet<String>,
}Expand description
Information about tail calls for mutual TCO optimization.
§Current Status
This struct is currently infrastructure for future use. The existing codegen
already emits musttail for all tail calls to user-defined words, so mutual TCO
works without explicit call graph checks.
Potential future uses:
- Selective TCO (only optimize detected recursive cycles)
- Diagnostic tools (show which words are mutually recursive)
- Dead code detection (unreachable words in non-recursive paths)
Fields§
§recursive_words: HashSet<String>Words that are in a recursive cycle and should get mutual TCO
Implementations§
Source§impl TailCallInfo
impl TailCallInfo
Sourcepub fn from_call_graph(graph: &CallGraph) -> Self
pub fn from_call_graph(graph: &CallGraph) -> Self
Build tail call info from a call graph.
Sourcepub fn should_use_musttail(&self, caller: &str, callee: &str) -> bool
pub fn should_use_musttail(&self, caller: &str, callee: &str) -> bool
Check if a call from caller to callee is between mutually recursive words.
Returns true if both are in the same recursive cycle.
§Note
Currently unused in codegen since all user-word tail calls get musttail.
Kept as infrastructure for potential future selective optimization.
Trait Implementations§
Source§impl Clone for TailCallInfo
impl Clone for TailCallInfo
Source§fn clone(&self) -> TailCallInfo
fn clone(&self) -> TailCallInfo
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for TailCallInfo
impl RefUnwindSafe for TailCallInfo
impl Send for TailCallInfo
impl Sync for TailCallInfo
impl Unpin for TailCallInfo
impl UnwindSafe for TailCallInfo
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more