📚 Phase 12.5 最適化戦略 & Phase 15 セルフホスティング計画
Phase 12.5: MIR15最適化戦略 - コンパイラ丸投げ作戦 - optimization-strategy.txt: 詳細戦略(MIR側は軽量、コンパイラに丸投げ) - implementation-examples.md: 具体的な実装例 - debug-safety-comparison.md: 現在のDebugBox vs ChatGPT5提案の比較分析 Phase 15: Nyashセルフホスティング - 究極の目標 - self-hosting-plan.txt: 内蔵Craneliftによる実現計画 - technical-details.md: CompilerBox設計とブートストラップ手順 - README.md: セルフホスティングのビジョン 重要な知見: - LLVM統合完了済み(Phase 11)だが依存が重すぎる - Craneliftが現実的な選択肢(3-5MB vs LLVM 50-100MB) - 「コンパイラもBox、すべてがBox」の夢へ MASTERロードマップ更新済み
This commit is contained in:
@ -105,6 +105,8 @@ pub fn push_task_scope() {
|
||||
if let Ok(mut st) = group_stack_cell().write() {
|
||||
st.push(std::sync::Arc::new(crate::boxes::task_group_box::TaskGroupInner { strong: std::sync::Mutex::new(Vec::new()) }));
|
||||
}
|
||||
// Set a fresh cancellation token for this scope (best-effort)
|
||||
set_current_group_token(CancellationToken::new());
|
||||
}
|
||||
|
||||
/// Pop a task scope. When depth reaches 0, join outstanding futures.
|
||||
@ -137,6 +139,8 @@ pub fn pop_task_scope() {
|
||||
join_all_registered_futures(ms);
|
||||
}
|
||||
}
|
||||
// Reset token (best-effort)
|
||||
set_current_group_token(CancellationToken::new());
|
||||
}
|
||||
|
||||
/// Perform a runtime safepoint and poll the scheduler if available.
|
||||
@ -174,3 +178,19 @@ pub fn spawn_task_with_token(name: &str, token: crate::runtime::scheduler::Cance
|
||||
f();
|
||||
false
|
||||
}
|
||||
|
||||
/// Spawn a delayed task via scheduler if available; returns true if scheduled.
|
||||
pub fn spawn_task_after(delay_ms: u64, name: &str, f: Box<dyn FnOnce() + Send + 'static>) -> bool {
|
||||
if let Ok(s) = sched_cell().read() {
|
||||
if let Some(sched) = s.as_ref() {
|
||||
sched.spawn_after(delay_ms, name, f);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// Fallback: run inline after blocking sleep
|
||||
std::thread::spawn(move || {
|
||||
std::thread::sleep(std::time::Duration::from_millis(delay_ms));
|
||||
f();
|
||||
});
|
||||
false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user