Commit c3fa26e5
c3fa26e5c21dMerged
Yukihiro "Matz" Matsumoto <[email protected]> · 8 months ago · 1 file · ~1 modified
Description
Update PLAN.md — 7700 lines, 30 examples, catch/throw/alias/freeze done
New in feature table: catch/throw, method, alias, freeze/frozen?. Category 7 (control flow) now mostly complete. 30 test programs, 52 commits.
Added "sp_RbValue待ち" section listing features blocked on polymorphism: Comparable, Range-as-object, pattern matching, heterogeneous collections, duck typing.
Co-Authored-By: Claude Opus 4.6 (1M context) [email protected]
Details
- Commit
- c3fa26e5c21d
- Parent
- 82fd1f66f8b4
PLAN.mdmodifiedView file
@@ -10,7 +10,7 @@
1010
1111
## 現状 (Status)1212
13-
### コンパイラアーキテクチャ (~7600行のC)13+
### コンパイラアーキテクチャ (~7700行のC)1414
1515
- Prism (libprism) によるRubyパース1616
- 多パスコード生成:@@ -35,6 +35,8 @@
3535
| | `attr_accessor` / `attr_reader` / `attr_writer` |3636
| | クラスメソッド (`def self.foo`) |3737
| | `Struct.new(:x, :y)` — 合成クラス生成 |38+
| | `alias` — メソッド別名 |39+
| | `freeze`/`frozen?` — AOTでは全値がfrozen扱い |3840
| | getter/setter自動インライン化 |3941
| | コンストラクタ (`.new`)、型付きオブジェクトへのメソッド呼び出し |4042
| | モジュール (状態変数 + メソッド) |@@ -53,7 +55,8 @@
5355
| | for..in + Range, loop do |5456
| | break, next, return |5557
| | ternary, and/or/not |56-
| | `__LINE__`, `__FILE__` |58+
| | `__LINE__`, `__FILE__`, `__method__`, `defined?` |59+
| | `catch`/`throw` (タグ付き非局所脱出) |5760
| **例外処理** | begin/rescue/ensure/retry |5861
| | `raise "message"`, `raise ClassName, "message"` |5962
| | `rescue ClassName => e` (クラス階層チェック付き) |@@ -91,7 +94,7 @@
9194
| | シャドウスタックルート管理, ファイナライザ |9295
| | GC不要なプログラムではGCコード省略 |9396
94-
### テストプログラム (27例)97+
### テストプログラム (30例)9598
9699
| プログラム | テスト対象 |97100
|-----------|-----------|@@ -122,6 +125,9 @@
122125
| bm_exceptions | raise ClassName, rescue ClassName, 例外階層 |123126
| bm_block2 | block_given?, ブロック付きyield呼び出し |124127
| bm_fileio | File.read/write/exist?/delete |128+
| bm_catch | catch/throw (タグ付き非局所脱出) |129+
| bm_features | __method__, freeze/frozen? |130+
| bm_comparable | alias メソッド別名 |125131
126132
### ベンチマーク結果127133
@@ -149,13 +155,16 @@
149155
| 4 | **組込クラス** | 一部完了 | Time, Range-as-object, Enumerator |150156
| 5 | **完全なString** | 未着手 | sp_String構造体 (ミュータブル + encoding) |151157
| 6 | **オブジェクトシステム完全性** | 未着手 | method_missing等はインタプリタフォールバック |152-
| 7 | **制御フロー完全性** | 一部完了 | catch/throw, `__method__` |158+
| 7 | **制御フロー完全性** | ほぼ完了 ✅ | 残: BEGIN/END のみ |153159
| 8 | **パターンマッチ** | 未着手 | sp_RbValue (ポリモーフィズム) が前提 |154160
| 9 | **例外階層** | 完了 ✅ | raise ClassName, rescue ClassName, 継承チェック |155161
| 10 | **GC完全性** | 一部完了 | 文字列GC (sp_String), 世代別GC |156162
157163
### 完了した項目158-
- ✅ `__LINE__`, `__FILE__`, `defined?`164+
- ✅ `__LINE__`, `__FILE__`, `defined?`, `__method__`165+
- ✅ `catch`/`throw` (タグ付き非局所脱出、ネスト対応)166+
- ✅ `freeze`/`frozen?` (AOTではno-op / 常にTRUE)167+
- ✅ `alias` (メソッド別名)159168
- ✅ `block_given?`, ブロック変数のwrite-capture修正160169
- ✅ `raise ClassName, "msg"`, `rescue ClassName => e`, 例外クラス継承チェック161170
- ✅ `File.read/write/exist?/delete`@@ -224,6 +233,13 @@
224233
3. **互換性**: 最終的に全valid Rubyをコンパイル可能に225234
4. **NaN-boxing準備**: Phase 1をPhase 5で置き換え可能な設計226235
236+
### sp_RbValue待ちの機能237+
- `Comparable` モジュール (演算子メソッド `<=>` のC名サニタイズが必要)238+
- `Range` as object (sp_Range構造体 + メソッドセット)239+
- パターンマッチ `case/in` (型チェック分岐)240+
- 異種配列/Hash241+
- ダックタイピング242+
227243
---228244
229245
## プロジェクト構成@@ -233,8 +249,8 @@
233249
├── src/234250
│ ├── main.c # CLI、ファイル読み込み、Prismパース235251
│ ├── codegen.h # 型システム、クラス/メソッド/モジュール情報構造体236-
│ └── codegen.c # 多パスコード生成器 (~7600行)237-
├── examples/ # 27テストプログラム252+
│ └── codegen.c # 多パスコード生成器 (~7700行)253+
├── examples/ # 30テストプログラム238254
├── prototype/239255
│ └── tools/ # Step 0プロトタイプ (RBS抽出、LumiTrace等)240256
├── Makefile