... | ... | @@ -38,12 +38,11 @@ fingerprint :: StaticPtr a -> Fingerprint |
|
|
lookup :: Fingerprint -> Maybe Dynamic -- or DynStaticPtr
|
|
|
```
|
|
|
|
|
|
|
|
|
Remarks:
|
|
|
**Remarks:**
|
|
|
|
|
|
- `deRefStaticPtr` so named to make its name consistent with `deRefStablePtr` in `GHC.StablePtr`. Other possibilities include `unstatic` or `unStaticPtr`.
|
|
|
- This module will be added to `base`, as for other primitives exposed by the compiler. This means we cannot depend on `bytestring` or any other package except `ghc-prim`.
|
|
|
- As such, we should leave it up to user libraries how they wish to encode `StaticPtr`, using whatever target type they wish (e.g. `ByteString`). The solution is to *not* provide encoders / decoders to some string-like type, but instead to map to/from `Fingerprint` (used as the name for each entry in the SPT), which the user can encode/decode as she wishes (that part need *not* be part of the TCB).
|
|
|
- As such, we should leave it up to user libraries how they wish to encode `StaticPtr`, using whatever target type they wish (e.g. `ByteString`). The solution is to *not* provide encoders / decoders to some string-like type, but instead to map to/from `GHC.Fingerprint.Fingerprint` (used as the name for each entry in the SPT), which the user can encode/decode as she wishes (that part need *not* be part of the TCB).
|
|
|
|
|
|
### Implementation notes
|
|
|
|
... | ... | @@ -64,10 +63,13 @@ Remarks: |
|
|
|
|
|
where `__static_f` is a fresh name.
|
|
|
|
|
|
- In the type checker, we add `Typeable a` to the set of constraints.
|
|
|
- All such `__static_*` definitions are considered SPT entries. All SPT entries are collected into the SPT for each module, constructed by the code produced by `mkModuleInit`.
|
|
|
- A global SPT constructed using the SPT from each module by the RTS just before `main` is invoked.
|
|
|
- The SPT is a hash table mapping `Fingerprint`s to `StaticPtr`s.
|
|
|
|
|
|
**Remark:** do we need `__static_f` at all? It looks like we could get `mkModuleInit` to generate the right code with all the entries, without the extra indirection.
|
|
|
|
|
|
### Appendix: notes about distributed-process
|
|
|
|
|
|
|
... | ... | |