.githooks/
compiler/
kernel/
lib/
scripts/
seed/
sublime/
test/
boot/
bootstrap/
compiler/
cycles/
dispatch/
format/
host/
integration/
kernel/
loader/
kernel/
grown.rad
1.2 KiB
hostile.rad
15.0 KiB
loaded.rad
586 B
machine.ras
731 B
manifests/
mmio/
native/
packages/
runtime/
scheduling/
shared/
slots/
smp/
std/
sync/
termination/
tests/
trap/
verify/
Makefile
9.2 KiB
kernel.rad
776 B
runner.rad
11.6 KiB
vim/
.gitignore
333 B
.gitsigners
224 B
AGENTS.md
8.3 KiB
CONTRIBUTING
2.1 KiB
LICENSE
1.1 KiB
Makefile
2.5 KiB
README
3.4 KiB
STYLE
3.2 KiB
std.lib
2.1 KiB
std.lib.test
1.1 KiB
test/loader/loaded.rad
raw
| 1 | //! A package executed by both hosted compilation and the kernel loader. |
| 2 | |
| 3 | /// Counter owned by each package instance. |
| 4 | unsafe static counter: i64 = 1; |
| 5 | /// Read-only table of slices into this instance's initialized data, which the loader relocates. |
| 6 | constant FACTORS: [*[u8]; 2] = ["6", "7"]; |
| 7 | |
| 8 | /// Compute a result through a package-local call. |
| 9 | unsafe fn calculate(value: i64) -> i64 { |
| 10 | set counter += value * (FACTORS[0][0] as i64 - 48); |
| 11 | return counter; |
| 12 | } |
| 13 | |
| 14 | /// Return the result checked by both execution paths. |
| 15 | @default unsafe fn main() -> i32 { |
| 16 | return calculate(7) as i32; |
| 17 | } |