From b3ec548422f6ec63f40e17cdca72f86927aa4f4e Mon Sep 17 00:00:00 2001 From: Cliff Click Date: Mon, 26 Oct 2026 18:42:42 -0700 Subject: More incremental loading and compilation. --- docs/appendices/native-libraries.md | 11 +++++++---- docs/roadmap.ja.md | 3 ++- docs/roadmap.md | 25 ++++++++++++++++--------- 3 files changed, 25 insertions(+), 14 deletions(-) (limited to 'docs') diff --git a/docs/appendices/native-libraries.md b/docs/appendices/native-libraries.md index 14cf0c6b..5412ab6a 100644 --- a/docs/appendices/native-libraries.md +++ b/docs/appendices/native-libraries.md @@ -13,15 +13,18 @@ make lib release ``` Make builds `build/release/Simple.jar` and, under the selected CPU/ABI directory, -`sys.o` and `simple_crt.o`. The default CPU is x86-64; the default calling +`sys.o`, the child objects under `sys/`, and `simple_crt.o`. The default CPU is x86-64; the default calling convention is win64 on Windows and SystemV elsewhere. Rebuild serialized objects after changing the compiler or object format. `src/main/smp/sys.smp` exposes child units for native libc bindings, I/O, characters, scanners, arrays, growable buffers, and bitsets. These compile into -one `sys.o`. Clients import its declarations and ideal IR and link calls that -remain out of line. Currently selecting that object loads all its saved IR; -member-selective loading and reliable incremental rebuilding remain future work. +one object per compilation unit. Clients read declarations and function +summaries first, then request an object's IR when considering inlining. +Native linking follows recorded object dependencies even when the optimizer +never loads their bodies. Install the complete object tree alongside `sys.o`; +there is no runtime object loading. Function-level IR loading within an object +and a complete incremental build driver remain future work. The `simple.sh`, `simple.ps1`, and `simple.bat` launchers set `SIMPLE_HOME` so the compiler can find the release library. The CLI accepts `-L` for additional diff --git a/docs/roadmap.ja.md b/docs/roadmap.ja.md index 964ff81c..6751325d 100644 --- a/docs/roadmap.ja.md +++ b/docs/roadmap.ja.md @@ -9,7 +9,8 @@ - 第25〜27章で、メソッドが狭いフィールドを更新した後に切り詰め前の値を返す問題を修正する。 - 依存関係全体を調べ、変更を伝播してから保存 IR を再利用する、正しい増分ビルドを実装する。 -- ライブラリオブジェクト全体ではなく、必要なメンバーの IR を選択してロードする。 +- 型の読み込みからネイティブリンクまでのライブラリ変更を検出する。SHA-256 を含むシンボルの照合は将来案であり、Eval2 は整合したビルドを前提とする。 +- コンパイル単位ごとの選択的ロードを、オブジェクト内の関数単位へ細分化する。 - 最適化後の関数サイズと安定した順位を使い、インライン化の選択を決定的にする。 - CFG の実行頻度推定、ループの回転、定数インスタンスフィールドの格納省略を検討する。 diff --git a/docs/roadmap.md b/docs/roadmap.md index 75ee8d54..29bc77de 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -35,7 +35,7 @@ signed and unsigned fields and compare ideal evaluation with generated code. ### Reliable incremental builds Chapter 28b now checks the reachable source-backed inputs before reusing saved -IR, including transitive dependencies, bundled sources, and missing inputs. +IR, including transitive dependencies and missing inputs. The remaining work is a build driver with recorded input identities, beyond those conservative timestamp checks. An unchanged public signature does not establish compatibility: optimization imports bodies and constants too. @@ -46,6 +46,11 @@ timestamps and changed library search paths. Distinguish rebuildable source from incompatible source-free libraries; their installation timestamps alone cannot validate a set of objects compiled against one another. +Native separate compilation should also detect a library changing between +reading its types and linking the executable. One possible mechanism is a +SHA-256-named symbol that callers require and the matching library defines. +This remains future link-time validation; Eval2 assumes a coherent build. + An unchanged build should do no compilation or linking. Publish outputs only after successful compilation, and relink when an object or other link input changes. Start with a small build driver and conservative rebuilding of every @@ -53,17 +58,19 @@ dependent; finer interface/body fingerprints can follow. The [incremental-build design](../skills/incremental-builds.md) records the input ownership rules and validation cases. -### Selective loading of library IR +### Function-level loading of library IR -Importing `sys.io.p` currently loads all ten units bundled in `sys.o`. -Independent, unrelated objects can remain unloaded, but selecting an object -reconstructs all its saved IR and follows its recorded dependencies. +Chapter 28b emits one object per compilation unit and reads declarations and +`SummaryNode` information without loading bodies. Optimization can request an +object's IR for inlining; Eval2 resolves its object dependencies before +execution, then materializes bodies on executed calls. Suspected +initialization cycles request full loading before type checking completes. +A requested object still reconstructs all of its functions. -Design member-level IR loading and dependency discovery together. Splitting -objects alone is insufficient while reexports and unused function bodies -still pull in their dependencies. Preserve type identity, initialization rules, +Further selectivity would require a function-body index within each object +and narrower metadata discovery. Preserve type identity, initialization rules, and imported escape summaries. Loading, initializing, and emitting a class -are separate decisions. This optimization is independent of making +remain separate decisions. This optimization is independent of making incremental rebuilding correct. ### Deterministic inlining -- cgit v1.2.3