blob: 8ee37e5858235498593b3c1a6dce5f4ddaf7d724 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
FFI & callbacks
===============
There are at least 4 cases:
* SLUL calling C (and potentially calling SLUL again)
* C calling SLUL (and potentially calling C again)
* C starting SLUL code (potentially calling C again)
* SLUL starting C code (potentially calling SLUL again)
Problems:
* Passing "user_pointers" back
- what if there are nested calls in several layers?
use the latest/"topmost" one?
* Givemes
* Function coloring
- pure vs mutable vs I/O
- asynchronous vs synchronous
- async-cancellable vs not
* Exceptions / synchronous errors in callbacks
* Asynchronous errors/termination in callbacks
User pointers, Givemes
----------------------
Require that all C code passes:
- a "context" parameter (for the SLUL code)
- a "user_param" parameter (for any C callbacks)
Require that SLUL callbacks work through services/entrys?
- the C code would indirectly (via the SLUL runtime or similar,
possibly via some context parameter) provide the givemes.
Function coloring, Exceptions in callbacks
------------------------------------------
TODO. Some ideas:
* Run C code out-of-process (slow)
* Provide a virtual implementation of the libc (hard, but fast)
* Proxy some libc functions:
- do special things on exit(), signal(), etc?
- track resources?
- track I/O?
Maybe calling C code should be completely forbidden in pure functions?
Or:
* Run C code in an emulator(!) (very slow)
* Run C code with a fully virtual libc (slow, hard)
- it must be unable to write to SLUL memory
- it must be unable to do anything to the OS
- it's internal state must be copy-on-write
- and changes discarded on return to SLUL
(but only the topmost "layer", in case of nested callbacks)
|