Skip to content

Commit e5bc33a

Browse files
feat(openkal-emscripten): the first implementation written above a C library (#393)
Every other implementation in this ecosystem is written on a kernel's own interface: a register discipline, a trap instruction, a table of numbers. Emscripten has no kernel to issue a call to; it has a C library over a JavaScript host, and clause 2 of the specification permits exactly this arrangement in as many words -- "an implementation may be built upon a C library, beneath one, or without one". TWELVE OF THE FIFTEEN INTERFACES, AND THE ABSENCE IS THE REPORT. `openkal.process`, `openkal.exec` and `openkal.space` are not there: no fork, no exec, no writable-then-executable memory, no second address space. A program that uses one of those seventeen names fails at LINK naming the symbol, which is clause 6.2's second time. Measured: wasm-ld: error: obj/main.o: undefined symbol: kal_process_spawn Providing them so that they returned an error would be the shape the specification forbids -- present and always failing, which the caller cannot tell from a condition. `openkal.task` is behind a feature, because `-pthread` selects a different C library build, memory model and loader contract on this platform. Without it the translation unit is empty and the eight symbols do not exist, which is the same treatment the three absent interfaces get and for the same reason. CONFORMANCE, measured with emsdk 6.0.9 under node: 86 held, 0 did not hold, 13 not observed. The exported surface is 86 names, twelve complete groups, three absent groups, and nothing beginning with `kal_` the specification does not name. The package's own CI asserts all four, plus the task gate in both directions. Both mirrors GET-verified byte for byte against the upstream tag archive: GLOBAL github.com/mcpplibs/openkal-emscripten/archive/refs/tags/0.1.0.tar.gz CN gitcode.com/mcpp-res/openkal-emscripten/releases/download/0.1.0/... sha256 9c5ca4ae4c3bb22b127e2fbf6ca5bd4ecbdd80eac4a28018e3deb0c7ebd07b6d bytes 39383, and `cmp` of the two downloads is silent Listed for every platform because a platform table describes availability rather than applicability. A project selects it with a conditional dependency on `cfg(os = "emscripten")`, and one that selects it elsewhere fails at compile time. Co-authored-by: speak-agent <x.d2learn.org@gmail.com>
1 parent 9ea3271 commit e5bc33a

1 file changed

Lines changed: 74 additions & 0 deletions

File tree

pkgs/o/openkal-emscripten.lua

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
-- openkal-emscripten --- the first implementation written ABOVE a C library.
2+
--
3+
-- Every other implementation in this ecosystem is written on a kernel's own
4+
-- interface: a register discipline, a trap instruction, a table of numbers.
5+
-- Emscripten has no kernel to issue a call to; it has a C library over a
6+
-- JavaScript host, and clause 2 of the specification permits exactly this
7+
-- arrangement in as many words: "an implementation may be built upon a C
8+
-- library, beneath one, or without one."
9+
--
10+
-- Listed for every platform because a platform table describes availability
11+
-- rather than applicability. A project selects this implementation with a
12+
-- conditional dependency on cfg(os = "emscripten"); one that selects it
13+
-- elsewhere fails at compile time, which is the correct place for that
14+
-- failure.
15+
--
16+
-- IT PROVIDES TWELVE OF THE FIFTEEN INTERFACES, and the absence is the report.
17+
-- `openkal.process`, `openkal.exec` and `openkal.space` are not there: no
18+
-- fork, no exec, no writable-then-executable memory, no second address space.
19+
-- A program that uses one of those seventeen names fails at LINK naming the
20+
-- symbol, which is clause 6.2's second time -- the mechanism rather than a
21+
-- defect. Measured:
22+
--
23+
-- wasm-ld: error: obj/main.o: undefined symbol: kal_process_spawn
24+
--
25+
-- `openkal.task` is behind the `threads` feature, because `-pthread` selects a
26+
-- different C library build, memory model and loader contract on this
27+
-- platform. Without the feature its translation unit is empty and the eight
28+
-- symbols do not exist, which is the same treatment the three absent
29+
-- interfaces get.
30+
--
31+
-- Conformance, measured with emsdk 6.0.9 under node: 86 held, 0 did not hold,
32+
-- 13 not observed.
33+
package = {
34+
spec = "1",
35+
namespace = "mcpplibs",
36+
name = "openkal-emscripten",
37+
description = "An implementation of openkal for Emscripten, written above a C library rather than beneath one",
38+
licenses = {"Apache-2.0"},
39+
repo = "https://github.com/mcpplibs/openkal-emscripten",
40+
type = "package",
41+
42+
xpm = {
43+
linux = {
44+
["0.1.0"] = {
45+
url = {
46+
GLOBAL = "https://github.com/mcpplibs/openkal-emscripten/archive/refs/tags/0.1.0.tar.gz",
47+
CN = "https://gitcode.com/mcpp-res/openkal-emscripten/releases/download/0.1.0/openkal-emscripten-0.1.0.tar.gz",
48+
},
49+
sha256 = "9c5ca4ae4c3bb22b127e2fbf6ca5bd4ecbdd80eac4a28018e3deb0c7ebd07b6d",
50+
},
51+
},
52+
macosx = {
53+
["0.1.0"] = {
54+
url = {
55+
GLOBAL = "https://github.com/mcpplibs/openkal-emscripten/archive/refs/tags/0.1.0.tar.gz",
56+
CN = "https://gitcode.com/mcpp-res/openkal-emscripten/releases/download/0.1.0/openkal-emscripten-0.1.0.tar.gz",
57+
},
58+
sha256 = "9c5ca4ae4c3bb22b127e2fbf6ca5bd4ecbdd80eac4a28018e3deb0c7ebd07b6d",
59+
},
60+
},
61+
windows = {
62+
["0.1.0"] = {
63+
url = {
64+
GLOBAL = "https://github.com/mcpplibs/openkal-emscripten/archive/refs/tags/0.1.0.tar.gz",
65+
CN = "https://gitcode.com/mcpp-res/openkal-emscripten/releases/download/0.1.0/openkal-emscripten-0.1.0.tar.gz",
66+
},
67+
sha256 = "9c5ca4ae4c3bb22b127e2fbf6ca5bd4ecbdd80eac4a28018e3deb0c7ebd07b6d",
68+
},
69+
},
70+
},
71+
72+
-- The package's own manifest, inside the tarball's wrap directory.
73+
mcpp = "*/mcpp.toml",
74+
}

0 commit comments

Comments
 (0)