@hxmc/cli 0.1.0-nightly.20261017.bbdcdb2 → 0.1.0-nightly.20261017.cb7df2c
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -3
- package/hxmc/bootstrap/hxmc-std/haxe/ds/StringMap.hx +1 -1
- package/hxmc/bootstrap/hxmc-std/hxmc/Native.hx +4 -0
- package/hxmc/bootstrap/hxmc-std/hxmc/NativeSys.hx +43 -40
- package/hxmc/bootstrap/hxmc-std/hxmc/rt/Arr.hx +11 -2
- package/hxmc/bootstrap/hxmc-std/hxmc/rt/Boxes.hx +21 -13
- package/hxmc/bootstrap/hxmc-std/hxmc/rt/Census.hx +2 -2
- package/hxmc/bootstrap/hxmc-std/hxmc/rt/Dyn.hx +14 -0
- package/hxmc/bootstrap/hxmc-std/hxmc/rt/LibM.hx +1 -1
- package/hxmc/bootstrap/hxmc-std/hxmc/rt/Runtime.hx +11 -0
- package/hxmc/bootstrap/hxmc-std/hxmc/rt/Ssl.hx +1 -1
- package/hxmc/bootstrap/hxmc-std/hxmc/rt/Types.hx +7 -0
- package/hxmc/bootstrap/hxmc-std/hxmc/rt/Uv.hx +1 -1
- package/hxmc/bootstrap/hxmc-std/hxmc/rt/gc/GcArr.hx +186 -0
- package/hxmc/bootstrap/hxmc-std/hxmc/rt/gc/GcBuf.hx +38 -0
- package/hxmc/bootstrap/hxmc-std/hxmc/rt/gc/GcBytes.hx +122 -0
- package/hxmc/bootstrap/hxmc-std/hxmc/rt/gc/GcDate.hx +100 -0
- package/hxmc/bootstrap/hxmc-std/hxmc/rt/gc/GcDyn.hx +34 -0
- package/hxmc/bootstrap/hxmc-std/hxmc/rt/gc/GcNative.hx +213 -0
- package/hxmc/bootstrap/hxmc-std/hxmc/rt/gc/GcStr.hx +312 -0
- package/hxmc/bootstrap/hxmc-std/hxmc/rt/gc/GcSys.hx +142 -0
- package/hxmc/bootstrap/hxmc-std/hxmc/rt/gc/W.hx +89 -0
- package/hxmc/bootstrap/hxmc-std/hxmc/unsafe/Arena.hx +1 -1
- package/hxmc/bootstrap/hxmc-std/hxmc/unsafe/CString.hx +1 -1
- package/hxmc/bootstrap/hxmc-std/hxmc/unsafe/Callback.hx +1 -1
- package/hxmc/bootstrap/hxmc-std/hxmc/unsafe/Float32.hx +1 -1
- package/hxmc/bootstrap/hxmc-std/hxmc/unsafe/Int16.hx +1 -1
- package/hxmc/bootstrap/hxmc-std/hxmc/unsafe/Int32.hx +1 -1
- package/hxmc/bootstrap/hxmc-std/hxmc/unsafe/Int64.hx +1 -1
- package/hxmc/bootstrap/hxmc-std/hxmc/unsafe/Int8.hx +1 -1
- package/hxmc/bootstrap/hxmc-std/hxmc/unsafe/LibC.hx +1 -1
- package/hxmc/bootstrap/hxmc-std/hxmc/unsafe/Mem.hx +1 -1
- package/hxmc/bootstrap/hxmc-std/hxmc/unsafe/Ptr.hx +1 -1
- package/hxmc/bootstrap/hxmc-std/hxmc/unsafe/Slice.hx +1 -1
- package/hxmc/bootstrap/hxmc-std/hxmc/unsafe/UInt16.hx +1 -1
- package/hxmc/bootstrap/hxmc-std/hxmc/unsafe/UInt32.hx +1 -1
- package/hxmc/bootstrap/hxmc-std/hxmc/unsafe/UInt64.hx +1 -1
- package/hxmc/bootstrap/hxmc-std/hxmc/unsafe/UInt8.hx +1 -1
- package/hxmc/bootstrap/launcher.mjs +1 -1
- package/package.json +8 -8
- package/hxmc/bootstrap/hxmc-std/hxmc/rt/Modules.hx +0 -39
package/README.md
CHANGED
|
@@ -49,7 +49,7 @@ editors, lix and rebuilding the compiler from source:
|
|
|
49
49
|
| `-D hxmc.wasm-eh=legacy` | wasm: legacy exception handling, for older browsers and runtimes |
|
|
50
50
|
| `HXMC_STATS=1` | what the build did and how long it took |
|
|
51
51
|
| `HXMC_CACHE=<dir>` | the cache directory (default: the user's cache folder) |
|
|
52
|
-
| `HXMC_MODULE_CACHE=
|
|
52
|
+
| `HXMC_MODULE_CACHE=0`, `-D hxmc.no-module-cache` | turn off the module cache (on by default: typed modules are kept between builds, a rebuild types only what changed) |
|
|
53
53
|
|
|
54
54
|
Rebuilds only recompile changed modules; `haxe --wait 6000` plus
|
|
55
55
|
`haxe --connect 6000 build.hxml` keeps everything in memory.
|
|
@@ -71,6 +71,10 @@ npm i -D @hxmc/gfx
|
|
|
71
71
|
| --- | --- |
|
|
72
72
|
| `@hxmc/os` | windows, input and the app loop: X11, Cocoa, Win32 and the browser canvas |
|
|
73
73
|
| `@hxmc/gfx` | a portable GPU API with back ends for GL/GLES (Linux), Metal (macOS), D3D11 (Windows), WebGPU and WebGL2 (browser), and shaders written in Haxe (compiled to GLSL, WGSL, MSL, HLSL); see `packages/gfx/examples/Triangle.hx` and `Cube.hx` |
|
|
74
|
+
| `@hxmc/text` | TrueType fonts in pure Haxe: parsing, an anti-aliased rasterizer, shaping with kerning and fallback fonts, bidi and Arabic shaping, line layout, a glyph atlas, the system's fonts |
|
|
75
|
+
| `@hxmc/view` | signals and JSX-like markup for Haxe on every target: fine-grained reactivity as Solid has it, markup compiled to direct calls on a renderer chosen at compile time; components are type-checked calls |
|
|
76
|
+
| `@hxmc/web` | `@hxmc/view` on the web: a DOM renderer (JavaScript), static HTML rendered at build time, hydration, islands in JavaScript or WebAssembly with a small loader, typed calls from JavaScript into wasm32-wasi modules |
|
|
77
|
+
| `@hxmc/ui` | a UI toolkit: a node tree with flexbox layout (checked against Chromium's), events and focus, drawn with the GPU on gfx or as the platform's controls, written in view's markup, widgets; see `packages/ui/examples/Todo.hx` |
|
|
74
78
|
|
|
75
79
|
## Building from source
|
|
76
80
|
|
|
@@ -105,8 +109,10 @@ commit (`make reference`).
|
|
|
105
109
|
| [docs/testing.md](docs/testing.md) | the harnesses, hxmc's corpus, graphics tests, CI, benchmarks |
|
|
106
110
|
| [docs/porting.md](docs/porting.md) | the rules for every change of the port |
|
|
107
111
|
| [docs/hxmc.md](docs/hxmc.md) | hxmc's pipeline, runtime, targets |
|
|
108
|
-
| [
|
|
109
|
-
| [
|
|
112
|
+
| [ROADMAP.md](ROADMAP.md) | the goals and what comes next |
|
|
113
|
+
| [docs/plans/](docs/plans/README.md) | design docs: open designs and decisions by area |
|
|
114
|
+
| [docs/plans/lowlevel.md](docs/plans/lowlevel.md) | C interop and low-level Haxe (design, partly built) |
|
|
115
|
+
| [docs/plans/ui.md](docs/plans/ui.md) | native controls or a drawn UI: the survey and the design of `@hxmc/ui` |
|
|
110
116
|
|
|
111
117
|
## License
|
|
112
118
|
|
|
@@ -185,7 +185,7 @@ class StringMap<T> implements haxe.Constraints.IMap<String, T> {
|
|
|
185
185
|
}
|
|
186
186
|
|
|
187
187
|
inline function hashOf(k:String):Int {
|
|
188
|
-
return hxmc.rt.Str.strHash(k);
|
|
188
|
+
return #if (hxmc.wasm_gc) hxmc.rt.gc.GcStr.strHash(k) #else hxmc.rt.Str.strHash(k) #end;
|
|
189
189
|
}
|
|
190
190
|
|
|
191
191
|
inline function find(k:String, h:Int):Int {
|
|
@@ -3,4 +3,8 @@ package hxmc;
|
|
|
3
3
|
// Reflection for the std implementations (Type and Reflect are Haxe code
|
|
4
4
|
// over these, also haxe.Int64.isInt64 and the maps' hashes): the dynamic
|
|
5
5
|
// access of the runtime, hxmc.rt.Dyn, under its API name.
|
|
6
|
+
#if (hxmc.wasm_gc)
|
|
7
|
+
typedef Native = hxmc.rt.gc.GcNative;
|
|
8
|
+
#else
|
|
6
9
|
typedef Native = hxmc.rt.Dyn;
|
|
10
|
+
#end
|
|
@@ -4,6 +4,9 @@ import hxmc.rt.PosixSys;
|
|
|
4
4
|
#if (hxmc.target == "wasm32-wasi")
|
|
5
5
|
import hxmc.rt.WasiSys;
|
|
6
6
|
#end
|
|
7
|
+
#if (hxmc.wasm_gc)
|
|
8
|
+
import hxmc.rt.gc.GcSys;
|
|
9
|
+
#end
|
|
7
10
|
import hxmc.rt.WinSys;
|
|
8
11
|
import hxmc.unsafe.Mem;
|
|
9
12
|
|
|
@@ -14,83 +17,83 @@ import hxmc.unsafe.Mem;
|
|
|
14
17
|
// hxmc.target=wasm32-wasi: its runtime is typed only then).
|
|
15
18
|
class NativeSys {
|
|
16
19
|
public static inline function print(s:String):Void {
|
|
17
|
-
#if (hxmc.target == "wasm32-wasi") WasiSys.print(s); #else if (Mem.os() == 2) WinSys.print(s) else PosixSys.print(s); #end
|
|
20
|
+
#if (hxmc.wasm_gc) GcSys.print(s); #elseif (hxmc.target == "wasm32-wasi") WasiSys.print(s); #else if (Mem.os() == 2) WinSys.print(s) else PosixSys.print(s); #end
|
|
18
21
|
}
|
|
19
22
|
|
|
20
23
|
public static inline function printErr(s:String):Void {
|
|
21
|
-
#if (hxmc.target == "wasm32-wasi") WasiSys.printErr(s); #else if (Mem.os() == 2) WinSys.printErr(s) else PosixSys.printErr(s); #end
|
|
24
|
+
#if (hxmc.wasm_gc) GcSys.printErr(s); #elseif (hxmc.target == "wasm32-wasi") WasiSys.printErr(s); #else if (Mem.os() == 2) WinSys.printErr(s) else PosixSys.printErr(s); #end
|
|
22
25
|
}
|
|
23
26
|
|
|
24
27
|
public static inline function args():Array<String>
|
|
25
|
-
return #if (hxmc.target == "wasm32-wasi") WasiSys.args() #else Mem.os() == 2 ? WinSys.args() : PosixSys.args() #end;
|
|
28
|
+
return #if (hxmc.wasm_gc) GcSys.args() #elseif (hxmc.target == "wasm32-wasi") WasiSys.args() #else Mem.os() == 2 ? WinSys.args() : PosixSys.args() #end;
|
|
26
29
|
|
|
27
30
|
// the program name as invoked (argv[0])
|
|
28
31
|
public static inline function argv0():Null<String>
|
|
29
|
-
return #if (hxmc.target == "wasm32-wasi") WasiSys.argv0() #else Mem.os() == 2 ? WinSys.argv0() : PosixSys.argv0() #end;
|
|
32
|
+
return #if (hxmc.wasm_gc) GcSys.argv0() #elseif (hxmc.target == "wasm32-wasi") WasiSys.argv0() #else Mem.os() == 2 ? WinSys.argv0() : PosixSys.argv0() #end;
|
|
30
33
|
|
|
31
34
|
public static inline function getEnv(s:String):Null<String>
|
|
32
|
-
return #if (hxmc.target == "wasm32-wasi") WasiSys.getEnv(s) #else Mem.os() == 2 ? WinSys.getEnv(s) : PosixSys.getEnv(s) #end;
|
|
35
|
+
return #if (hxmc.wasm_gc) GcSys.getEnv(s) #elseif (hxmc.target == "wasm32-wasi") WasiSys.getEnv(s) #else Mem.os() == 2 ? WinSys.getEnv(s) : PosixSys.getEnv(s) #end;
|
|
33
36
|
|
|
34
37
|
public static inline function putEnv(s:String, v:Null<String>):Void {
|
|
35
|
-
#if (hxmc.target == "wasm32-wasi") WasiSys.putEnv(s, v); #else if (Mem.os() == 2) WinSys.putEnv(s, v) else PosixSys.putEnv(s, v); #end
|
|
38
|
+
#if (hxmc.wasm_gc) GcSys.putEnv(s, v); #elseif (hxmc.target == "wasm32-wasi") WasiSys.putEnv(s, v); #else if (Mem.os() == 2) WinSys.putEnv(s, v) else PosixSys.putEnv(s, v); #end
|
|
36
39
|
}
|
|
37
40
|
|
|
38
41
|
// "name=value"
|
|
39
42
|
public static inline function environ():Array<String>
|
|
40
|
-
return #if (hxmc.target == "wasm32-wasi") WasiSys.environ() #else Mem.os() == 2 ? WinSys.environ() : PosixSys.environ() #end;
|
|
43
|
+
return #if (hxmc.wasm_gc) GcSys.environ() #elseif (hxmc.target == "wasm32-wasi") WasiSys.environ() #else Mem.os() == 2 ? WinSys.environ() : PosixSys.environ() #end;
|
|
41
44
|
|
|
42
45
|
public static inline function sleep(seconds:Float):Void {
|
|
43
|
-
#if (hxmc.target == "wasm32-wasi") WasiSys.sleep(seconds); #else if (Mem.os() == 2) WinSys.sleep(seconds) else PosixSys.sleep(seconds); #end
|
|
46
|
+
#if (hxmc.wasm_gc) GcSys.sleep(seconds); #elseif (hxmc.target == "wasm32-wasi") WasiSys.sleep(seconds); #else if (Mem.os() == 2) WinSys.sleep(seconds) else PosixSys.sleep(seconds); #end
|
|
44
47
|
}
|
|
45
48
|
|
|
46
49
|
public static inline function getCwd():String
|
|
47
|
-
return #if (hxmc.target == "wasm32-wasi") WasiSys.getCwd() #else Mem.os() == 2 ? WinSys.getCwd() : PosixSys.getCwd() #end;
|
|
50
|
+
return #if (hxmc.wasm_gc) GcSys.getCwd() #elseif (hxmc.target == "wasm32-wasi") WasiSys.getCwd() #else Mem.os() == 2 ? WinSys.getCwd() : PosixSys.getCwd() #end;
|
|
48
51
|
|
|
49
52
|
public static inline function setCwd(s:String):Bool
|
|
50
|
-
return #if (hxmc.target == "wasm32-wasi") WasiSys.setCwd(s) #else Mem.os() == 2 ? WinSys.setCwd(s) : PosixSys.setCwd(s) #end;
|
|
53
|
+
return #if (hxmc.wasm_gc) GcSys.setCwd(s) #elseif (hxmc.target == "wasm32-wasi") WasiSys.setCwd(s) #else Mem.os() == 2 ? WinSys.setCwd(s) : PosixSys.setCwd(s) #end;
|
|
51
54
|
|
|
52
55
|
public static inline function systemName():String
|
|
53
|
-
return #if (hxmc.target == "wasm32-wasi") WasiSys.systemName() #else Mem.os() == 2 ? WinSys.systemName() : PosixSys.systemName() #end;
|
|
56
|
+
return #if (hxmc.wasm_gc) GcSys.systemName() #elseif (hxmc.target == "wasm32-wasi") WasiSys.systemName() #else Mem.os() == 2 ? WinSys.systemName() : PosixSys.systemName() #end;
|
|
54
57
|
|
|
55
58
|
// also under Cosmopolitan (whose systemName is "Linux")
|
|
56
59
|
public static inline function hostSystem():String
|
|
57
|
-
return #if (hxmc.target == "wasm32-wasi") WasiSys.hostSystem() #else Mem.os() == 2 ? WinSys.hostSystem() : PosixSys.hostSystem() #end;
|
|
60
|
+
return #if (hxmc.wasm_gc) GcSys.hostSystem() #elseif (hxmc.target == "wasm32-wasi") WasiSys.hostSystem() #else Mem.os() == 2 ? WinSys.hostSystem() : PosixSys.hostSystem() #end;
|
|
58
61
|
|
|
59
62
|
// through the shell
|
|
60
63
|
public static inline function command(cmd:String):Int
|
|
61
|
-
return #if (hxmc.target == "wasm32-wasi") WasiSys.command(cmd) #else Mem.os() == 2 ? WinSys.command(cmd) : PosixSys.command(cmd) #end;
|
|
64
|
+
return #if (hxmc.wasm_gc) GcSys.command(cmd) #elseif (hxmc.target == "wasm32-wasi") WasiSys.command(cmd) #else Mem.os() == 2 ? WinSys.command(cmd) : PosixSys.command(cmd) #end;
|
|
62
65
|
|
|
63
66
|
// Windows: without a shell; -2 elsewhere
|
|
64
67
|
public static inline function commandArgs(cmd:String, args:Array<String>):Int
|
|
65
|
-
return #if (hxmc.target == "wasm32-wasi") WasiSys.commandArgs(cmd, args) #else Mem.os() == 2 ? WinSys.commandArgs(cmd, args) : PosixSys.commandArgs(cmd, args) #end;
|
|
68
|
+
return #if (hxmc.wasm_gc) GcSys.commandArgs(cmd, args) #elseif (hxmc.target == "wasm32-wasi") WasiSys.commandArgs(cmd, args) #else Mem.os() == 2 ? WinSys.commandArgs(cmd, args) : PosixSys.commandArgs(cmd, args) #end;
|
|
66
69
|
|
|
67
70
|
public static inline function exit(code:Int):Void {
|
|
68
|
-
#if (hxmc.target == "wasm32-wasi") WasiSys.exit(code); #else if (Mem.os() == 2) WinSys.exit(code) else PosixSys.exit(code); #end
|
|
71
|
+
#if (hxmc.wasm_gc) GcSys.exit(code); #elseif (hxmc.target == "wasm32-wasi") WasiSys.exit(code); #else if (Mem.os() == 2) WinSys.exit(code) else PosixSys.exit(code); #end
|
|
69
72
|
}
|
|
70
73
|
|
|
71
74
|
public static inline function time():Float
|
|
72
|
-
return #if (hxmc.target == "wasm32-wasi") WasiSys.time() #else Mem.os() == 2 ? WinSys.time() : PosixSys.time() #end;
|
|
75
|
+
return #if (hxmc.wasm_gc) GcSys.time() #elseif (hxmc.target == "wasm32-wasi") WasiSys.time() #else Mem.os() == 2 ? WinSys.time() : PosixSys.time() #end;
|
|
73
76
|
|
|
74
77
|
public static inline function cpuTime():Float
|
|
75
|
-
return #if (hxmc.target == "wasm32-wasi") WasiSys.cpuTime() #else Mem.os() == 2 ? WinSys.cpuTime() : PosixSys.cpuTime() #end;
|
|
78
|
+
return #if (hxmc.wasm_gc) GcSys.cpuTime() #elseif (hxmc.target == "wasm32-wasi") WasiSys.cpuTime() #else Mem.os() == 2 ? WinSys.cpuTime() : PosixSys.cpuTime() #end;
|
|
76
79
|
|
|
77
80
|
public static inline function programPath():String
|
|
78
|
-
return #if (hxmc.target == "wasm32-wasi") WasiSys.programPath() #else Mem.os() == 2 ? WinSys.programPath() : PosixSys.programPath() #end;
|
|
81
|
+
return #if (hxmc.wasm_gc) GcSys.programPath() #elseif (hxmc.target == "wasm32-wasi") WasiSys.programPath() #else Mem.os() == 2 ? WinSys.programPath() : PosixSys.programPath() #end;
|
|
79
82
|
|
|
80
83
|
public static inline function getChar(echo:Bool):Int
|
|
81
|
-
return #if (hxmc.target == "wasm32-wasi") WasiSys.getChar(echo) #else Mem.os() == 2 ? WinSys.getChar(echo) : PosixSys.getChar(echo) #end;
|
|
84
|
+
return #if (hxmc.wasm_gc) GcSys.getChar(echo) #elseif (hxmc.target == "wasm32-wasi") WasiSys.getChar(echo) #else Mem.os() == 2 ? WinSys.getChar(echo) : PosixSys.getChar(echo) #end;
|
|
82
85
|
|
|
83
86
|
// files: descriptors
|
|
84
87
|
// 0 read, 1 write, 2 append, 3 update; -1 on error
|
|
85
88
|
public static inline function fileOpen(path:String, mode:Int):Int
|
|
86
|
-
return #if (hxmc.target == "wasm32-wasi") WasiSys.fileOpen(path, mode) #else Mem.os() == 2 ? WinSys.fileOpen(path, mode) : PosixSys.fileOpen(path, mode) #end;
|
|
89
|
+
return #if (hxmc.wasm_gc) GcSys.fileOpen(path, mode) #elseif (hxmc.target == "wasm32-wasi") WasiSys.fileOpen(path, mode) #else Mem.os() == 2 ? WinSys.fileOpen(path, mode) : PosixSys.fileOpen(path, mode) #end;
|
|
87
90
|
|
|
88
91
|
// 0 at end, -1 on error
|
|
89
92
|
public static inline function fileRead(fd:Int, b:haxe.io.Bytes, pos:Int, len:Int):Int
|
|
90
|
-
return #if (hxmc.target == "wasm32-wasi") WasiSys.fileRead(fd, b, pos, len) #else Mem.os() == 2 ? WinSys.fileRead(fd, b, pos, len) : PosixSys.fileRead(fd, b, pos, len) #end;
|
|
93
|
+
return #if (hxmc.wasm_gc) GcSys.fileRead(fd, b, pos, len) #elseif (hxmc.target == "wasm32-wasi") WasiSys.fileRead(fd, b, pos, len) #else Mem.os() == 2 ? WinSys.fileRead(fd, b, pos, len) : PosixSys.fileRead(fd, b, pos, len) #end;
|
|
91
94
|
|
|
92
95
|
public static inline function fileWrite(fd:Int, b:haxe.io.Bytes, pos:Int, len:Int):Int
|
|
93
|
-
return #if (hxmc.target == "wasm32-wasi") WasiSys.fileWrite(fd, b, pos, len) #else Mem.os() == 2 ? WinSys.fileWrite(fd, b, pos, len) : PosixSys.fileWrite(fd, b, pos, len) #end;
|
|
96
|
+
return #if (hxmc.wasm_gc) GcSys.fileWrite(fd, b, pos, len) #elseif (hxmc.target == "wasm32-wasi") WasiSys.fileWrite(fd, b, pos, len) #else Mem.os() == 2 ? WinSys.fileWrite(fd, b, pos, len) : PosixSys.fileWrite(fd, b, pos, len) #end;
|
|
94
97
|
|
|
95
98
|
// WebAssembly: the buffered standard output written out (elsewhere writes
|
|
96
99
|
// are not buffered)
|
|
@@ -99,65 +102,65 @@ class NativeSys {
|
|
|
99
102
|
}
|
|
100
103
|
|
|
101
104
|
public static inline function fileClose(fd:Int):Void {
|
|
102
|
-
#if (hxmc.target == "wasm32-wasi") WasiSys.fileClose(fd); #else if (Mem.os() == 2) WinSys.fileClose(fd) else PosixSys.fileClose(fd); #end
|
|
105
|
+
#if (hxmc.wasm_gc) GcSys.fileClose(fd); #elseif (hxmc.target == "wasm32-wasi") WasiSys.fileClose(fd); #else if (Mem.os() == 2) WinSys.fileClose(fd) else PosixSys.fileClose(fd); #end
|
|
103
106
|
}
|
|
104
107
|
|
|
105
108
|
public static inline function fileSeek(fd:Int, p:Int, whence:Int):Void {
|
|
106
|
-
#if (hxmc.target == "wasm32-wasi") WasiSys.fileSeek(fd, p, whence); #else if (Mem.os() == 2) WinSys.fileSeek(fd, p, whence) else PosixSys.fileSeek(fd, p, whence); #end
|
|
109
|
+
#if (hxmc.wasm_gc) GcSys.fileSeek(fd, p, whence); #elseif (hxmc.target == "wasm32-wasi") WasiSys.fileSeek(fd, p, whence); #else if (Mem.os() == 2) WinSys.fileSeek(fd, p, whence) else PosixSys.fileSeek(fd, p, whence); #end
|
|
107
110
|
}
|
|
108
111
|
|
|
109
112
|
public static inline function fileTell(fd:Int):Int
|
|
110
|
-
return #if (hxmc.target == "wasm32-wasi") WasiSys.fileTell(fd) #else Mem.os() == 2 ? WinSys.fileTell(fd) : PosixSys.fileTell(fd) #end;
|
|
113
|
+
return #if (hxmc.wasm_gc) GcSys.fileTell(fd) #elseif (hxmc.target == "wasm32-wasi") WasiSys.fileTell(fd) #else Mem.os() == 2 ? WinSys.fileTell(fd) : PosixSys.fileTell(fd) #end;
|
|
111
114
|
|
|
112
115
|
public static inline function fileContent(path:String):Null<haxe.io.Bytes>
|
|
113
|
-
return #if (hxmc.target == "wasm32-wasi") WasiSys.fileContent(path) #else Mem.os() == 2 ? WinSys.fileContent(path) : PosixSys.fileContent(path) #end;
|
|
116
|
+
return #if (hxmc.wasm_gc) GcSys.fileContent(path) #elseif (hxmc.target == "wasm32-wasi") WasiSys.fileContent(path) #else Mem.os() == 2 ? WinSys.fileContent(path) : PosixSys.fileContent(path) #end;
|
|
114
117
|
|
|
115
118
|
public static inline function fileSave(path:String, b:haxe.io.Bytes, append:Bool):Bool
|
|
116
|
-
return #if (hxmc.target == "wasm32-wasi") WasiSys.fileSave(path, b, append) #else Mem.os() == 2 ? WinSys.fileSave(path, b, append) : PosixSys.fileSave(path, b, append) #end;
|
|
119
|
+
return #if (hxmc.wasm_gc) GcSys.fileSave(path, b, append) #elseif (hxmc.target == "wasm32-wasi") WasiSys.fileSave(path, b, append) #else Mem.os() == 2 ? WinSys.fileSave(path, b, append) : PosixSys.fileSave(path, b, append) #end;
|
|
117
120
|
|
|
118
121
|
public static inline function exists(path:String):Bool
|
|
119
|
-
return #if (hxmc.target == "wasm32-wasi") WasiSys.exists(path) #else Mem.os() == 2 ? WinSys.exists(path) : PosixSys.exists(path) #end;
|
|
122
|
+
return #if (hxmc.wasm_gc) GcSys.exists(path) #elseif (hxmc.target == "wasm32-wasi") WasiSys.exists(path) #else Mem.os() == 2 ? WinSys.exists(path) : PosixSys.exists(path) #end;
|
|
120
123
|
|
|
121
124
|
public static inline function isDirectory(path:String):Bool
|
|
122
|
-
return #if (hxmc.target == "wasm32-wasi") WasiSys.isDirectory(path) #else Mem.os() == 2 ? WinSys.isDirectory(path) : PosixSys.isDirectory(path) #end;
|
|
125
|
+
return #if (hxmc.wasm_gc) GcSys.isDirectory(path) #elseif (hxmc.target == "wasm32-wasi") WasiSys.isDirectory(path) #else Mem.os() == 2 ? WinSys.isDirectory(path) : PosixSys.isDirectory(path) #end;
|
|
123
126
|
|
|
124
127
|
public static inline function createDirectory(path:String):Bool
|
|
125
|
-
return #if (hxmc.target == "wasm32-wasi") WasiSys.createDirectory(path) #else Mem.os() == 2 ? WinSys.createDirectory(path) : PosixSys.createDirectory(path) #end;
|
|
128
|
+
return #if (hxmc.wasm_gc) GcSys.createDirectory(path) #elseif (hxmc.target == "wasm32-wasi") WasiSys.createDirectory(path) #else Mem.os() == 2 ? WinSys.createDirectory(path) : PosixSys.createDirectory(path) #end;
|
|
126
129
|
|
|
127
130
|
public static inline function deleteFile(path:String):Bool
|
|
128
|
-
return #if (hxmc.target == "wasm32-wasi") WasiSys.deleteFile(path) #else Mem.os() == 2 ? WinSys.deleteFile(path) : PosixSys.deleteFile(path) #end;
|
|
131
|
+
return #if (hxmc.wasm_gc) GcSys.deleteFile(path) #elseif (hxmc.target == "wasm32-wasi") WasiSys.deleteFile(path) #else Mem.os() == 2 ? WinSys.deleteFile(path) : PosixSys.deleteFile(path) #end;
|
|
129
132
|
|
|
130
133
|
public static inline function deleteDirectory(path:String):Bool
|
|
131
|
-
return #if (hxmc.target == "wasm32-wasi") WasiSys.deleteDirectory(path) #else Mem.os() == 2 ? WinSys.deleteDirectory(path) : PosixSys.deleteDirectory(path) #end;
|
|
134
|
+
return #if (hxmc.wasm_gc) GcSys.deleteDirectory(path) #elseif (hxmc.target == "wasm32-wasi") WasiSys.deleteDirectory(path) #else Mem.os() == 2 ? WinSys.deleteDirectory(path) : PosixSys.deleteDirectory(path) #end;
|
|
132
135
|
|
|
133
136
|
public static inline function rename(path:String, newPath:String):Bool
|
|
134
|
-
return #if (hxmc.target == "wasm32-wasi") WasiSys.rename(path, newPath) #else Mem.os() == 2 ? WinSys.rename(path, newPath) : PosixSys.rename(path, newPath) #end;
|
|
137
|
+
return #if (hxmc.wasm_gc) GcSys.rename(path, newPath) #elseif (hxmc.target == "wasm32-wasi") WasiSys.rename(path, newPath) #else Mem.os() == 2 ? WinSys.rename(path, newPath) : PosixSys.rename(path, newPath) #end;
|
|
135
138
|
|
|
136
139
|
public static inline function readDirectory(path:String):Null<Array<String>>
|
|
137
|
-
return #if (hxmc.target == "wasm32-wasi") WasiSys.readDirectory(path) #else Mem.os() == 2 ? WinSys.readDirectory(path) : PosixSys.readDirectory(path) #end;
|
|
140
|
+
return #if (hxmc.wasm_gc) GcSys.readDirectory(path) #elseif (hxmc.target == "wasm32-wasi") WasiSys.readDirectory(path) #else Mem.os() == 2 ? WinSys.readDirectory(path) : PosixSys.readDirectory(path) #end;
|
|
138
141
|
|
|
139
142
|
// realpath; Windows: GetFullPathName (Extc.get_full_path)
|
|
140
143
|
public static inline function fullPath(path:String):Null<String>
|
|
141
|
-
return #if (hxmc.target == "wasm32-wasi") WasiSys.fullPath(path) #else Mem.os() == 2 ? WinSys.fullPath(path) : PosixSys.fullPath(path) #end;
|
|
144
|
+
return #if (hxmc.wasm_gc) GcSys.fullPath(path) #elseif (hxmc.target == "wasm32-wasi") WasiSys.fullPath(path) #else Mem.os() == 2 ? WinSys.fullPath(path) : PosixSys.fullPath(path) #end;
|
|
142
145
|
|
|
143
146
|
// Extc.get_real_path: Windows' spelling of an existing path; fullPath elsewhere
|
|
144
147
|
public static inline function realPath(path:String):Null<String>
|
|
145
|
-
return #if (hxmc.target == "wasm32-wasi") WasiSys.realPath(path) #else Mem.os() == 2 ? WinSys.realPath(path) : PosixSys.realPath(path) #end;
|
|
148
|
+
return #if (hxmc.wasm_gc) GcSys.realPath(path) #elseif (hxmc.target == "wasm32-wasi") WasiSys.realPath(path) #else Mem.os() == 2 ? WinSys.realPath(path) : PosixSys.realPath(path) #end;
|
|
146
149
|
|
|
147
150
|
// gid uid atime mtime ctime dev ino nlink rdev size mode
|
|
148
151
|
public static inline function stat(path:String):Null<Array<Float>>
|
|
149
|
-
return #if (hxmc.target == "wasm32-wasi") WasiSys.stat(path) #else Mem.os() == 2 ? WinSys.stat(path) : PosixSys.stat(path) #end;
|
|
152
|
+
return #if (hxmc.wasm_gc) GcSys.stat(path) #elseif (hxmc.target == "wasm32-wasi") WasiSys.stat(path) #else Mem.os() == 2 ? WinSys.stat(path) : PosixSys.stat(path) #end;
|
|
150
153
|
|
|
151
154
|
// processes
|
|
152
155
|
// pid, fds: stdin, stdout, stderr
|
|
153
156
|
public static inline function processRun(cmd:String, args:Null<Array<String>>, fds:Array<Int>):Int
|
|
154
|
-
return #if (hxmc.target == "wasm32-wasi") WasiSys.processRun(cmd, args, fds) #else Mem.os() == 2 ? WinSys.processRun(cmd, args, fds) : PosixSys.processRun(cmd, args, fds) #end;
|
|
157
|
+
return #if (hxmc.wasm_gc) GcSys.processRun(cmd, args, fds) #elseif (hxmc.target == "wasm32-wasi") WasiSys.processRun(cmd, args, fds) #else Mem.os() == 2 ? WinSys.processRun(cmd, args, fds) : PosixSys.processRun(cmd, args, fds) #end;
|
|
155
158
|
|
|
156
159
|
// exit code, -1 while running
|
|
157
160
|
public static inline function processWait(pid:Int, block:Bool):Int
|
|
158
|
-
return #if (hxmc.target == "wasm32-wasi") WasiSys.processWait(pid, block) #else Mem.os() == 2 ? WinSys.processWait(pid, block) : PosixSys.processWait(pid, block) #end;
|
|
161
|
+
return #if (hxmc.wasm_gc) GcSys.processWait(pid, block) #elseif (hxmc.target == "wasm32-wasi") WasiSys.processWait(pid, block) #else Mem.os() == 2 ? WinSys.processWait(pid, block) : PosixSys.processWait(pid, block) #end;
|
|
159
162
|
|
|
160
163
|
public static inline function processKill(pid:Int):Void {
|
|
161
|
-
#if (hxmc.target == "wasm32-wasi") WasiSys.processKill(pid); #else if (Mem.os() == 2) WinSys.processKill(pid) else PosixSys.processKill(pid); #end
|
|
164
|
+
#if (hxmc.wasm_gc) GcSys.processKill(pid); #elseif (hxmc.target == "wasm32-wasi") WasiSys.processKill(pid); #else if (Mem.os() == 2) WinSys.processKill(pid) else PosixSys.processKill(pid); #end
|
|
162
165
|
}
|
|
163
166
|
}
|
|
@@ -9,7 +9,7 @@ import hxmc.unsafe.Ptr;
|
|
|
9
9
|
|
|
10
10
|
// The Array natives (formerly in rt_std.c): generic natives over arrays of
|
|
11
11
|
// any element kind (rt.h: slot 0 the length and the element kind, slot 1
|
|
12
|
-
// the data, null while empty; Int elements take 4 bytes, others 8). The
|
|
12
|
+
// the data, null while empty; Int and Bool elements take 4 bytes, others 8). The
|
|
13
13
|
// element access, growth and kind conversion themselves stay in rt.c with
|
|
14
14
|
// the collector (hx_arr_*); here they are the language's own array
|
|
15
15
|
// operations on Array<Dynamic>, which go through them.
|
|
@@ -28,7 +28,7 @@ class Arr {
|
|
|
28
28
|
return Mem.getPtr(Mem.addr(a), 8);
|
|
29
29
|
|
|
30
30
|
static inline function elemSize(a:Dynamic):Int
|
|
31
|
-
return kindOf(a)
|
|
31
|
+
return ak4(kindOf(a)) ? 4 : 8;
|
|
32
32
|
|
|
33
33
|
// a new array of this kind and length (elements zero)
|
|
34
34
|
static function make(kind:Int, n:Int):Dynamic {
|
|
@@ -95,6 +95,13 @@ class Arr {
|
|
|
95
95
|
for (i in from...n)
|
|
96
96
|
if (Mem.getI32At(d, 0, i) == v) return i;
|
|
97
97
|
return -1;
|
|
98
|
+
case AK_BOOL:
|
|
99
|
+
if (Str.isNull(x) || tindex(x) != T_BOXBOOL) return -1;
|
|
100
|
+
var v = Mem.getI32(Mem.addr(x), 0);
|
|
101
|
+
var d = data(a);
|
|
102
|
+
for (i in from...n)
|
|
103
|
+
if (Mem.getI32At(d, 0, i) == v) return i;
|
|
104
|
+
return -1;
|
|
98
105
|
case AK_F64:
|
|
99
106
|
if (Str.isNull(x)) return -1;
|
|
100
107
|
var v:Float = x;
|
|
@@ -124,6 +131,8 @@ class Arr {
|
|
|
124
131
|
if (kindOf(a) == AK_PTR) {
|
|
125
132
|
var e = Mem.getRefAt(data(a), 0, i);
|
|
126
133
|
if (Mem.addr(e) == Mem.addr(x) || Dyn.dynEq(e, x)) return i;
|
|
134
|
+
} else if (kindOf(a) == AK_BOOL) {
|
|
135
|
+
if (!Str.isNull(x) && tindex(x) == T_BOXBOOL && Mem.getI32At(data(a), 0, i) == Mem.getI32(Mem.addr(x), 0)) return i;
|
|
127
136
|
} else if (!Str.isNull(x)) {
|
|
128
137
|
var v:Float = x;
|
|
129
138
|
var e = kindOf(a) == AK_I32 ? (Mem.getI32At(data(a), 0, i) : Float) : kindOf(a) == AK_F64 ? Mem.getF64At(data(a), 0, i) : {
|
|
@@ -139,13 +139,13 @@ class Boxes {
|
|
|
139
139
|
|
|
140
140
|
static inline function arrCap(a:Dynamic):Int {
|
|
141
141
|
var d = arrData(a);
|
|
142
|
-
return d.isNull() ? 0 : (Mem.getI32(d, -8) & 0x0FFFFFFF) << (arrKind(a)
|
|
142
|
+
return d.isNull() ? 0 : (Mem.getI32(d, -8) & 0x0FFFFFFF) << (ak4(arrKind(a)) ? 1 : 0);
|
|
143
143
|
}
|
|
144
144
|
|
|
145
145
|
static function dataAlloc(kind:Int, cap:Int):Dynamic {
|
|
146
146
|
if (cap < 1) cap = 1;
|
|
147
147
|
return switch kind {
|
|
148
|
-
case AK_I32: Mem.alloc((cap + 1) >> 1, T_ADATA_RAW, K_RAW);
|
|
148
|
+
case AK_I32 | AK_BOOL: Mem.alloc((cap + 1) >> 1, T_ADATA_RAW, K_RAW);
|
|
149
149
|
case AK_F64 | AK_I64: Mem.alloc(cap, T_ADATA_RAW, K_RAW);
|
|
150
150
|
case _: Mem.alloc(cap, T_ADATA_P, K_PARR);
|
|
151
151
|
}
|
|
@@ -180,7 +180,7 @@ class Boxes {
|
|
|
180
180
|
var len = arrLen(a);
|
|
181
181
|
var d = arrData(a);
|
|
182
182
|
if (!d.isNull()) {
|
|
183
|
-
var es = kind
|
|
183
|
+
var es = ak4(kind) ? 4 : 8;
|
|
184
184
|
LibC.memcpy(Mem.addr(nd), d, es * len);
|
|
185
185
|
if (kind == AK_PTR && !inYoungObj(nd)) Gc_barrierRange(nd, len);
|
|
186
186
|
}
|
|
@@ -203,7 +203,7 @@ class Boxes {
|
|
|
203
203
|
for (i in 0...len) {
|
|
204
204
|
a = Mem.getRef(slot, 0);
|
|
205
205
|
var k = arrKind(a);
|
|
206
|
-
var v:Dynamic = k == AK_I32 ? boxInt(Mem.getI32At(arrData(a), 0, i)) : k == AK_I64 ? boxI64(Mem.getI64At(arrData(a), 0, i)) : boxFloat(Mem.getF64At(arrData(a), 0, i));
|
|
206
|
+
var v:Dynamic = k == AK_I32 ? boxInt(Mem.getI32At(arrData(a), 0, i)) : k == AK_BOOL ? boxBool(Mem.getI32At(arrData(a), 0, i)) : k == AK_I64 ? boxI64(Mem.getI64At(arrData(a), 0, i)) : boxFloat(Mem.getF64At(arrData(a), 0, i));
|
|
207
207
|
Mem.setRefBarrier(nd, 8 * i, v);
|
|
208
208
|
}
|
|
209
209
|
a = Mem.getRef(slot, 0);
|
|
@@ -215,7 +215,7 @@ class Boxes {
|
|
|
215
215
|
if (Mem.addr(a).isNull() || !Mem.ult(i, arrLen(a))) return 0;
|
|
216
216
|
var d = arrData(a);
|
|
217
217
|
return switch arrKind(a) {
|
|
218
|
-
case AK_I32: Mem.getI32At(d, 0, i);
|
|
218
|
+
case AK_I32 | AK_BOOL: Mem.getI32At(d, 0, i);
|
|
219
219
|
case AK_F64: f2i(Mem.getF64At(d, 0, i));
|
|
220
220
|
case AK_I64: Mem.getI64At(d, 0, i).toInt();
|
|
221
221
|
case _: unboxInt(Mem.getRefAt(d, 0, i));
|
|
@@ -226,7 +226,7 @@ class Boxes {
|
|
|
226
226
|
if (Mem.addr(a).isNull() || !Mem.ult(i, arrLen(a))) return 0;
|
|
227
227
|
var d = arrData(a);
|
|
228
228
|
return switch arrKind(a) {
|
|
229
|
-
case AK_I32: Mem.getI32At(d, 0, i);
|
|
229
|
+
case AK_I32 | AK_BOOL: Mem.getI32At(d, 0, i);
|
|
230
230
|
case AK_F64: f2l(Mem.getF64At(d, 0, i));
|
|
231
231
|
case AK_I64: Mem.getI64At(d, 0, i);
|
|
232
232
|
case _: unboxI64(Mem.getRefAt(d, 0, i));
|
|
@@ -237,7 +237,7 @@ class Boxes {
|
|
|
237
237
|
if (Mem.addr(a).isNull() || !Mem.ult(i, arrLen(a))) return 0;
|
|
238
238
|
var d = arrData(a);
|
|
239
239
|
return switch arrKind(a) {
|
|
240
|
-
case AK_I32: Mem.getI32At(d, 0, i);
|
|
240
|
+
case AK_I32 | AK_BOOL: Mem.getI32At(d, 0, i);
|
|
241
241
|
case AK_F64: Mem.getF64At(d, 0, i);
|
|
242
242
|
case AK_I64:
|
|
243
243
|
var f:Float = cast Mem.getI64At(d, 0, i);
|
|
@@ -250,19 +250,23 @@ class Boxes {
|
|
|
250
250
|
if (Mem.addr(a).isNull() || !Mem.ult(i, arrLen(a))) return null;
|
|
251
251
|
return switch arrKind(a) {
|
|
252
252
|
case AK_I32: boxInt(Mem.getI32At(arrData(a), 0, i));
|
|
253
|
+
case AK_BOOL: boxBool(Mem.getI32At(arrData(a), 0, i));
|
|
253
254
|
case AK_F64: boxFloat(Mem.getF64At(arrData(a), 0, i));
|
|
254
255
|
case AK_I64: boxI64(Mem.getI64At(arrData(a), 0, i));
|
|
255
256
|
case _: Mem.getRefAt(arrData(a), 0, i);
|
|
256
257
|
}
|
|
257
258
|
}
|
|
258
259
|
|
|
259
|
-
// store v (of kind vk; AK_PTR: v is the address of a rooted slot) at i < length
|
|
260
|
+
// store v (of kind vk; AK_PTR: v is the address of a rooted slot) at i < length;
|
|
261
|
+
// a value the array's kind cannot hold (a Bool in an Int array, an Int in a
|
|
262
|
+
// Bool array) turns it into a reference array first
|
|
260
263
|
static function storeConv(slot:Ptr, i:Int, vk:Int, v:I64):Void {
|
|
261
264
|
var a:Dynamic = Mem.getRef(slot, 0);
|
|
262
265
|
var ak = arrKind(a);
|
|
263
266
|
if (ak == AK_PTR) {
|
|
264
267
|
var p:Dynamic = switch vk {
|
|
265
268
|
case AK_I32: boxInt(v.toInt());
|
|
269
|
+
case AK_BOOL: boxBool(v.toInt());
|
|
266
270
|
case AK_F64: boxFloat(haxe.io.FPHelper.i64ToDouble(v.toInt(), (v >> 32).toInt()));
|
|
267
271
|
case AK_I64: boxI64(v);
|
|
268
272
|
case _: Mem.getRef(new Ptr(v), 0);
|
|
@@ -273,16 +277,20 @@ class Boxes {
|
|
|
273
277
|
}
|
|
274
278
|
if (vk == AK_PTR) {
|
|
275
279
|
var p:Dynamic = Mem.getRef(new Ptr(v), 0);
|
|
276
|
-
var t = Mem.addr(p).isNull() ? T_BOXINT : tindex(p);
|
|
277
|
-
var fits =
|
|
278
|
-
|
|
280
|
+
var t = Mem.addr(p).isNull() ? (ak == AK_BOOL ? T_BOXBOOL : T_BOXINT) : tindex(p);
|
|
281
|
+
var fits = switch ak {
|
|
282
|
+
case AK_I32: t == T_BOXINT;
|
|
283
|
+
case AK_BOOL: t == T_BOXBOOL;
|
|
284
|
+
case AK_F64: t == T_BOXINT || t == T_BOXFLOAT;
|
|
285
|
+
case _: t == T_BOXINT || t == T_BOXI64;
|
|
286
|
+
}
|
|
279
287
|
if (!fits) {
|
|
280
288
|
arrToPtr(slot);
|
|
281
289
|
storeConv(slot, i, vk, v);
|
|
282
290
|
return;
|
|
283
291
|
}
|
|
284
292
|
var d = arrData(a);
|
|
285
|
-
if (ak
|
|
293
|
+
if (ak4(ak)) Mem.setI32At(d, 0, i, unboxInt(p)) else if (ak == AK_F64) Mem.setF64At(d, 0, i, unboxFloat(p)) else
|
|
286
294
|
Mem.setI64At(d, 0, i, unboxI64(p));
|
|
287
295
|
return;
|
|
288
296
|
}
|
|
@@ -292,7 +300,7 @@ class Boxes {
|
|
|
292
300
|
return;
|
|
293
301
|
}
|
|
294
302
|
var d = arrData(a);
|
|
295
|
-
if (ak
|
|
303
|
+
if (ak4(ak)) Mem.setI32At(d, 0, i, v.toInt()) else if (ak == AK_F64) {
|
|
296
304
|
if (vk == AK_I32) Mem.setF64At(d, 0, i, v.toInt()) else Mem.setI64At(d, 0, i, v);
|
|
297
305
|
} else
|
|
298
306
|
Mem.setI64At(d, 0, i, vk == AK_I32 ? (v.toInt() : I64) : v);
|
|
@@ -238,8 +238,8 @@ class Census {
|
|
|
238
238
|
} else if (t == Types.T_ARRAY && k == K_OBJ) {
|
|
239
239
|
var len = Mem.getI32(o, 0), kind = Mem.getI32(o, 4);
|
|
240
240
|
var d = Mem.getPtr(o, 8);
|
|
241
|
-
var cap = d.isNull() ? 0 : (nslotsOf(d) << (
|
|
242
|
-
var es =
|
|
241
|
+
var cap = d.isNull() ? 0 : (nslotsOf(d) << (Types.ak4(kind) ? 1 : 0));
|
|
242
|
+
var es = Types.ak4(kind) ? 4 : 8;
|
|
243
243
|
aN++;
|
|
244
244
|
aHdr += b;
|
|
245
245
|
if (d.isNull()) aNodata++;
|
|
@@ -288,6 +288,20 @@ class Dyn {
|
|
|
288
288
|
return k == TK_CLOSURE || k == TK_BOUND ? sup(t) : -1;
|
|
289
289
|
}
|
|
290
290
|
|
|
291
|
+
// c when it is a closure of the signature key (as rt_sig_keys has it), else
|
|
292
|
+
// null: a Dynamic converted to a function type keeps such a closure and
|
|
293
|
+
// wraps any other value in an adapter that calls it dynamically
|
|
294
|
+
// (FnLower.coerce)
|
|
295
|
+
@:hxmc.host("hx_clos_of_sig") static function closOfSig(c:Dynamic, key:String):Dynamic {
|
|
296
|
+
var s = closureSig(c);
|
|
297
|
+
if (s < 0) return null;
|
|
298
|
+
var k = Mem.getPtr(Mem.sym("rt_sig_keys"), 8 * s);
|
|
299
|
+
var n = key.length;
|
|
300
|
+
for (i in 0...n)
|
|
301
|
+
if (Mem.getU8At(k, 0, i) != StringTools.fastCodeAt(key, i)) return null;
|
|
302
|
+
return Mem.getU8At(k, 0, n) == 0 ? c : null;
|
|
303
|
+
}
|
|
304
|
+
|
|
291
305
|
// the argument count of signature s: the characters of its key before '_'
|
|
292
306
|
static function sigArgs(s:Int):Int {
|
|
293
307
|
var k = Mem.getPtr(Mem.sym("rt_sig_keys"), 8 * s);
|
|
@@ -4,7 +4,7 @@ import hxmc.I64;
|
|
|
4
4
|
import hxmc.unsafe.Mem;
|
|
5
5
|
import hxmc.unsafe.Ptr;
|
|
6
6
|
|
|
7
|
-
// Math on every target (docs/hxmc.md;
|
|
7
|
+
// Math on every target (docs/hxmc.md; docs/plans/math.md): the functions
|
|
8
8
|
// no instruction computes exactly, as musl computes them (musl's algorithms,
|
|
9
9
|
// and zig's ports of them in zig's libc and compiler_rt, which Linux
|
|
10
10
|
// executables linked before; see the license notice below), so that results
|
|
@@ -22,6 +22,17 @@ import hxmc.rt.wasm.Exit;
|
|
|
22
22
|
import hxmc.rt.wasm.Wasi;
|
|
23
23
|
import hxmc.rt.wasm.Libc;
|
|
24
24
|
import hxmc.rt.wasm.Threads;
|
|
25
|
+
// -D hxmc.wasm-gc's runtime (@:hxmc.wasmgc: the only one it binds, hxmc.wasmgc)
|
|
26
|
+
#if (hxmc.wasm_gc)
|
|
27
|
+
import hxmc.rt.gc.GcStr;
|
|
28
|
+
import hxmc.rt.gc.GcSys;
|
|
29
|
+
import hxmc.rt.gc.GcArr;
|
|
30
|
+
import hxmc.rt.gc.GcDyn;
|
|
31
|
+
import hxmc.rt.gc.GcBytes;
|
|
32
|
+
import hxmc.rt.gc.GcBuf;
|
|
33
|
+
import hxmc.rt.gc.GcNative;
|
|
34
|
+
import hxmc.rt.gc.GcDate;
|
|
35
|
+
#end
|
|
25
36
|
#else
|
|
26
37
|
// the native targets' runtime over the C library (@:hxmc.native): the
|
|
27
38
|
// collector, the threads, the start
|
|
@@ -8,7 +8,7 @@ import hxmc.unsafe.*;
|
|
|
8
8
|
// mbedtls behind hxmc.NativeSsl (the Eval natives of mbedtls.* and sys.ssl.*,
|
|
9
9
|
// src/macros/eval/EvalSsl.hx), mirroring the OCaml bindings
|
|
10
10
|
// haxe/libs/mbedtls/mbedtls_stubs.c used by haxe/src/macro/eval/evalSsl.ml;
|
|
11
|
-
// once C (rt_ssl.c), now Haxe calling mbedtls directly (
|
|
11
|
+
// once C (rt_ssl.c), now Haxe calling mbedtls directly (docs/plans/lowlevel.md).
|
|
12
12
|
// mbedtls itself stays the prebuilt ssl.o, linked when a program uses it.
|
|
13
13
|
//
|
|
14
14
|
// Contexts are T_NATIVE objects whose slot 0 holds the malloc'ed mbedtls
|
|
@@ -41,6 +41,13 @@ class Types {
|
|
|
41
41
|
public static inline var AK_I32 = 1;
|
|
42
42
|
public static inline var AK_F64 = 2;
|
|
43
43
|
public static inline var AK_I64 = 3;
|
|
44
|
+
// Bool: stored as AK_I32 is (4 bytes, 0 or 1), but read as Bool where the
|
|
45
|
+
// element is boxed (Std.string, Dynamic, reflection)
|
|
46
|
+
public static inline var AK_BOOL = 4;
|
|
47
|
+
|
|
48
|
+
// the elements of these kinds take 4 bytes
|
|
49
|
+
public static inline function ak4(k:Int):Bool
|
|
50
|
+
return k == AK_I32 || k == AK_BOOL;
|
|
44
51
|
|
|
45
52
|
// ---- headers: slot count bits 0..27, kind 28..31, type index 32..47,
|
|
46
53
|
// identity hash 48..63
|
|
@@ -9,7 +9,7 @@ import hxmc.unsafe.*;
|
|
|
9
9
|
|
|
10
10
|
// libuv behind hxmc.NativeUv (the Eval natives of eval.luv.*,
|
|
11
11
|
// src/macros/eval/EvalLuv.hx), standing for the OCaml luv library; once C
|
|
12
|
-
// (rt_uv.c), now Haxe calling libuv directly (
|
|
12
|
+
// (rt_uv.c), now Haxe calling libuv directly (docs/plans/lowlevel.md). libuv
|
|
13
13
|
// itself stays the prebuilt uv.o, linked when a program uses it.
|
|
14
14
|
//
|
|
15
15
|
// Loops, handles, requests and directories are integer ids into a table of
|