Update Phase 3 interface status and design notes in design doc
Mark is/as interface operators, IInterface built-in, and 2-field typeinfo (with impllist) as Done. Expand TYPEID entry to cover the impllist data layout.
This commit is contained in:
parent
514c0fb122
commit
ffcb1a041f
|
|
@ -724,10 +724,12 @@ are required for correct generic type bounds).
|
||||||
(zero-GUID design); `TInterfaceTypeDef` AST node; `tkIntf` token reused from
|
(zero-GUID design); `TInterfaceTypeDef` AST node; `tkIntf` token reused from
|
||||||
unit interface section (context disambiguates)
|
unit interface section (context disambiguates)
|
||||||
|
|
||||||
| TYPEID generation
|
| TYPEID generation + impllist
|
||||||
| Done
|
| Done
|
||||||
| `data $typeinfo_IFoo = { l 0 }` — address of block IS the identity token;
|
| `data $typeinfo_IFoo = { l 0 }` — address IS identity token; class typeinfo
|
||||||
emitted by `EmitInterfaceDefs`; used for future `is`/`as` interface checks
|
extended to 2 fields `{ l parent, l impllist }` where impllist is a
|
||||||
|
NULL-terminated `{typeinfo*, itab*}` pair array; emitted by `EmitInterfaceDefs`
|
||||||
|
/ `EmitTypeInfoDefs`
|
||||||
|
|
||||||
| Interface type in symbol table
|
| Interface type in symbol table
|
||||||
| Done
|
| Done
|
||||||
|
|
@ -761,19 +763,20 @@ are required for correct generic type bounds).
|
||||||
slot (slot × 8); indirect `call %fptr(l obj)` — same pattern as virtual dispatch
|
slot (slot × 8); indirect `call %fptr(l obj)` — same pattern as virtual dispatch
|
||||||
|
|
||||||
| `as` cast to interface
|
| `as` cast to interface
|
||||||
| Pending
|
| Done
|
||||||
| Checked downcast: verify class implements interface via typeinfo pointer walk;
|
| `F := T as IFoo` — codegen calls `_GetItab(obj, $typeinfo_IFoo)`; non-nil
|
||||||
raise `EInvalidCast` on failure
|
result stored to `F_itab`; nil triggers `_Raise_InvalidCast`; handled
|
||||||
|
inline in `EmitAssignment` (fat-pointer LHS + TAsExpr RHS)
|
||||||
|
|
||||||
| `is` test against interface
|
| `is` test against interface
|
||||||
| Pending
|
| Done
|
||||||
| Runtime check: walk class `implements` list for matching typeinfo pointer;
|
| `T is IFoo` — codegen calls `_ImplementsInterface(obj, $typeinfo_IFoo)`;
|
||||||
return boolean
|
walks class typeinfo impllist chain; RTL in `blaise_exc.c`
|
||||||
|
|
||||||
| RTL: `IInterface` base
|
| RTL: `IInterface` base
|
||||||
| Pending
|
| Done
|
||||||
| Minimal `IInterface` declaration in `System.pas` stub:
|
| `IInterface` pre-registered as built-in interface type in
|
||||||
`QueryInterface`, `_AddRef`, `_Release`; Blaise ARC replaces COM ref-counting
|
`TSymbolTable.RegisterBuiltins`; no methods (ARC replaces COM ref-counting)
|
||||||
|
|
||||||
|===
|
|===
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue