Commit Graph

6 Commits

Author SHA1 Message Date
dda65b94b7 Phase 21.7 normalization: optimization pre-work + bench harness expansion
- Add opt-in optimizations (defaults OFF)
  - Ret purity verifier: NYASH_VERIFY_RET_PURITY=1
  - strlen FAST enhancement for const handles
  - FAST_INT gate for same-BB SSA optimization
  - length cache for string literals in llvmlite
- Expand bench harness (tools/perf/microbench.sh)
  - Add branch/call/stringchain/arraymap/chip8/kilo cases
  - Auto-calculate ratio vs C reference
  - Document in benchmarks/README.md
- Compiler health improvements
  - Unify PHI insertion to insert_phi_at_head()
  - Add NYASH_LLVM_SKIP_BUILD=1 for build reuse
- Runtime & safety enhancements
  - Clarify Rust/Hako ownership boundaries
  - Strengthen receiver localization (LocalSSA/pin/after-PHIs)
  - Stop excessive PluginInvoke→BoxCall rewrites
- Update CURRENT_TASK.md, docs, and canaries

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-13 16:40:58 +09:00
0d41970313 feat(phase21.5): strlen FAST EXE + loop JSONFrag diagnostics
## Task A: emit v0 boxcall (bin version) 
- Fix: emit_mir_json_for_harness_bin now handles I::Call with Callee::Method
- Added: Proper v0 boxcall emission when NYASH_MIR_UNIFIED_CALL=0
- Location: src/runner/mir_json_emit.rs:641-707
- Test: emit_boxcall_length_canary_vm.sh → PASS

## Task B: strlen FAST EXE (AOT without plugin) 
- Fix: FAST lowering now tracks newbox(StringBox) creation
- Added: newbox_string_args fallback in boxcall.py (lines 133-143)
- Added: StringBox tracking in newbox.py (lines 82-91)
- Benefit: EXE can compute string.length() without StringBox plugin
- Test: s3_backend_selector_crate_exe_strlen_fast_canary_vm.sh → PASS (rc=5)

## Task 1: selfhost-first Diagnostic Logging 
- Added: HAKO_SELFHOST_TRACE=1 outputs Program JSON stats
- Added: HAKO_SELFHOST_NO_DELEGATE=1 shows detailed failure logs
- Added: [builder/selfhost-first:fail:*] markers + last 80 lines
- Location: tools/hakorune_emit_mir.sh:try_selfhost_builder()

## Task 2: loop JsonFrag Hit Rate Improvement 
- Added: FORCE=1 fallback for non-Lt comparison operators
- Added: find_any_local_int_before() fallback when strict fails
- Location: lang/src/mir/builder/internal/lower_loop_simple_box.hako
- Benefit: Higher JSONFrag hit rate under HAKO_MIR_BUILDER_LOOP_FORCE_JSONFRAG=1

## Task 3: crate EXE Failure Diagnostics 
- Added: LLVM IR dump on build failure (first 120 lines)
- Added: Build error log capture (last 40 lines)
- Location: tools/smokes/v2/profiles/quick/core/phase2100/stageb_loop_jsonfrag_crate_exe_canary_vm.sh

## Test Results
- emit_boxcall_length: PASS 
- strlen_fast (FAST=1): PASS (rc=5) 
- loop_jsonfrag: SKIP (diagnostic enhanced) ⚠️

## Implementation Principles
- 既定挙動不変 (Default unchanged)
- Dev toggle guarded (FAST=1, FORCE=1, TRACE=1, NO_DELEGATE=1)
- Minimal diff, easy rollback
- Clear failure diagnostics for future fixes

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-11 05:50:23 +09:00
a5054a271b llvm(py): introduce BuildCtx + trace hub; refactor if-merge prepass + PHI wiring into module; unify logs; ctx-enable compare/ret/call/boxcall/externcall/typeop/newbox/safepoint; curated smoke option for if-merge; README updates; keep behavior stable 2025-09-17 16:11:01 +09:00
63c8fda808 🔍 Research: GPT-5-Codex capabilities and GitHub PR integration
## Summary
Investigated OpenAI's new GPT-5-Codex model and Codex GitHub PR review integration capabilities.

## GPT-5-Codex Analysis

### Benchmark Performance (Good)
- SWE-bench Verified: 74.5% (vs GPT-5's 72.8%)
- Refactoring tasks: 51.3% (vs GPT-5's 33.9%)
- Code review: Higher developer ratings

### Real-World Issues (Concerning)
- Users report degraded coding performance
- Scripts that previously worked now fail
- Less consistent than GPT-4.5
- Longer response times (minutes vs instant)
- "Creatively and emotionally flat"
- Basic errors (e.g., counting letters incorrectly)

### Key Finding
Classic case of "optimizing for benchmarks vs real usability" - scores well on tests but performs poorly in practice.

## Codex GitHub PR Integration

### Setup Process
1. Enable MFA and connect GitHub account
2. Authorize Codex GitHub app for repos
3. Enable "Code review" in repository settings

### Usage Methods
- **Manual**: Comment '@codex review' in PR
- **Automatic**: Triggers when PR moves from draft to ready

### Current Limitations
- One-way communication (doesn't respond to review comments)
- Prefers creating new PRs over updating existing ones
- Better for single-pass reviews than iterative feedback

## 'codex resume' Feature
New session management capability:
- Resume previous codex exec sessions
- Useful for continuing long tasks across days
- Maintains context from interrupted work

🐱 The investigation reveals that while GPT-5-Codex shows benchmark improvements, practical developer experience has declined - a reminder that metrics don't always reflect real-world utility\!
2025-09-16 16:28:25 +09:00
1d6fab4eda 📚 Phase 15計画を詳細化・更新: Python/llvmlite正式採用とプラグイン全方向ビルド戦略
 主な更新内容:
- Python/llvmlite実装の正式採用を明記(開発速度10倍、~2400行)
- プラグイン全方向ビルド戦略(.so/.o/.a同時生成)で単一EXE生成可能に
- 各実装の予想コード量を具体化(パーサー800行、MIR Builder 2500行、VM 5000行)
- 循環依存問題の解決を明記(nyrtがC ABI経由で提供)
- 現実的なスケジュール調整(2025年9月~2026年3月)

🎉 最新進捗:
- dep_tree_min_string.nyashオブジェクト生成成功(10.4KB)
- LLVM verifier green - dominance違反解決
- Resolver patternでSSA安全性確保

🚀 次のマイルストーン:
- Python/llvmliteでEXE生成パイプライン完成
- nyash-llvm-compiler分離設計
- NyashパーサーMVP実装開始

Everything is Boxの究極形が、ついに実現へ!

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-13 15:37:58 +09:00
ef44801fa6 Python LLVM backend implementation (experimental)
- Created llvmlite-based LLVM backend in src/llvm_py/
- Implemented all MIR14 instructions (const, binop, jump, branch, ret, compare, phi, call, boxcall, externcall, typeop, newbox, safepoint, barrier)
- Experimental LoopForm support
- ~2000 lines of clean Python code vs complex Rust/inkwell
- Useful for PHI/SSA validation and rapid prototyping
- Added documentation to CLAUDE.md

This was created while waiting for ChatGPT's investigation of BuilderCursor issues.
2025-09-12 20:55:13 +09:00