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
59
//! The link symbol an AOT-compiled Tcl binary needs.
//!
//! fusevm's AOT model embeds the serialized chunk in the object and, at
//! startup, rebuilds a VM from it and calls back into the frontend through the
//! C symbol `fusevm_aot_register_builtins` before running the native driver.
//! That callback is this crate's only contribution to the linked binary: it
//! installs the same numeric hook and extension dispatch the interpreter uses
//! ([`crate::runtime::install_hooks`]), so a script means the same thing
//! whichever tier runs it, and buffers the script's output.
//!
//! An error raised by an extension op is written to stderr here rather than
//! returned: fusevm's AOT entry owns the VM and maps its result to an exit
//! code, so there is no caller left to hand a message to.
use Mutex;
use VM;
/// Install the Tcl runtime on the VM an AOT binary is about to run.
///
/// # Safety
/// `vm` must point to a live, exclusively-borrowable `VM` — fusevm's AOT entry
/// (`fusevm_aot_run_embedded`) passes one it owns for the length of the call.
pub unsafe extern "C"
/// The hooks of the run in progress, readable after fusevm's AOT entry has
/// dropped the VM.
static PARKED: = new;
/// Drain and report an extension-op error left by an AOT run.
///
/// Called from the AOT binary's exit path — fusevm's `fusevm_aot_run_embedded`
/// maps the VM result to an exit code but cannot see an error an extension op
/// parked, so the C `main` calls this before exiting.
///
/// Returns 1 when an error was reported, 0 otherwise.
pub extern "C"