Every program the compiler links carries a manifest: one JSON document that says what the program was built for and what it may be told when it starts. It is part of the program file, so you can read it without running the program:

mica --inspect ./server
{"mica_manifest":1,"kind":"program","version":"1.4.0","compiler":{"version":"7.8.1","commit":"4104eee11"},"platform":{"operating_system":"linux","architecture":"arm64","encoding":"utf-32"},"optimization":{"profile":"release","checked":false,"profiling":false,"passes":["constant_folding","assembly_peephole","graph_allocator","il_static_single_assignment","function_inlining","loop_optimization"]},"memory":{"class":"hosted-heap","arena_bytes":null},"tasking":{"flavor":"multicore","carriers":2,"pinned":true,"processes":null},"runtime_profile":"full","floor":{"families":["tasking","tensor"]},"sanitizer":null,"stack_size_bytes":null,"runtime_flags":"sealed","gpu":{"device_code":false},"libraries":[{"name":"sqlite","language":"mica","version":"2.0.0","interface":"2a45ab4768448cb31a2e0c27afa8d7658a21774d18dece63629058a1add129e1"},{"name":"sqlite3","language":"c","version":"3.46.1","interface":null}],"interface":null,"image":{"mapped_bytes":233472,"data_bytes":9312,"zeroed_bytes":68928,"mica":{"data_bytes":9312,"zeroed_bytes":68928},"c_library":{"data_bytes":0,"zeroed_bytes":0},"split_reason":null}}

The same document is printed by the running program itself when it is started with the info runtime flag, beside what its start resolved:

./server +mica info -mica

Both read the same bytes, so the two answers always agree. The document is one line; pipe it into jq to read it comfortably:

mica --inspect ./server | jq .

The members

Every value is spelled the way the command line spells it, so each one reads as a flag you could have typed.

MemberMeaning
mica_manifestthe layout version, 1
kindwhat the file is: program, or library for an archive or a shared object
namea Mica library’s own name, as its source’s library heading writes it; absent from a program and from an archive of C objects
versionthe program’s or library’s own version, as its mica.project states it, or null when it states none
compiler.versionthe release of the compiler that built the program
compiler.committhe commit that compiler was built from, or null when its build recorded none
platform.operating_systemlinux
platform.architectureamd64 or arm64
platform.encodingutf-32 or utf-8, or null for an archive every encoding links: the standard library’s and the runtime floor’s
optimizationthe optimization set below, or null for an archive of C objects
optimization.profiledebug or release
optimization.checkedwhether the build keeps every runtime guard (checked in --optimize)
optimization.profilingwhether the build keeps the line table for a profiler (profiling in --optimize)
optimization.passesthe passes the build ran, in the words --optimize accepts; an empty list when it ran none. constant_folding stands in the list of O1 and O2, and every level computes its constants when it compiles
memory.classhosted-heap or fixed-arena
memory.arena_bytesthe fixed arena’s size in bytes, or null on the hosted heap, which has none
tasking.flavorsingle or multicore
tasking.carriersthe build’s carrier count: 1 for a single build, the --tasking multicore,<n> count, or null when the pool counts the machine’s processors at start
tasking.pinnedwhether the build pinned the count with ,fixed, so the carriers runtime flag is refused
tasking.processesthe build’s --processes count of worker processes that may run tasks placed on processes at once, or null when the program counts the processors it may use at start
runtime_profilethe runtime profile as --runtime-profile spells it: full, the floor with the scheduler and the tensor kernels, or light, the floor without them; for a library, the profile it was built for. null for an archive of C objects
floor.familiesa program’s: the optional parts of the runtime floor it was linked with, tasking (the scheduler) and tensor (the tensor kernels), an empty list on the light floor. mica --inspect on a runtime floor answers the same member, read from the floor itself
floor_familiesa library’s: the optional parts of the runtime floor its code reaches, its own and those of every Mica library it imports, an empty list for none. A program on a floor that leaves one of them out refuses the library at its import
sanitizerthe C sanitizer the program is linked under, address, undefined or thread as --sanitize spells it, or null when it is linked under none
stack_size_bytesthe --stack-size request, or null when the platform’s default stack serves
runtime_flagsthe runtime-flag policy: open, sealed, sealed,rtp or none
gpu.device_codewhether any code of the program or of a Mica library it links is placed on a GPU, so the program needs one to run
gpu.modulesthe device floor’s kernel modules the program carries: floor, the general kernels every program that places code on a GPU loads, and each of NVIDIA’s own attention and pointwise modules only in the number formats the program’s code computes in, as attention_float32 or pointwise_bfloat16. A half-precision attention brings attention_float32 along, which serves the shapes the half kernels do not take. A library names the modules its own code reaches, and a program that links it carries them too. Absent where no code is placed on a GPU
gpu.imagesthe NVIDIA card generations on which every kernel the program runs, the device floor’s and its own, comes precompiled, as sm_89; the program loads them ready there and never starts NVIDIA’s runtime compiler. On another generation its kernels compile when it starts, and so do its own kernels where it was built without the runtime compiler installed; +mica info says which holds on the card it finds. The device floor’s archive names the generations its own kernels come precompiled for. Absent where there are none
gpu.shared_floorthe device floor’s shared object the program or library needs by name, libmica-dragon-gpu-<arch>.so.<release>: a Mica shared library whose code, or whose libraries’ code, is placed on a GPU needs it, and so does a program built over a Mica shared library whose code or whose libraries’ code is, so every library of the process computes on one device floor. Absent where the program carries the device floor inside itself, as a program over archives alone does, or places no code on a GPU
librariesthe libraries the program was built against through contracts of its own, each with its name, its language, mica or c, and its version: the one its contract states or, for a C library whose contract names its pkg-config package, the one the building machine’s pkg-config answered, and null when there is none, and its interface, the digest its contract states, null for a C library; an empty list when there are none
interfacea library’s interface digest: the SHA-256 of the surface its contract states, which the contract its build emitted states as well. A program’s link compares it with the contract the program was built against and refuses an archive of another build by the library’s name. null for a program
no_contracta library whose file carries no contract states why: the refusal its contract would draw, one for each declaration it could not carry, with its way out. A program that imports the library from that file is refused by these words. Absent from a file that carries its contract and from a program

A reader checks mica_manifest first and refuses a version it does not know. New members can appear in a later release without a new version; the version changes only when a member changes its meaning or disappears.

The memory the image needs

For a program or a shared object, mica --inspect adds one member the file itself states: image, the memory the program image needs before any of its code runs, read from the file’s own headers the way size reads a C program.

MemberMeaning
mapped_bytesthe address space the loader maps for the file’s segments: the figure to hold against an address-space limit
data_bytesthe initialized data the image holds
zeroed_bytesthe zero-filled data: address space the loader maps, not resident memory, which grows only as the program touches it
micathe data and zeroed data of Mica’s own: everything that is not the C library’s, which is the program, the standard library, the runtime and the few bytes the C start files bring
c_librarythe C library’s data, told by name: a variable named in the C library or compiler support archive a static link reads (libc.a and libgcc.a for the image’s architecture), or one a source file of those archives keeps to itself. In a static link that is the C library’s named data; otherwise only a variable the program shares with the shared C library
split_reasonnull when the two owners are named, otherwise why they are not

The split reads the C library’s archives on the machine that runs mica --inspect, the same ones mica --static links, so the answer does not depend on where the compiler is installed. Data the C library holds without a name of its own, such as its relocated tables, counts on Mica’s side.

A stripped program keeps the three totals; mica and c_library are null and split_reason says the symbol table that tells the owners apart is gone. They are null too where the machine has no static C library for the image’s architecture, and then split_reason names the archives it looked for. A static archive is no image the loader maps, so its answer has no image.

A program-body variable of 64 KiB and above lives in static storage, part of the program image, as a global does in C, and so does every variable of a library’s body; a smaller program-body variable lives in the body’s frame on the stack. The loader maps the whole image when the program starts, and refuses an image larger than the address space the program may use before any of its code runs, so no program can report it. This program declares 128 MiB:

program BigBss;

imp
    WriteLn : std;

type
    Big = array[1..16777216] of int64;

var
    b : Big;

begin
    b[1] := 1;
    WriteLn("answered");
end.

Build it with the compiler’s defaults:

mica --compile --link --source BigBss.mica --build build

On an arm64 machine with no C compiler installed, as the Mica container is until you ask for one, the image of that build reads:

$ mica --inspect build/BigBss | jq .image
{
  "mapped_bytes": 134688768,
  "data_bytes": 3136,
  "zeroed_bytes": 134589560,
  "mica": null,
  "c_library": null,
  "split_reason": "the C library archives a static link reads are missing: libgcc.a"
}
$ prlimit --as=67108864 build/BigBss; echo $?
139

The three totals are read from the image’s own headers and need nothing else. The two owners need the compiler support archive libgcc.a, which a C compiler brings, in the container mica-container/devkit/mica-provision gcc. With it the same command names them: all 3136 and 134589560 bytes are Mica’s and the C library’s are 0, because this build loads the C library as a shared object and carries none of it.

Under a 64 MiB limit the kernel refuses the image at execve and the program ends by a segmentation fault, which the shell reports, without printing anything of its own; without the limit it prints answered. Compare mapped_bytes with the limit before the program runs.

The array’s 134217728 bytes stand in zeroed_bytes of every build of this program. What surrounds them belongs to the build: the figures above are those of an arm64 program at the debug tier, which is the default. An amd64 build of the same source maps 4,096 bytes more and holds a little less data, and a build at an optimizing tier maps less on either architecture. Of that difference, 139,264 bytes of zeroed_bytes are the storage the runtime writes a debugger’s readings into, which a debug build reserves and so does an optimizing build with profiling (what each level does). Read the figures of the binary you ship.

The folders it looks in

Beside image, mica --inspect reads one more member from the file itself: run_path, the folders the program or shared object looks in for its shared libraries when it starts, in the order they are searched.

$ mica --inspect app/bin/Main | jq -c .run_path
["$ORIGIN","$ORIGIN/../lib","$ORIGIN/mica-dragon-rt-sites-amd64","/usr/lib/mica-dragon-rt-sites-amd64"]

$ORIGIN is the folder the file itself stands in, so the entries hold wherever the program and its libraries are copied together. The last two entries name the shared runtime floor of the program’s tier, memory class and tasking flavor, here a debug build’s, beside the program and where the runtime package installed it; a program at an optimizing tier on the hosted heap with one carrier needs no entry for its floor, which the system’s library folder holds. A program over archives alone carries none and reads [], as does a file linked with --no-run-path whose contracts write no run path of their own, save a program whose shared floor is an installed variant other than the plain one, which keeps that variant’s folder, /usr/lib/mica-dragon-rt-sites-<arch> for a debug build; an archive is never started and reads null. The entries are read from the file’s DT_RUNPATH, or from DT_RPATH where it carries only that older tag (a contract’s --disable-new-dtags writes it), which the loader reads before LD_LIBRARY_PATH and for every library the process loads. Programs, libraries and imports says what the link writes there.

The last member, shared_floor, names the shared runtime floor the file needs, read from the same dynamic section: a Mica shared object and a program built over one run on the shared floor, the one floor of their process.

$ mica --inspect app/bin/Main | jq -c .shared_floor
"libmica-dragon-rt-amd64.so.7.8.1"

A program over archives alone carries its floor inside its file and reads null, as an archive does. Started, a program names the floor that serves it in its info answer.

Where it lives

The manifest is stored in the program file’s .mica.manifest section, which is loaded with the program. --strip removes the symbol table and keeps the manifest, so a shipped binary can still be inspected. A policy of none keeps it as well: that program reads no runtime flag, but its file still says what it is.

A library carries a manifest too, in its archive’s generated member or its shared object’s section: its kind is library, it states its own name and version, its interface digest and the libraries it was built against with theirs, and its memory class, sanitizer, stack request and runtime-flag policy are null, because those are decided by the program that links it. Its tasking states the flavor it was compiled for, with no carrier count, and its floor_families the optional parts of the floor its code reaches: a multicore program refuses a library compiled for one carrier, and a program on the light floor refuses, at its import, a library that reaches the scheduler or the tensor kernels, whatever profile the library was built for. A program linked by a tool other than the Mica compiler carries none.

A library carries its contract beside its manifest, in a section of its own, and mica --inspect on a library answers it as one more member, contract, after the manifest’s own: the document --emit-contract writes beside the archive, and the one a program imports through when it names the archive or the shared object in its contracts.

The standard library and the runtime floor carry one as well, the first member of each archive, naming the release and the commit of the compiler whose build made them. A program links only the standard library and the floor of its own compiler: before the linker runs, the compiler reads both manifests and refuses another compiler’s archive by name, as rustc refuses a crate another compiler built:

Failed to link: the standard library '/usr/lib/mica-stdlib-amd64.a' was built by the Mica compiler 7.6.0 (3176d5e33), and this is the Mica compiler 7.6.5 (8c1f2a0b4): a program links the standard library and the floors its own compiler's build made, which a release installs beside the compiler and 'scripts/build-compiler.sh' builds in a checkout

A Mica library is held to the same rule. Its code meets the program’s by conventions no contract states, the lock that guards every unit’s variables among them, so the compiler reads the manifest of every Mica library archive the program links as well, and refuses one another compiler built by the library’s name. The library is rebuilt with the program’s compiler:

Failed to link: the archive 'lib/Ledger.a' of the library 'Ledger' was built by the Mica compiler 7.7.2 (f753ad914), and this is the Mica compiler 7.7.3 (ff4e0896b): a library's code meets the program's by conventions no contract states, the lock that guards every unit's variables among them, so a program links the libraries its own compiler built; rebuild the library with this compiler

Refusals

mica --inspect reads one file and combines with no other flag. When it cannot answer, it prints one line on standard error and exits with status 1:

SituationThe line
the file does not existcannot inspect './server': no such file or directory
the file is not a binarycannot inspect './server.mica': it is neither an ELF file nor a static archive, so it carries no Mica manifest
the file carries no manifest'./libtool.so' carries no Mica manifest: every program, archive and shared object the Mica compiler links carries one
the manifest is damagedthe Mica manifest in './server' is damaged: unexpected end of JSON input
another flag beside itthe flag '-optimize' cannot be combined with '--inspect': the inspect mode reads one linked program and combines with no other flag
a further wordthe inspect mode reads one linked program, but 'extra' was given as well