Work / Virtual Machine / Linker

2011-02-19 23:30:01

Compiled Program Object

A Compiled Program Object (CPO) is the output of a successful pre-linkage of a vm program. the CPO contains enough information to allow any host executive to load and execute its contents. This is the data structure of the CPO:

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
/*

[4] magic number
[4] target architecture version
[8] datetime of file creation
[4] required stack size
[4] program namespace length
[n] program namespace string
[4] import count
    array of...
    [4] import identifier length
    [n] import identifier string
    [4] import reference count
        array of...
        [4] bytecode offset of import reference
[4] export count
    array of...
    [4] export identifier length
    [n] export identifier string
    [4] bytecode offset of export
[4] data segment size
[4] code segment size
[n] data segment
[n] code segment

*/

it is the responsibility of the executive to post-link the CPO into the runtime environment using the program metadata.