modus
Menu
On this page

The module test_callee

A test module with one export. It uses the three things that a loader must get right: addresses in data (rebases), constant data, and private data that the module writes.

What it is for. It is the callee of the first test of the loader, which runs on the host with no machine: the modus tool loads it and test_caller with the loader of the system and calls the entry of test_caller (test_modules in tools/modustool/build/modules.odin). A wrong rebase gives a wrong address in operations, a wrong data segment gives a wrong count: either changes the result.

It is not in the boot image. The module lonely imports it, to show a load that fails for a missing import.

test_callee module with no entry

Hash
4202b2405b528110b5bbfbd592ccebd1e574d02fc2e8a1cc2c5a86f7eb7bc53a
Size
12288 bytes
Exports
1
Imports
0
Imported by
2
License
MIT

A test module with one export

FactValue
KindModules with no entry
Sourcesrc/modules/tests/test_callee
Boot imageno: not in the boot image
Build settingsnone: the defaults of the source
Importsnone
Imported by

Neighbours

What it imports, at its left, and what imports it, at its right: the part of the module graph that touches it.

test_callee test_caller lonely

Exports

ExportWhat it does
apply(operation: Integer, x: Integer) -> Integergives operations[operation](x), plus the number of calls so far

apply

apply(operation: , x: ) -> 

apply gives operations[operation](x), plus the number of calls so far.

  • operation: 0 doubles, 1 triples; only its lowest bit counts.
  • x: the integer.

The count of calls includes this call, so the first call of apply(0, 10) gives 21.

Parameters
  • operation:
  • x:
Result
Source
src/modules/tests/test_callee/main.odin:29

Read from the source of the module, as the build reads it to describe the exports (tools/modustool/build/describe.odin).

Integer wire form

A wire form of the module contract: one word of a call. A signed integer of 64 bits, in a register.