docs: AOT/ネイティブコンパイル情報をexecution-backends.mdに追加

- 4つ目の実行方式としてAOT(Ahead-of-Time)コンパイルを文書化
- MIR→WASM→.cwasm のコンパイルパイプラインを説明
- wasm-backend featureでのビルド方法を明記
- 現在の実装状況(完全なスタンドアロン実行ファイルはTODO)を記載
- CLAUDE.mdのWASM説明も3種類(Rust→WASM、Nyash→WASM、Nyash→AOT)に更新
- CURRENT_TASK.mdにPhase 10.9/10.10の完了項目を追加

ChatGPT5さんのAOT試行に対応した適切なドキュメント配置を実施

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Moe Charm
2025-08-29 02:05:39 +09:00
parent d67f27f4b8
commit 25fbebd650
34 changed files with 1631 additions and 353 deletions

View File

@ -6,10 +6,13 @@ pub struct DebugConfigBox {
pub base: BoxBase,
// toggles/paths (staged until apply())
pub jit_events: bool,
pub jit_events_compile: bool,
pub jit_events_runtime: bool,
pub jit_stats: bool,
pub jit_stats_json: bool,
pub jit_dump: bool,
pub jit_dot_path: Option<String>,
pub jit_events_path: Option<String>,
}
impl DebugConfigBox {
@ -17,16 +20,21 @@ impl DebugConfigBox {
Self {
base: BoxBase::new(),
jit_events: std::env::var("NYASH_JIT_EVENTS").ok().as_deref() == Some("1"),
jit_events_compile: std::env::var("NYASH_JIT_EVENTS_COMPILE").ok().as_deref() == Some("1"),
jit_events_runtime: std::env::var("NYASH_JIT_EVENTS_RUNTIME").ok().as_deref() == Some("1"),
jit_stats: std::env::var("NYASH_JIT_STATS").ok().as_deref() == Some("1"),
jit_stats_json: std::env::var("NYASH_JIT_STATS_JSON").ok().as_deref() == Some("1"),
jit_dump: std::env::var("NYASH_JIT_DUMP").ok().as_deref() == Some("1"),
jit_dot_path: std::env::var("NYASH_JIT_DOT").ok().filter(|s| !s.is_empty()),
jit_events_path: std::env::var("NYASH_JIT_EVENTS_PATH").ok().filter(|s| !s.is_empty()),
}
}
pub fn set_flag(&mut self, name: &str, on: bool) -> Box<dyn NyashBox> {
match name {
"jit_events" => self.jit_events = on,
"jit_events_compile" => self.jit_events_compile = on,
"jit_events_runtime" => self.jit_events_runtime = on,
"jit_stats" => self.jit_stats = on,
"jit_stats_json" => self.jit_stats_json = on,
"jit_dump" => self.jit_dump = on,
@ -38,6 +46,7 @@ impl DebugConfigBox {
pub fn set_path(&mut self, name: &str, value: &str) -> Box<dyn NyashBox> {
match name {
"jit_dot" | "jit_dot_path" => self.jit_dot_path = Some(value.to_string()),
"jit_events_path" => self.jit_events_path = Some(value.to_string()),
_ => return Box::new(StringBox::new(format!("Unknown path: {}", name)))
}
Box::new(VoidBox::new())
@ -46,6 +55,8 @@ impl DebugConfigBox {
pub fn get_flag(&self, name: &str) -> Box<dyn NyashBox> {
let v = match name {
"jit_events" => self.jit_events,
"jit_events_compile" => self.jit_events_compile,
"jit_events_runtime" => self.jit_events_runtime,
"jit_stats" => self.jit_stats,
"jit_stats_json" => self.jit_stats_json,
"jit_dump" => self.jit_dump,
@ -57,6 +68,7 @@ impl DebugConfigBox {
pub fn get_path(&self, name: &str) -> Box<dyn NyashBox> {
let v = match name {
"jit_dot" | "jit_dot_path" => self.jit_dot_path.clone().unwrap_or_default(),
"jit_events_path" => self.jit_events_path.clone().unwrap_or_default(),
_ => String::new(),
};
Box::new(StringBox::new(v))
@ -65,18 +77,31 @@ impl DebugConfigBox {
pub fn apply(&self) -> Box<dyn NyashBox> {
let setb = |k: &str, v: bool| { if v { std::env::set_var(k, "1"); } else { std::env::remove_var(k); } };
setb("NYASH_JIT_EVENTS", self.jit_events);
setb("NYASH_JIT_EVENTS_COMPILE", self.jit_events_compile);
setb("NYASH_JIT_EVENTS_RUNTIME", self.jit_events_runtime);
setb("NYASH_JIT_STATS", self.jit_stats);
setb("NYASH_JIT_STATS_JSON", self.jit_stats_json);
setb("NYASH_JIT_DUMP", self.jit_dump);
if let Some(p) = &self.jit_dot_path { std::env::set_var("NYASH_JIT_DOT", p); }
else { std::env::remove_var("NYASH_JIT_DOT"); }
if let Some(p) = &self.jit_events_path { std::env::set_var("NYASH_JIT_EVENTS_PATH", p); }
else { std::env::remove_var("NYASH_JIT_EVENTS_PATH"); }
// If any events are enabled and threshold is not set, default to 1 so lowering runs early
if (self.jit_events || self.jit_events_compile || self.jit_events_runtime)
&& std::env::var("NYASH_JIT_THRESHOLD").is_err()
{
std::env::set_var("NYASH_JIT_THRESHOLD", "1");
}
Box::new(VoidBox::new())
}
pub fn summary(&self) -> Box<dyn NyashBox> {
let s = format!(
"jit_events={} jit_stats={} jit_stats_json={} jit_dump={} jit_dot={}",
self.jit_events, self.jit_stats, self.jit_stats_json, self.jit_dump,
self.jit_dot_path.clone().unwrap_or_else(|| "<none>".to_string())
"jit_events={} jit_events_compile={} jit_events_runtime={} jit_stats={} jit_stats_json={} jit_dump={} jit_dot={} jit_events_path={}",
self.jit_events, self.jit_events_compile, self.jit_events_runtime,
self.jit_stats, self.jit_stats_json, self.jit_dump,
self.jit_dot_path.clone().unwrap_or_else(|| "<none>".to_string()),
self.jit_events_path.clone().unwrap_or_else(|| "<none>".to_string())
);
Box::new(StringBox::new(s))
}