@geastack/compiler 1.0.18 → 1.0.20
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 +127 -86
- package/dist/cli.js +0 -0
- package/dist/plugins/gea/prelude.js +5 -1
- package/dist/targets/cpp/emit-jsx.js +7 -3
- package/package.json +15 -3
- package/src/targets/cpp/runtime/gea_runtime.h +97 -44
package/README.md
CHANGED
|
@@ -1,36 +1,68 @@
|
|
|
1
1
|
# geatsc
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
3
|
+
geatsc compiles TypeScript ahead of time to C++. The output contains no
|
|
4
|
+
JavaScript engine or interpreter. A C++ toolchain builds it into a native
|
|
5
|
+
binary for the target: ESP32 or RP2350 firmware, a macOS, iOS, Linux or Windows
|
|
6
|
+
app, an Xbox game, or a server executable.
|
|
7
|
+
|
|
8
|
+
The input is an ordinary TypeScript program, type-checked by the TypeScript
|
|
9
|
+
compiler. geatsc uses those types to pick native C++ representations: classes
|
|
10
|
+
become structs, numbers become native numeric types, and typed arrays, maps and
|
|
11
|
+
records become typed containers. This is what lets the same TypeScript run on a
|
|
12
|
+
microcontroller, and lets a compiled server use a fraction of the memory the
|
|
13
|
+
same code needs under Node.
|
|
14
|
+
|
|
15
|
+
## Where it fits in GeaStack
|
|
16
|
+
|
|
17
|
+
geatsc is the compiler for [GeaStack](https://github.com/geastack), a framework
|
|
18
|
+
for writing apps in TypeScript and JSX and running them natively on embedded
|
|
19
|
+
boards, desktop, mobile and consoles. The other repositories plug into it:
|
|
20
|
+
|
|
21
|
+
- [`core`](https://github.com/geastack/core) — the Gea framework (app API,
|
|
22
|
+
reactivity, rendering engine, host services) and `geatsc-plugin-gea`, the
|
|
23
|
+
plugin that teaches geatsc about Gea components and JSX.
|
|
24
|
+
- [`cli`](https://github.com/geastack/cli) — the `gea` command. `gea build`
|
|
25
|
+
runs vite, and core's `build-gea-vite-geatsc.mjs` hands the module graph to
|
|
26
|
+
`geatsc compile-module-graph`. The target's toolchain then builds the
|
|
27
|
+
generated C++.
|
|
28
|
+
- [`targets`](https://github.com/geastack/targets),
|
|
29
|
+
[`apple`](https://github.com/geastack/apple),
|
|
30
|
+
[`linux`](https://github.com/geastack/linux),
|
|
31
|
+
[`windows`](https://github.com/geastack/windows) — the platform projects that
|
|
32
|
+
compile and link the generated C++. `apple` also ships a geatsc plugin for the
|
|
33
|
+
Apple SDK bindings.
|
|
34
|
+
- Xbox — the Xbox target is not open source; it is available commercially.
|
|
35
|
+
Contact [contact@geastack.com](mailto:contact@geastack.com).
|
|
36
|
+
- [`node-compat`](https://github.com/geastack/node-compat) — the Node.js
|
|
37
|
+
runtime and geatsc plugin for compiling Node servers (`node:http`, Hono) to
|
|
38
|
+
native executables. It is a dependency of this package: running `geatsc`
|
|
39
|
+
with no input file inside a Node project builds each of the project's entry
|
|
40
|
+
points through node-compat into `dist/`.
|
|
41
|
+
|
|
42
|
+
The Gea and Apple plugins are peer dependencies. Other plugins are loaded with
|
|
43
|
+
`--plugin`; see [docs/CLI-PLUGINS.md](docs/CLI-PLUGINS.md).
|
|
44
|
+
|
|
45
|
+
[docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) describes the pipeline, the
|
|
46
|
+
layering and the constraints. `CLAUDE.md` has the code conventions.
|
|
14
47
|
|
|
15
48
|
## Layering
|
|
16
49
|
|
|
17
50
|
```
|
|
18
51
|
identity/ canonical IDs
|
|
19
|
-
semantics/
|
|
20
|
-
operations, edges, coverage
|
|
21
|
-
representation/ physical carriers, the sealed plan,
|
|
52
|
+
semantics/ target-neutral frontend: regions, structural types,
|
|
53
|
+
operations, edges, coverage
|
|
54
|
+
representation/ physical carriers, the sealed plan, fail-closed guards
|
|
22
55
|
conversion/ the closed dynamic-conversion capability algebra
|
|
23
56
|
preflight/ whole-pipeline capability census and certificate
|
|
24
57
|
ir/ typed IR: verified operations and SSA values
|
|
25
|
-
targets/cpp/ emission; consumes typed IR only
|
|
58
|
+
targets/cpp/ C++ emission; consumes typed IR only
|
|
26
59
|
diagnostics/ authority-component sweep, deterministic ordering
|
|
27
60
|
```
|
|
28
61
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
differently.
|
|
62
|
+
`semantics/` is the frontend/backend boundary. Nothing after it may import
|
|
63
|
+
`typescript` or touch a TypeScript AST.
|
|
32
64
|
|
|
33
|
-
##
|
|
65
|
+
## Constraints
|
|
34
66
|
|
|
35
67
|
1. **No source-shaped authority.** No decision may depend on a file name,
|
|
36
68
|
path, source offset, `.pos`/`.end`/`getStart()` compared to a literal,
|
|
@@ -38,68 +70,74 @@ differently.
|
|
|
38
70
|
C++ text. Identity is a checker symbol/declaration, a sealed semantic ID,
|
|
39
71
|
or a versioned protocol identity.
|
|
40
72
|
2. **No boxing.** A value with a static type never gets the dynamic carrier.
|
|
41
|
-
`Representation.dynamic` is
|
|
42
|
-
|
|
43
|
-
3. **Fail closed.**
|
|
44
|
-
|
|
45
|
-
fact
|
|
73
|
+
`Representation.dynamic` is allowed only for the four `DynamicReason`
|
|
74
|
+
values declared in `src/representation/model.ts`.
|
|
75
|
+
3. **Fail closed.** When a guard fires, the defect is upstream. Do not relax a
|
|
76
|
+
guard, downgrade an `unresolved`, or substitute a default for a missing
|
|
77
|
+
fact. `unresolved` is lattice bottom, not an answer.
|
|
46
78
|
|
|
47
79
|
## Architecture gate
|
|
48
80
|
|
|
49
|
-
`scripts/architecture.mjs`
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
81
|
+
`scripts/architecture.mjs` checks `src/**/*.ts` for:
|
|
82
|
+
|
|
83
|
+
- file and directory size limits
|
|
84
|
+
- RegExp literals under `src/targets/cpp/`
|
|
85
|
+
- source-position literal comparisons
|
|
86
|
+
- `typescript` imports outside `src/semantics/`
|
|
87
|
+
- source-shaped discriminants
|
|
88
|
+
- unclassified `Authority`/`Admission`/`Proof` contracts
|
|
89
|
+
- class declarations under `src/targets/`
|
|
90
|
+
- `any`
|
|
91
|
+
|
|
92
|
+
It reports every violation in one run.
|
|
56
93
|
|
|
57
|
-
##
|
|
94
|
+
## Diagnostics
|
|
58
95
|
|
|
59
96
|
```bash
|
|
60
97
|
node dist/cli.js test/fixtures/spread.ts
|
|
61
98
|
```
|
|
62
99
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
100
|
+
Runs the full pipeline and prints every diagnostic. Exits non-zero when no
|
|
101
|
+
capability certificate was minted. `--preflight` prints the obligation census
|
|
102
|
+
as canonical NDJSON.
|
|
103
|
+
|
|
104
|
+
### Coverage
|
|
66
105
|
|
|
67
106
|
```bash
|
|
68
107
|
node dist/cli.js coverage app/index.ts --plugin ../node-compat/plugin/v2.mjs
|
|
69
108
|
```
|
|
70
109
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
carrier that BOXED is a row too -- the program compiles and runs slower than it
|
|
76
|
-
says, and no other view places that on a line. Exit 0 iff a certificate was
|
|
77
|
-
minted and nothing refused at lowering or emission.
|
|
110
|
+
Prints one row per statement with a code, a status and a one-line reason,
|
|
111
|
+
followed by a summary and a count per code. Boxed carriers are reported as
|
|
112
|
+
rows too. Exits 0 only if a certificate was minted and nothing was refused
|
|
113
|
+
during lowering or emission.
|
|
78
114
|
|
|
79
115
|
| Code | Layer |
|
|
80
116
|
| ------- | -------------------------------------------------------------- |
|
|
81
|
-
| `G1xxx` |
|
|
117
|
+
| `G1xxx` | TypeScript checker errors |
|
|
82
118
|
| `G2xxx` | census blocker: a language primitive family the compiler lacks |
|
|
83
119
|
| `G3xxx` | representation guard violation |
|
|
84
120
|
| `G4xxx` | preflight obligation missing/unsupported, by obligation kind |
|
|
85
121
|
| `G5xxx` | IR lowering blocker |
|
|
86
|
-
| `G6xxx` | emission refusal, by
|
|
122
|
+
| `G6xxx` | emission refusal, by emitter category |
|
|
87
123
|
| `G7xxx` | calling-convention (ABI) projection blocker |
|
|
88
124
|
| `G8xxx` | boxed carrier (`gea::Value`), by reason |
|
|
89
125
|
|
|
90
|
-
The trailing digits index fixed tables in `src/cli-coverage.ts`,
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
`--
|
|
94
|
-
`--no-
|
|
126
|
+
The trailing digits index fixed tables in `src/cli-coverage.ts`, so rewording a
|
|
127
|
+
message does not change its code. `x999` means the table has no row for it.
|
|
128
|
+
|
|
129
|
+
Options: `--project`/`--no-project`, `--plugin`, `--plugin-option`, `--json`
|
|
130
|
+
(rows and summary as one object), `--no-derived` (roots only), `--no-boxed`
|
|
131
|
+
(refusals only).
|
|
132
|
+
|
|
133
|
+
### Carriers
|
|
95
134
|
|
|
96
135
|
```bash
|
|
97
136
|
node scripts/probe-carriers.mjs test/fixtures/language.ts
|
|
98
137
|
```
|
|
99
138
|
|
|
100
|
-
|
|
101
|
-
unresolved and boxed carriers.
|
|
102
|
-
carrier selection, which nothing else exercises directly.
|
|
139
|
+
Prints the carrier and C++ spelling chosen for every declaration, and counts
|
|
140
|
+
unresolved and boxed carriers.
|
|
103
141
|
|
|
104
142
|
## Emitting C++
|
|
105
143
|
|
|
@@ -107,43 +145,46 @@ carrier selection, which nothing else exercises directly.
|
|
|
107
145
|
node dist/cli.js compile app/index.ts --out-dir build/generated
|
|
108
146
|
```
|
|
109
147
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
|
120
|
-
|
|
|
121
|
-
| `--
|
|
122
|
-
| `--
|
|
123
|
-
| `--
|
|
124
|
-
| `--
|
|
125
|
-
| `--
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
148
|
+
The gea build pipeline runs this command (`build-gea-vite-geatsc.mjs` passes it
|
|
149
|
+
through `--geatsc-bin`). It writes to `--out-dir`:
|
|
150
|
+
|
|
151
|
+
- the generated C++
|
|
152
|
+
- `gea_runtime.h` and `generated_support.hpp`
|
|
153
|
+
- any files the installed hosts need beside the unit
|
|
154
|
+
- `geatsc-sources.txt`, the list of `.cpp` files to compile
|
|
155
|
+
- `geatsc-header.txt` (per-file layout only), the shared header to precompile
|
|
156
|
+
|
|
157
|
+
| Option | Meaning |
|
|
158
|
+
| ---------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
159
|
+
| `--project <tsconfig.json>` | Project to compile the input under. Default: the nearest one. A `.js` bundle has none. |
|
|
160
|
+
| `--entry-symbol <name>` | C++ function the program starts at. Default `__gea_top_level`, called by `core/gea_app_entry.cpp`. |
|
|
161
|
+
| `--dynamic-fallback` | Allow boxed C++ runtime dispatch for supported dynamic features. No JavaScript engine is involved. See [docs/DYNAMIC-FALLBACK.md](docs/DYNAMIC-FALLBACK.md). |
|
|
162
|
+
| `--isolate-symbols` | Make every definition private to this program, for builds that link several programs into one binary. Programs that cannot be isolated are refused. |
|
|
163
|
+
| `--translation-units single \| per-file \| balanced` | `single` (default): one C++ file. `per-file`: one file per source file, plus a shared `<stem>.hpp` and a program unit. `balanced`: per-file with small units grouped. See [docs/TRANSLATION-UNITS.md](docs/TRANSLATION-UNITS.md). |
|
|
164
|
+
| `--plugin <module>` | Load a compiler plugin. Repeatable. See [docs/CLI-PLUGINS.md](docs/CLI-PLUGINS.md). |
|
|
165
|
+
| `--plugin-option <lib.key>=<value>` | Passed unchanged to the library named by the prefix, e.g. `gea.cpp-prelude=...`. |
|
|
166
|
+
|
|
167
|
+
`compile-module-graph <gea-module-graph.json> --entry <file>` does the same
|
|
168
|
+
from vite's module graph instead of files on disk. Application builds use this
|
|
169
|
+
form. It takes the same options.
|
|
130
170
|
|
|
131
171
|
## npm scripts
|
|
132
172
|
|
|
133
|
-
| Script | Purpose
|
|
134
|
-
| -------------- |
|
|
135
|
-
| `architecture` | Run the architecture gate
|
|
136
|
-
| `typecheck` | `tsc -p tsconfig.json --noEmit
|
|
137
|
-
| `build` |
|
|
138
|
-
| `format` | `prettier --write
|
|
139
|
-
| `format:check` | `prettier --check
|
|
140
|
-
| `check` | Architecture gate, typecheck
|
|
173
|
+
| Script | Purpose |
|
|
174
|
+
| -------------- | --------------------------------------------- |
|
|
175
|
+
| `architecture` | Run the architecture gate |
|
|
176
|
+
| `typecheck` | `tsc -p tsconfig.json --noEmit` |
|
|
177
|
+
| `build` | Architecture gate, then compile to `dist/` |
|
|
178
|
+
| `format` | `prettier --write .` |
|
|
179
|
+
| `format:check` | `prettier --check .` |
|
|
180
|
+
| `check` | Architecture gate, typecheck and format check |
|
|
141
181
|
|
|
142
182
|
## License
|
|
143
183
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
license
|
|
184
|
+
The compiler and the runtime it links into generated programs are Apache-2.0
|
|
185
|
+
(see `LICENSE`). Programs you compile with geatsc are yours; their license
|
|
186
|
+
depends only on what they link. The GeaStack framework and the desktop, mobile
|
|
187
|
+
and web targets are also Apache-2.0. The embedded board support (`targets`,
|
|
188
|
+
`@geastack/chips`) is GPL-3.0-only; closed-source firmware needs a commercial
|
|
189
|
+
license. Contact [contact@geastack.com](mailto:contact@geastack.com) for
|
|
190
|
+
commercial terms.
|
package/dist/cli.js
CHANGED
|
File without changes
|
|
@@ -61,7 +61,11 @@ export const geaCppPrelude = (options) => {
|
|
|
61
61
|
// has `<p>`s and `<h1>`s, and the cascade breaks equal-specificity ties by
|
|
62
62
|
// source order, so anything the app states about the same tag has to be
|
|
63
63
|
// registered after this to win.
|
|
64
|
-
const
|
|
64
|
+
const styles = tape.length === 0 ? geaUserAgentStyleSheet : `${geaUserAgentStyleSheet}\n${tape}`;
|
|
65
|
+
// The build's proven canvas-only mode does not link the CSS engine. Keep
|
|
66
|
+
// this decision on the same native definition as the frame loop; the
|
|
67
|
+
// compiler still emits identical typed canvas calls for both modes.
|
|
68
|
+
const body = `#if !defined(GEA_EMBEDDED_DIRECT_CANVAS_CONTEXT) || !GEA_EMBEDDED_DIRECT_CANVAS_CONTEXT\n${styles}\n#endif`;
|
|
65
69
|
const provenance = `// @geastack/compiler gea C++ prelude\n// prelude=${tapePath ?? '<none: user-agent defaults only>'}`;
|
|
66
70
|
if (named)
|
|
67
71
|
return [`${provenance}\nvoid ${symbol}() {\n${indent(body, ' ')}\n}`];
|
|
@@ -260,10 +260,11 @@ const emitObjectPropEntries = (ctx, lines, operation, node, key, value) => {
|
|
|
260
260
|
// ahead of the apply, which the capture list then names. Scoped by the
|
|
261
261
|
// node's own variable, which is unique within the body, so two elements'
|
|
262
262
|
// tables cannot collide.
|
|
263
|
+
const initializers = [];
|
|
263
264
|
let thunk = computed.thunk;
|
|
264
265
|
if (!isPlainName(thunk)) {
|
|
265
266
|
thunk = `gea_class_thunk_${node}_${named++}`;
|
|
266
|
-
|
|
267
|
+
initializers.push(`const auto ${thunk} = ${computed.thunk};`);
|
|
267
268
|
}
|
|
268
269
|
// Numeric dictionaries retain canonical PropertyKey text as their safe
|
|
269
270
|
// physical key, so NaN and infinities never enter an ordered double map.
|
|
@@ -271,7 +272,7 @@ const emitObjectPropEntries = (ctx, lines, operation, node, key, value) => {
|
|
|
271
272
|
const call = `${thunk}.call()`;
|
|
272
273
|
const written = alignedValueText(ctx, 'emit-jsx.ts:276', computed.origin.representation, value.value, call) ?? call;
|
|
273
274
|
const write = `[${table}, ${thunk}]() { ${subscript}[${entryKey}] = ${written}; }`;
|
|
274
|
-
blocks.push(...reactiveApplyBlock(`gea::jsx::reactiveObjectPropApply(${node}, ${key}, ${table}, ${write})`, computed.subscriptions));
|
|
275
|
+
blocks.push(...reactiveApplyBlock(`gea::jsx::reactiveObjectPropApply(${node}, ${key}, ${table}, ${write})`, computed.subscriptions, initializers));
|
|
275
276
|
}
|
|
276
277
|
// No reactive entry means nothing here has anything to say about this prop,
|
|
277
278
|
// and it takes the path it always took.
|
|
@@ -450,8 +451,11 @@ const subscriptionOwnerText = (ctx, dependency) => {
|
|
|
450
451
|
const reference = bindingReference(ctx, dependency.source.declaration, 'a reactive subscription');
|
|
451
452
|
return reference.boxed ? null : reference.name;
|
|
452
453
|
};
|
|
453
|
-
|
|
454
|
+
// Every initialized local belongs inside the block: control-flow labels outside
|
|
455
|
+
// it must remain reachable without jumping over a C++ variable initialization.
|
|
456
|
+
const reactiveApplyBlock = (open, subscriptions, initializers = []) => [
|
|
454
457
|
'{',
|
|
458
|
+
...initializers.map((line) => ` ${line}`),
|
|
455
459
|
` const auto gea_apply = ${open};`,
|
|
456
460
|
...subscriptions.map((line) => ` ${line}`),
|
|
457
461
|
'}'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geastack/compiler",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.20",
|
|
4
4
|
"description": "The geastack TypeScript-to-C++ compiler: one semantic spine, no source-shaped authority, no boxing of statically typed values.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
"scripts": {
|
|
47
47
|
"test:cli-plugins": "node --test test/cli-plugins.mjs",
|
|
48
48
|
"test:allocation-runtime": "node test/allocation-runtime.mjs",
|
|
49
|
+
"test:compact-runtime": "node test/compact-runtime.mjs",
|
|
49
50
|
"test:stored-listener-native-flow": "node test/stored-listener-native-flow.mjs",
|
|
50
51
|
"test:native-typed-field-read": "node test/native-typed-field-read.mjs",
|
|
51
52
|
"test:native-method-overrides": "node test/native-method-overrides.mjs",
|
|
@@ -64,7 +65,9 @@
|
|
|
64
65
|
"format": "prettier --write .",
|
|
65
66
|
"format:check": "prettier --check .",
|
|
66
67
|
"check": "npm run architecture && npm run typecheck && npm run format:check",
|
|
67
|
-
"check:contracts": "npm run build && node test/contracts.mjs"
|
|
68
|
+
"check:contracts": "npm run build && node test/contracts.mjs",
|
|
69
|
+
"test": "npm run build && node test/run.mjs",
|
|
70
|
+
"test:node-project": "node test/node-project.mjs"
|
|
68
71
|
},
|
|
69
72
|
"dependencies": {
|
|
70
73
|
"@geastack/node-compat": "^1.0.12",
|
|
@@ -74,7 +77,16 @@
|
|
|
74
77
|
"@types/node": "^22.15.3",
|
|
75
78
|
"fastify": "^5.0.0",
|
|
76
79
|
"find-my-way": "9.6.0",
|
|
77
|
-
"prettier": "^3.8.3"
|
|
80
|
+
"prettier": "^3.8.3",
|
|
81
|
+
"@geastack/core": "0.1.23",
|
|
82
|
+
"@geastack/host": "0.1.8",
|
|
83
|
+
"@geastack/engine": "0.1.6",
|
|
84
|
+
"@geastack/elements": "0.1.2",
|
|
85
|
+
"@geastack/geaos": "0.1.3",
|
|
86
|
+
"@geastack/apple": "0.2.8",
|
|
87
|
+
"@geastack/geatsc-plugin-gea": "0.1.6",
|
|
88
|
+
"@geastack/geatsc-plugin-apple-native": "0.1.3",
|
|
89
|
+
"@geastack/native-webgl-angle": "0.1.6"
|
|
78
90
|
},
|
|
79
91
|
"peerDependencies": {
|
|
80
92
|
"@geastack/apple": ">=0.2.8",
|
|
@@ -1433,6 +1433,13 @@ inline constexpr std::uint32_t cycleMature = std::uint32_t{1} << 29;
|
|
|
1433
1433
|
// full collection -- the only pass that could ever free it -- examines it.
|
|
1434
1434
|
inline constexpr std::uint32_t cyclePermanent = std::uint32_t{1} << 28;
|
|
1435
1435
|
inline void dropNativeExpando(const void* object, RefCounts* counts);
|
|
1436
|
+
#if defined(GEA_RUNTIME_COMPACT_CODE) && GEA_RUNTIME_COMPACT_CODE
|
|
1437
|
+
// Only creating an expando should retain its registry's erase machinery.
|
|
1438
|
+
inline void (*nativeExpandoDropper)(const void*, RefCounts*) = nullptr;
|
|
1439
|
+
inline void dropTaggedExpando(const void* object, RefCounts* counts) { nativeExpandoDropper(object, counts); }
|
|
1440
|
+
#else
|
|
1441
|
+
inline void dropTaggedExpando(const void* object, RefCounts* counts) { dropNativeExpando(object, counts); }
|
|
1442
|
+
#endif
|
|
1436
1443
|
template <typename T>
|
|
1437
1444
|
inline RefCounts* refCountsOf(T* object);
|
|
1438
1445
|
|
|
@@ -1992,7 +1999,7 @@ struct RefOperationsFor {
|
|
|
1992
1999
|
profileRefDestroyed<T>(refBlockSize<T>, cycleState().collecting, object);
|
|
1993
2000
|
#endif
|
|
1994
2001
|
RefCounts* counts = refCountsOf(static_cast<T*>(object));
|
|
1995
|
-
if ((counts->weak & expandoTagged) != 0) [[unlikely]]
|
|
2002
|
+
if ((counts->weak & expandoTagged) != 0) [[unlikely]] dropTaggedExpando(object, counts);
|
|
1996
2003
|
// Unlike `expandoTagged`, `cycleMature` has no side table to notify -- an
|
|
1997
2004
|
// unconditional clear is as cheap as the branch would be. Without this,
|
|
1998
2005
|
// an object that died mature (as most steady-state objects do) would
|
|
@@ -2004,7 +2011,8 @@ struct RefOperationsFor {
|
|
|
2004
2011
|
}
|
|
2005
2012
|
static void release(void* block) { AllocationPool<refBlockSize<T>, refBlockAlign<T>>::give(block); }
|
|
2006
2013
|
static void trace(const void* object, RefVisitor& visitor) { traceRefs(*static_cast<const T*>(object), visitor); }
|
|
2007
|
-
|
|
2014
|
+
// Constant initialization lets the linker discard unused type operations.
|
|
2015
|
+
static constexpr const RefOperations* classBase() {
|
|
2008
2016
|
using Base = typename ClassRefBase<T>::type;
|
|
2009
2017
|
if constexpr (std::is_void_v<Base>) return nullptr;
|
|
2010
2018
|
else return &RefOperationsFor<Base>::table;
|
|
@@ -2271,8 +2279,20 @@ struct Ref {
|
|
|
2271
2279
|
* the branch is a property of the type, so the non-final path is not even
|
|
2272
2280
|
* emitted for a final one.
|
|
2273
2281
|
*/
|
|
2274
|
-
|
|
2282
|
+
#if !defined(GEA_RUNTIME_COMPACT_CODE) || !GEA_RUNTIME_COMPACT_CODE
|
|
2283
|
+
[[gnu::always_inline]]
|
|
2284
|
+
#endif
|
|
2285
|
+
void release() {
|
|
2275
2286
|
if (pointer_ == nullptr) return;
|
|
2287
|
+
#if defined(GEA_RUNTIME_COMPACT_CODE) && GEA_RUNTIME_COMPACT_CODE
|
|
2288
|
+
releaseOutOfLine(pointer_);
|
|
2289
|
+
#else
|
|
2290
|
+
releasePointer(pointer_);
|
|
2291
|
+
#endif
|
|
2292
|
+
}
|
|
2293
|
+
// Keep handles in registers while sharing their release body on small targets.
|
|
2294
|
+
[[gnu::noinline]] static void releaseOutOfLine(T* pointer) { releasePointer(pointer); }
|
|
2295
|
+
[[gnu::always_inline]] static void releasePointer(T* pointer_) {
|
|
2276
2296
|
detail::RefCounts* counts = detail::refCountsOf(pointer_);
|
|
2277
2297
|
// A cycle collection marks its whole unreachable subgraph dead before
|
|
2278
2298
|
// destroying any node. These are its internal edges, not another owner.
|
|
@@ -2304,12 +2324,18 @@ struct Ref {
|
|
|
2304
2324
|
// `CallableObject` built inline for a closure-table store carried two empty
|
|
2305
2325
|
// handles whose null-ness clang had just written and then had to re-test,
|
|
2306
2326
|
// because this call had taken their address on the previous iteration.
|
|
2307
|
-
|
|
2327
|
+
#if defined(GEA_RUNTIME_COMPACT_CODE) && GEA_RUNTIME_COMPACT_CODE
|
|
2328
|
+
// releaseOutOfLine already shares the complete body in compact builds.
|
|
2329
|
+
[[gnu::always_inline]]
|
|
2330
|
+
#else
|
|
2331
|
+
[[gnu::noinline]]
|
|
2332
|
+
#endif
|
|
2333
|
+
static void releaseLast(T* pointer, detail::RefCounts* counts) {
|
|
2308
2334
|
if constexpr (std::is_final_v<T>) {
|
|
2309
2335
|
#if defined(GEA_PROFILE_ALLOCATIONS)
|
|
2310
2336
|
detail::profileRefDestroyed<T>(detail::refBlockSize<T>, detail::cycleState().collecting, pointer);
|
|
2311
2337
|
#endif
|
|
2312
|
-
if ((counts->weak & detail::expandoTagged) != 0) [[unlikely]] detail::
|
|
2338
|
+
if ((counts->weak & detail::expandoTagged) != 0) [[unlikely]] detail::dropTaggedExpando(pointer, counts);
|
|
2313
2339
|
// See `RefOperationsFor::destroy`: an object that died `cycleMature`
|
|
2314
2340
|
// must not carry the bit into the `weak == 0` check just below.
|
|
2315
2341
|
counts->weak &= ~(detail::cycleMature | detail::cyclePermanent);
|
|
@@ -3871,6 +3897,25 @@ struct CallableObject<Result(Arguments...)> {
|
|
|
3871
3897
|
}
|
|
3872
3898
|
};
|
|
3873
3899
|
|
|
3900
|
+
// Header-only builtins must not register dynamic initializers: taking every
|
|
3901
|
+
// thunk's address at startup keeps all of libm in even a math-free program.
|
|
3902
|
+
// Materialize the shared callable only on a value read, preserving its identity.
|
|
3903
|
+
template <typename Signature, auto Entry>
|
|
3904
|
+
struct HostFunction;
|
|
3905
|
+
|
|
3906
|
+
template <typename Result, typename... Arguments, Result (*Entry)(void*, Arguments...)>
|
|
3907
|
+
struct HostFunction<Result(Arguments...), Entry> {
|
|
3908
|
+
using Carrier = CallableObject<Result(Arguments...)>;
|
|
3909
|
+
static const Carrier& carrier() {
|
|
3910
|
+
static const Carrier value{Entry, nullptr};
|
|
3911
|
+
return value;
|
|
3912
|
+
}
|
|
3913
|
+
operator const Carrier&() const { return carrier(); }
|
|
3914
|
+
const Carrier& identified() const { return carrier().identified(); }
|
|
3915
|
+
[[gnu::always_inline]] Result call(Arguments... arguments) const { return Entry(nullptr, std::forward<Arguments>(arguments)...); }
|
|
3916
|
+
[[gnu::always_inline]] Result operator()(Arguments... arguments) const { return Entry(nullptr, std::forward<Arguments>(arguments)...); }
|
|
3917
|
+
};
|
|
3918
|
+
|
|
3874
3919
|
namespace detail {
|
|
3875
3920
|
template <typename>
|
|
3876
3921
|
struct IsNativeCallableObject : std::false_type {};
|
|
@@ -13862,6 +13907,9 @@ inline gea::Ref<DynamicObject> expandoFor(const gea::Ref<void>& payload, bool cr
|
|
|
13862
13907
|
fresh.table->markNativeExpando();
|
|
13863
13908
|
entries[address] = fresh;
|
|
13864
13909
|
refCountsOf(payload.get())->weak |= expandoTagged;
|
|
13910
|
+
#if defined(GEA_RUNTIME_COMPACT_CODE) && GEA_RUNTIME_COMPACT_CODE
|
|
13911
|
+
nativeExpandoDropper = &dropNativeExpando;
|
|
13912
|
+
#endif
|
|
13865
13913
|
return fresh.table;
|
|
13866
13914
|
}
|
|
13867
13915
|
|
|
@@ -22214,47 +22262,47 @@ inline double imul_invoke(void*, double a, double b) {
|
|
|
22214
22262
|
#if defined(GEA_CPP_SHARED_RUNTIME_BUILTINS)
|
|
22215
22263
|
extern const gea::CallableObject<double(double)> floor;
|
|
22216
22264
|
#else
|
|
22217
|
-
inline
|
|
22265
|
+
inline constexpr gea::HostFunction<double(double), &detail::floor_invoke> floor{};
|
|
22218
22266
|
#endif
|
|
22219
22267
|
#if defined(GEA_CPP_SHARED_RUNTIME_BUILTINS)
|
|
22220
22268
|
extern const gea::CallableObject<double(double)> round;
|
|
22221
22269
|
#else
|
|
22222
|
-
inline
|
|
22270
|
+
inline constexpr gea::HostFunction<double(double), &detail::round_invoke> round{};
|
|
22223
22271
|
#endif
|
|
22224
22272
|
#if defined(GEA_CPP_SHARED_RUNTIME_BUILTINS)
|
|
22225
22273
|
extern const gea::CallableObject<double(double)> sin;
|
|
22226
22274
|
#else
|
|
22227
|
-
inline
|
|
22275
|
+
inline constexpr gea::HostFunction<double(double), &detail::sin_invoke> sin{};
|
|
22228
22276
|
#endif
|
|
22229
22277
|
#if defined(GEA_CPP_SHARED_RUNTIME_BUILTINS)
|
|
22230
22278
|
extern const gea::CallableObject<double(double)> cos;
|
|
22231
22279
|
#else
|
|
22232
|
-
inline
|
|
22280
|
+
inline constexpr gea::HostFunction<double(double), &detail::cos_invoke> cos{};
|
|
22233
22281
|
#endif
|
|
22234
22282
|
#if defined(GEA_CPP_SHARED_RUNTIME_BUILTINS)
|
|
22235
22283
|
extern const gea::CallableObject<double(double)> sqrt;
|
|
22236
22284
|
#else
|
|
22237
|
-
inline
|
|
22285
|
+
inline constexpr gea::HostFunction<double(double), &detail::sqrt_invoke> sqrt{};
|
|
22238
22286
|
#endif
|
|
22239
22287
|
#if defined(GEA_CPP_SHARED_RUNTIME_BUILTINS)
|
|
22240
22288
|
extern const gea::CallableObject<double(double)> abs;
|
|
22241
22289
|
#else
|
|
22242
|
-
inline
|
|
22290
|
+
inline constexpr gea::HostFunction<double(double), &detail::abs_invoke> abs{};
|
|
22243
22291
|
#endif
|
|
22244
22292
|
#if defined(GEA_CPP_SHARED_RUNTIME_BUILTINS)
|
|
22245
22293
|
extern const gea::CallableObject<double(double)> ceil;
|
|
22246
22294
|
#else
|
|
22247
|
-
inline
|
|
22295
|
+
inline constexpr gea::HostFunction<double(double), &detail::ceil_invoke> ceil{};
|
|
22248
22296
|
#endif
|
|
22249
22297
|
#if defined(GEA_CPP_SHARED_RUNTIME_BUILTINS)
|
|
22250
22298
|
extern const gea::CallableObject<double(double, double)> pow;
|
|
22251
22299
|
#else
|
|
22252
|
-
inline
|
|
22300
|
+
inline constexpr gea::HostFunction<double(double, double), &detail::pow_invoke> pow{};
|
|
22253
22301
|
#endif
|
|
22254
22302
|
#if defined(GEA_CPP_SHARED_RUNTIME_BUILTINS)
|
|
22255
22303
|
extern const gea::CallableObject<double(double, double)> atan2;
|
|
22256
22304
|
#else
|
|
22257
|
-
inline
|
|
22305
|
+
inline constexpr gea::HostFunction<double(double, double), &detail::atan2_invoke> atan2{};
|
|
22258
22306
|
#endif
|
|
22259
22307
|
// The rest of the transcendentals the corpus reaches. Each is ECMA-262's own
|
|
22260
22308
|
// definition and each is `<cmath>`'s function of the same name -- 21.3.2.2
|
|
@@ -22263,47 +22311,47 @@ inline const gea::CallableObject<double(double, double)> atan2{detail::atan2_inv
|
|
|
22263
22311
|
#if defined(GEA_CPP_SHARED_RUNTIME_BUILTINS)
|
|
22264
22312
|
extern const gea::CallableObject<double(double)> tan;
|
|
22265
22313
|
#else
|
|
22266
|
-
inline
|
|
22314
|
+
inline constexpr gea::HostFunction<double(double), &detail::tan_invoke> tan{};
|
|
22267
22315
|
#endif
|
|
22268
22316
|
#if defined(GEA_CPP_SHARED_RUNTIME_BUILTINS)
|
|
22269
22317
|
extern const gea::CallableObject<double(double)> asin;
|
|
22270
22318
|
#else
|
|
22271
|
-
inline
|
|
22319
|
+
inline constexpr gea::HostFunction<double(double), &detail::asin_invoke> asin{};
|
|
22272
22320
|
#endif
|
|
22273
22321
|
#if defined(GEA_CPP_SHARED_RUNTIME_BUILTINS)
|
|
22274
22322
|
extern const gea::CallableObject<double(double)> acos;
|
|
22275
22323
|
#else
|
|
22276
|
-
inline
|
|
22324
|
+
inline constexpr gea::HostFunction<double(double), &detail::acos_invoke> acos{};
|
|
22277
22325
|
#endif
|
|
22278
22326
|
#if defined(GEA_CPP_SHARED_RUNTIME_BUILTINS)
|
|
22279
22327
|
extern const gea::CallableObject<double(double)> atan;
|
|
22280
22328
|
#else
|
|
22281
|
-
inline
|
|
22329
|
+
inline constexpr gea::HostFunction<double(double), &detail::atan_invoke> atan{};
|
|
22282
22330
|
#endif
|
|
22283
22331
|
#if defined(GEA_CPP_SHARED_RUNTIME_BUILTINS)
|
|
22284
22332
|
extern const gea::CallableObject<double(double)> sinh;
|
|
22285
22333
|
#else
|
|
22286
|
-
inline
|
|
22334
|
+
inline constexpr gea::HostFunction<double(double), &detail::sinh_invoke> sinh{};
|
|
22287
22335
|
#endif
|
|
22288
22336
|
#if defined(GEA_CPP_SHARED_RUNTIME_BUILTINS)
|
|
22289
22337
|
extern const gea::CallableObject<double(double)> log;
|
|
22290
22338
|
#else
|
|
22291
|
-
inline
|
|
22339
|
+
inline constexpr gea::HostFunction<double(double), &detail::log_invoke> log{};
|
|
22292
22340
|
#endif
|
|
22293
22341
|
#if defined(GEA_CPP_SHARED_RUNTIME_BUILTINS)
|
|
22294
22342
|
extern const gea::CallableObject<double()> random;
|
|
22295
22343
|
#else
|
|
22296
|
-
inline
|
|
22344
|
+
inline constexpr gea::HostFunction<double(), &detail::random_invoke> random{};
|
|
22297
22345
|
#endif
|
|
22298
22346
|
#if defined(GEA_CPP_SHARED_RUNTIME_BUILTINS)
|
|
22299
22347
|
extern const gea::CallableObject<double(gea::Ref<gea::ArrayObject<double>>)> max;
|
|
22300
22348
|
#else
|
|
22301
|
-
inline
|
|
22349
|
+
inline constexpr gea::HostFunction<double(gea::Ref<gea::ArrayObject<double>>), &detail::max_invoke> max{};
|
|
22302
22350
|
#endif
|
|
22303
22351
|
#if defined(GEA_CPP_SHARED_RUNTIME_BUILTINS)
|
|
22304
22352
|
extern const gea::CallableObject<double(gea::Ref<gea::ArrayObject<double>>)> min;
|
|
22305
22353
|
#else
|
|
22306
|
-
inline
|
|
22354
|
+
inline constexpr gea::HostFunction<double(gea::Ref<gea::ArrayObject<double>>), &detail::min_invoke> min{};
|
|
22307
22355
|
#endif
|
|
22308
22356
|
// A direct call's already-evaluated numeric operands need no JS array identity.
|
|
22309
22357
|
// The initializer list borrows native stack storage for this synchronous call.
|
|
@@ -22320,7 +22368,7 @@ inline double minDirect(std::initializer_list<double> values) {
|
|
|
22320
22368
|
#if defined(GEA_CPP_SHARED_RUNTIME_BUILTINS)
|
|
22321
22369
|
extern const gea::CallableObject<double(gea::Ref<gea::ArrayObject<double>>)> hypot;
|
|
22322
22370
|
#else
|
|
22323
|
-
inline
|
|
22371
|
+
inline constexpr gea::HostFunction<double(gea::Ref<gea::ArrayObject<double>>), &detail::hypot_invoke> hypot{};
|
|
22324
22372
|
#endif
|
|
22325
22373
|
// The sixteen members `lib.es2015.core.d.ts` adds to `Math` beyond the ES5 set
|
|
22326
22374
|
// plus `cbrt`, each over the same exact scalar ABI as the row above. `imul` is
|
|
@@ -22328,82 +22376,82 @@ inline const gea::CallableObject<double(gea::Ref<gea::ArrayObject<double>>)> hyp
|
|
|
22328
22376
|
#if defined(GEA_CPP_SHARED_RUNTIME_BUILTINS)
|
|
22329
22377
|
extern const gea::CallableObject<double(double)> cbrt;
|
|
22330
22378
|
#else
|
|
22331
|
-
inline
|
|
22379
|
+
inline constexpr gea::HostFunction<double(double), &detail::cbrt_invoke> cbrt{};
|
|
22332
22380
|
#endif
|
|
22333
22381
|
#if defined(GEA_CPP_SHARED_RUNTIME_BUILTINS)
|
|
22334
22382
|
extern const gea::CallableObject<double(double)> sign;
|
|
22335
22383
|
#else
|
|
22336
|
-
inline
|
|
22384
|
+
inline constexpr gea::HostFunction<double(double), &detail::sign_invoke> sign{};
|
|
22337
22385
|
#endif
|
|
22338
22386
|
#if defined(GEA_CPP_SHARED_RUNTIME_BUILTINS)
|
|
22339
22387
|
extern const gea::CallableObject<double(double)> trunc;
|
|
22340
22388
|
#else
|
|
22341
|
-
inline
|
|
22389
|
+
inline constexpr gea::HostFunction<double(double), &detail::trunc_invoke> trunc{};
|
|
22342
22390
|
#endif
|
|
22343
22391
|
#if defined(GEA_CPP_SHARED_RUNTIME_BUILTINS)
|
|
22344
22392
|
extern const gea::CallableObject<double(double)> exp;
|
|
22345
22393
|
#else
|
|
22346
|
-
inline
|
|
22394
|
+
inline constexpr gea::HostFunction<double(double), &detail::exp_invoke> exp{};
|
|
22347
22395
|
#endif
|
|
22348
22396
|
#if defined(GEA_CPP_SHARED_RUNTIME_BUILTINS)
|
|
22349
22397
|
extern const gea::CallableObject<double(double)> expm1;
|
|
22350
22398
|
#else
|
|
22351
|
-
inline
|
|
22399
|
+
inline constexpr gea::HostFunction<double(double), &detail::expm1_invoke> expm1{};
|
|
22352
22400
|
#endif
|
|
22353
22401
|
#if defined(GEA_CPP_SHARED_RUNTIME_BUILTINS)
|
|
22354
22402
|
extern const gea::CallableObject<double(double)> log10;
|
|
22355
22403
|
#else
|
|
22356
|
-
inline
|
|
22404
|
+
inline constexpr gea::HostFunction<double(double), &detail::log10_invoke> log10{};
|
|
22357
22405
|
#endif
|
|
22358
22406
|
#if defined(GEA_CPP_SHARED_RUNTIME_BUILTINS)
|
|
22359
22407
|
extern const gea::CallableObject<double(double)> log1p;
|
|
22360
22408
|
#else
|
|
22361
|
-
inline
|
|
22409
|
+
inline constexpr gea::HostFunction<double(double), &detail::log1p_invoke> log1p{};
|
|
22362
22410
|
#endif
|
|
22363
22411
|
#if defined(GEA_CPP_SHARED_RUNTIME_BUILTINS)
|
|
22364
22412
|
extern const gea::CallableObject<double(double)> log2;
|
|
22365
22413
|
#else
|
|
22366
|
-
inline
|
|
22414
|
+
inline constexpr gea::HostFunction<double(double), &detail::log2_invoke> log2{};
|
|
22367
22415
|
#endif
|
|
22368
22416
|
#if defined(GEA_CPP_SHARED_RUNTIME_BUILTINS)
|
|
22369
22417
|
extern const gea::CallableObject<double(double)> cosh;
|
|
22370
22418
|
#else
|
|
22371
|
-
inline
|
|
22419
|
+
inline constexpr gea::HostFunction<double(double), &detail::cosh_invoke> cosh{};
|
|
22372
22420
|
#endif
|
|
22373
22421
|
#if defined(GEA_CPP_SHARED_RUNTIME_BUILTINS)
|
|
22374
22422
|
extern const gea::CallableObject<double(double)> tanh;
|
|
22375
22423
|
#else
|
|
22376
|
-
inline
|
|
22424
|
+
inline constexpr gea::HostFunction<double(double), &detail::tanh_invoke> tanh{};
|
|
22377
22425
|
#endif
|
|
22378
22426
|
#if defined(GEA_CPP_SHARED_RUNTIME_BUILTINS)
|
|
22379
22427
|
extern const gea::CallableObject<double(double)> acosh;
|
|
22380
22428
|
#else
|
|
22381
|
-
inline
|
|
22429
|
+
inline constexpr gea::HostFunction<double(double), &detail::acosh_invoke> acosh{};
|
|
22382
22430
|
#endif
|
|
22383
22431
|
#if defined(GEA_CPP_SHARED_RUNTIME_BUILTINS)
|
|
22384
22432
|
extern const gea::CallableObject<double(double)> asinh;
|
|
22385
22433
|
#else
|
|
22386
|
-
inline
|
|
22434
|
+
inline constexpr gea::HostFunction<double(double), &detail::asinh_invoke> asinh{};
|
|
22387
22435
|
#endif
|
|
22388
22436
|
#if defined(GEA_CPP_SHARED_RUNTIME_BUILTINS)
|
|
22389
22437
|
extern const gea::CallableObject<double(double)> atanh;
|
|
22390
22438
|
#else
|
|
22391
|
-
inline
|
|
22439
|
+
inline constexpr gea::HostFunction<double(double), &detail::atanh_invoke> atanh{};
|
|
22392
22440
|
#endif
|
|
22393
22441
|
#if defined(GEA_CPP_SHARED_RUNTIME_BUILTINS)
|
|
22394
22442
|
extern const gea::CallableObject<double(double)> fround;
|
|
22395
22443
|
#else
|
|
22396
|
-
inline
|
|
22444
|
+
inline constexpr gea::HostFunction<double(double), &detail::fround_invoke> fround{};
|
|
22397
22445
|
#endif
|
|
22398
22446
|
#if defined(GEA_CPP_SHARED_RUNTIME_BUILTINS)
|
|
22399
22447
|
extern const gea::CallableObject<double(double)> clz32;
|
|
22400
22448
|
#else
|
|
22401
|
-
inline
|
|
22449
|
+
inline constexpr gea::HostFunction<double(double), &detail::clz32_invoke> clz32{};
|
|
22402
22450
|
#endif
|
|
22403
22451
|
#if defined(GEA_CPP_SHARED_RUNTIME_BUILTINS)
|
|
22404
22452
|
extern const gea::CallableObject<double(double, double)> imul;
|
|
22405
22453
|
#else
|
|
22406
|
-
inline
|
|
22454
|
+
inline constexpr gea::HostFunction<double(double, double), &detail::imul_invoke> imul{};
|
|
22407
22455
|
#endif
|
|
22408
22456
|
|
|
22409
22457
|
/** `readonly PI: number` -- a data property, not a method; no `CallableObject`. */
|
|
@@ -22698,7 +22746,7 @@ inline double now_invoke(void*) {
|
|
|
22698
22746
|
#if defined(GEA_CPP_SHARED_RUNTIME_BUILTINS)
|
|
22699
22747
|
extern const gea::CallableObject<double()> now;
|
|
22700
22748
|
#else
|
|
22701
|
-
inline
|
|
22749
|
+
inline constexpr gea::HostFunction<double(), &detail::now_invoke> now{};
|
|
22702
22750
|
#endif
|
|
22703
22751
|
|
|
22704
22752
|
} // namespace DateConstructor
|
|
@@ -22722,7 +22770,7 @@ inline std::string fromCharCode_invoke(void*, gea::Ref<gea::ArrayObject<double>>
|
|
|
22722
22770
|
#if defined(GEA_CPP_SHARED_RUNTIME_BUILTINS)
|
|
22723
22771
|
extern const gea::CallableObject<std::string(gea::Ref<gea::ArrayObject<double>>)> fromCharCode;
|
|
22724
22772
|
#else
|
|
22725
|
-
inline
|
|
22773
|
+
inline constexpr gea::HostFunction<std::string(gea::Ref<gea::ArrayObject<double>>), &detail::fromCharCode_invoke> fromCharCode{};
|
|
22726
22774
|
#endif
|
|
22727
22775
|
|
|
22728
22776
|
} // namespace StringConstructor
|
|
@@ -25126,9 +25174,10 @@ bool isDocumentLevelEvent(const Node& node, const std::string& name) {
|
|
|
25126
25174
|
* is gated on the node's live token instead -- a rebuilt subtree leaves an
|
|
25127
25175
|
* inert closure behind rather than a second generation of the handler.
|
|
25128
25176
|
*
|
|
25129
|
-
*
|
|
25177
|
+
* Bubbling events are delegated to the BODY and gated by `containsNode`; see
|
|
25130
25178
|
* the no-argument `addNodeListener` for why, and `recordNodeSubscription` for
|
|
25131
|
-
* how it is released with the node.
|
|
25179
|
+
* how it is released with the node. Scroll stays on its target because it does
|
|
25180
|
+
* not bubble.
|
|
25132
25181
|
*/
|
|
25133
25182
|
template <typename Node, typename Invoke>
|
|
25134
25183
|
void bindNodeListener(Node& node, const std::string& name, Invoke invoke) {
|
|
@@ -25155,6 +25204,10 @@ void bindNodeListener(Node& node, const std::string& name, Invoke invoke) {
|
|
|
25155
25204
|
});
|
|
25156
25205
|
return;
|
|
25157
25206
|
}
|
|
25207
|
+
if (name == "scroll") {
|
|
25208
|
+
target.addEventListener(name.c_str(), std::move(run));
|
|
25209
|
+
return;
|
|
25210
|
+
}
|
|
25158
25211
|
const auto listenerId = gea::embedded::ui::Document::instance().body().addEventListener(
|
|
25159
25212
|
name.c_str(), [target, run](gea::framework::events::PointerEvent& event) mutable {
|
|
25160
25213
|
if (!gea::embedded::ui::Tree::instance().containsNode(target.id(), event.targetId)) return;
|