diff options
Diffstat (limited to 'chapter25/ROADMAP.md')
| -rw-r--r-- | chapter25/ROADMAP.md | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/chapter25/ROADMAP.md b/chapter25/ROADMAP.md index 749a1614..b5647587 100644 --- a/chapter25/ROADMAP.md +++ b/chapter25/ROADMAP.md @@ -462,3 +462,62 @@ Here: - Then it evaluates `z++`, which is false (0). - Since `&&` requires all conditions to be true, the final result `g` is 0. - All operands up to the false one are evaluated, so `x`, `y`, and `z` are all incremented. + +## Class initialization and compiler follow-ups + +### Entry arguments + +Replace the integer initializer argument with an argument array. The selected +entry class receives a non-null array, empty when there are no arguments; +other class initializers receive null. Coordinate the parser, entry signature, +runtime driver, and separately compiled interfaces. + +### Pre-initialize classes from ELF data + +Prove when a class's entire initialization can be represented by ELF static +data and relocations, with no remaining runtime effects. Emit its initial +contents and start its `$init` flag as true, so no initializer call is needed. +Carry that fact through separate compilation so importing compilers can remove +checks too. A constant field alone is not proof that the whole class can be +pre-initialized; I/O, argument-dependent work, and other observable effects +still require execution. Preserve any dynamic parent requirement, and do not +let cyclic dependencies justify their own pre-initialization. + +Mutable fields may have static initial contents without becoming constants. +Choose read-only storage only when no runtime writes remain. Static reference +cycles can use relocations without requiring a dynamic initialization cycle. + +For a wholly immutable, pre-initialized class, eliminate the mutable `$init` +state as well as the checks so the class image can reside in ROM. The native +function thunks preserve static initialization of function fields. + +### Compact code and data arenas + +Keep four-byte Simple references into bounded code and data arenas; the arenas +need not overlap or live near zero. Choose absolute addresses versus offsets +from an arena base when implementing placement and indirect calls. Native +function thunks can occupy the code arena while native libraries live elsewhere. +The current thunk implementation uses the existing low-address executable; +ordinary data pointers still occupy eight bytes. + +Give full-width native pointers separate types and foreign lifetime contracts. +Opaque device addresses may need to be passed through without CPU dereference. +Simple object lifetimes should be managed automatically without a GC; +ownership, borrowing, cycles, and native retention still need design. Compact +storage alone does not establish those rules. Preserve static class images and +explicit native boundary conversions when choosing the arena representation. + +### CFG frequency estimates + +After lowering and loop-tree construction, estimate block frequencies for GCM +and code layout. Treat initialization and known-failure paths as rare; use +bounded loop-trip estimates and branch probabilities when no profile is +available. Keep estimates consistent with control flow and shared between +scheduling and layout. These are backend estimates, not ideal-IR types. + +### Constant instance-field storage + +When a final instance field has the same constant value in every instance, +fold accesses or store the value on the class object and omit the instance +slot. Preserve field-access semantics and public function reachability: +externally accessible function fields remain callable regardless of storage. |
