Skip to content

Commit 9cb7418

Browse files
committed
Examine the optional interfaces, which nothing did
⚠️⚠️ THE STEP WAS NAMED "Every interface, every kind of examination" AND SELECTED THE HOSTED SET. `full' expands to `standard,abi,stability,cost' and `standard' is `core,env,time,fs,process,task'. The five interfaces openkal 0.8 added --- net, datagram, timeout, exec, space --- are in `optional', and this implementation provides all of them; without naming that set the suite compiled each of their sections with the body removed and reported them as not examined. Nothing failed. Nothing was checked either, and the sections had been written, merged and released in that state. Measured after the change, on this machine: 143 observations held, 0 did not hold, 1 not observed --- the one being openkal.terminal, which needs a standard stream that is interactive and has none in a pipeline. Also records why `kal_exec_publish' does NOT invalidate the instruction cache here while openkal-macos and openkal-windows do. The specification places that maintenance upon the program and the conformance suite performs it itself; on this implementation's three architectures `__builtin___clear_cache' becomes a CALL to `__riscv_flush_icache' on one of them, and acquiring a link-time dependency upon the compiler's support library --- in an implementation that sits beneath a C library, for an operation the specification does not require of it --- is a worse trade than the asymmetry. The comment is the change; the code is unaltered, so no version moves.
1 parent c096389 commit 9cb7418

2 files changed

Lines changed: 43 additions & 1 deletion

File tree

‎.github/workflows/ci.yml‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,20 @@ jobs:
172172
173173
- name: Every interface, every kind of examination
174174
run: |
175-
bash .spec/tools/run-conformance.sh openkal-linux . full
175+
# ⚠️⚠️ `optional` IS PART OF THE SET AND WAS NOT, WHICH MADE THE STEP'S
176+
# OWN NAME UNTRUE.
177+
#
178+
# `full` expands to `standard,abi,stability,cost`, and `standard` is
179+
# the HOSTED set — core, env, time, fs, process, task. The five
180+
# interfaces openkal 0.8 added are in `optional`, and this
181+
# implementation provides all of them; without naming that set the
182+
# suite compiled their sections with the bodies removed and reported
183+
# them as not examined. Nothing failed, and nothing was checked.
184+
#
185+
# This implementation is the one that may name `optional` entire: it
186+
# is the only one providing every interface, which is why it is the
187+
# reference. A backend that declines one names the others by hand.
188+
bash .spec/tools/run-conformance.sh openkal-linux . full,optional
176189
177190
- name: Point at the specification's working tree
178191
run: |

‎src/exec.cpp‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,35 @@ int kal_exec_publish(void* p, kal_uintptr size) {
4343
static_cast<okl_long>(bytes),
4444
okl::prot_read | okl::prot_exec);
4545
if (okl::failed(r)) return okl::translate(r);
46+
47+
// ⚠️⚠️ THE INSTRUCTION CACHE IS NOT INVALIDATED HERE, AND THE OTHER TWO
48+
// IMPLEMENTATIONS DO INVALIDATE IT. THE ASYMMETRY IS DELIBERATE.
49+
//
50+
// A processor with separate caches for data and instructions has just had
51+
// bytes written through the data path that it is about to fetch through the
52+
// instruction path, and nothing in the protection call makes the second path
53+
// observe the first's writes.
54+
//
55+
// ⭐ THE SPECIFICATION PLACES THE MAINTENANCE UPON THE PROGRAM, and the
56+
// conformance suite performs it itself and says why: the program is the
57+
// party that knows which bytes it wrote. So an implementation that performs
58+
// it is being helpful rather than conforming, and one that does not is not
59+
// deficient.
60+
//
61+
// ⚠️ AND HERE IT WOULD COST SOMETHING THE OTHER TWO DO NOT PAY.
62+
// `__builtin___clear_cache' expands to nothing on x86_64 and to a
63+
// maintenance sequence on aarch64 --- and on riscv64 it becomes a CALL to
64+
// `__riscv_flush_icache', which lives in the compiler's support library.
65+
// This implementation sits beneath a C library and is linked into programs
66+
// that carry no other runtime; acquiring a link-time dependency upon that
67+
// library, on one architecture, to perform an operation the specification
68+
// does not require of it, is a worse trade than the asymmetry.
69+
//
70+
// openkal-macos reaches both of its architectures with the builtin alone
71+
// and openkal-windows has a system call for it, so neither pays that price
72+
// and both do it. The three agree about what the PROGRAM must do; they
73+
// differ in whether the implementation does it as well, which no program
74+
// that follows the specification can observe.
4675
return kal_ok;
4776
}
4877

0 commit comments

Comments
 (0)