@geastack/compiler 1.0.63 → 1.0.65
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/dist/cli-emit.js +14 -5
- package/dist/conversion/dictionary-view.js +13 -2
- package/dist/conversion/document-record-view.d.ts +0 -1
- package/dist/conversion/document-record-view.js +30 -3
- package/dist/conversion/impossible-field-read.d.ts +9 -0
- package/dist/conversion/impossible-field-read.js +26 -0
- package/dist/conversion/nodes.d.ts +12 -0
- package/dist/conversion/nodes.js +106 -2
- package/dist/conversion/record-view.js +21 -0
- package/dist/ir/build.d.ts +5 -2
- package/dist/ir/build.js +9 -2
- package/dist/ir/callable-class-flow.js +233 -13
- package/dist/ir/certify/parallel-region.js +1 -0
- package/dist/ir/certify.js +32 -2
- package/dist/ir/hoist.js +15 -1
- package/dist/ir/host-template-conversions.js +12 -0
- package/dist/ir/lower-invocation.js +42 -2
- package/dist/ir/lower-property.js +2 -2
- package/dist/ir/model.d.ts +18 -6
- package/dist/ir/native-callable-data-reads.js +15 -2
- package/dist/ir/native-field-view-domains.d.ts +8 -0
- package/dist/ir/native-field-view-domains.js +44 -3
- package/dist/ir/native-field-view-facts.d.ts +2 -2
- package/dist/ir/native-field-view-facts.js +57 -13
- package/dist/ir/native-own-assignment.js +20 -2
- package/dist/ir/program-conversions.js +38 -7
- package/dist/ir/property-read-conversions.js +14 -5
- package/dist/ir/publish-native-field-view-facts.js +1 -1
- package/dist/ir/queries.js +2 -0
- package/dist/ir/read-only-dictionary.js +138 -15
- package/dist/ir/reflection-demand.js +7 -1
- package/dist/ir/shake.js +26 -6
- package/dist/ir/typed-property-access.d.ts +20 -0
- package/dist/ir/typed-property-access.js +56 -0
- package/dist/projection/bindings.js +14 -19
- package/dist/projection/fields.js +7 -1
- package/dist/projection/native-object-data.d.ts +8 -1
- package/dist/projection/native-object-data.js +16 -4
- package/dist/representation/derive.js +67 -1
- package/dist/representation/proxy-carriers.js +17 -2
- package/dist/representation/publish.js +34 -0
- package/dist/semantics/callable-own-data-slots.js +71 -6
- package/dist/semantics/model/operations.d.ts +15 -4
- package/dist/semantics/native-own-assignment.d.ts +3 -0
- package/dist/semantics/normalize/collection-bindings.js +2 -2
- package/dist/semantics/normalize/flow/array-element-continuation.d.ts +1 -1
- package/dist/semantics/normalize/flow/array-element-continuation.js +32 -9
- package/dist/semantics/normalize/flow/callable-reach.d.ts +3 -5
- package/dist/semantics/normalize/flow/callable-reach.js +3 -5
- package/dist/semantics/normalize/flow/component-solver.d.ts +2 -0
- package/dist/semantics/normalize/flow/component-solver.js +32 -6
- package/dist/semantics/normalize/flow/computed-key-set.js +53 -1
- package/dist/semantics/normalize/flow/source-value-session.js +16 -14
- package/dist/semantics/normalize/producers/invocations.js +40 -1
- package/dist/semantics/normalize/producers/native-own-assignment.js +12 -4
- package/dist/semantics/normalize/reachability.js +18 -8
- package/dist/semantics/normalize/structural-mutable-field.d.ts +1 -0
- package/dist/semantics/normalize/structural-mutable-field.js +170 -4
- package/dist/semantics/normalize/structural-parts.js +6 -1
- package/dist/semantics/normalize/structural-self-reference.d.ts +1 -1
- package/dist/semantics/normalize/structural-self-reference.js +9 -1
- package/dist/semantics/normalize/structural.js +10 -1
- package/dist/semantics/program.js +102 -1
- package/dist/targets/cpp/class-properties/emit-class-properties.js +9 -0
- package/dist/targets/cpp/emit-allocation.js +22 -1
- package/dist/targets/cpp/emit-bindings.js +5 -5
- package/dist/targets/cpp/emit-exceptions.js +6 -0
- package/dist/targets/cpp/emit-narrowing.js +24 -2
- package/dist/targets/cpp/emit-native-field-view.d.ts +1 -1
- package/dist/targets/cpp/emit-native-field-view.js +37 -5
- package/dist/targets/cpp/emit-native-own-assignment.js +5 -1
- package/dist/targets/cpp/emit-record-view.js +6 -1
- package/dist/targets/cpp/emit-tonumber.d.ts +22 -11
- package/dist/targets/cpp/emit-tonumber.js +86 -25
- package/dist/targets/cpp/emit.js +3 -0
- package/dist/targets/cpp/host/emit-host-invoke.js +6 -6
- package/dist/targets/cpp/prototype/emit-prototype-array.js +13 -1
- package/dist/targets/cpp/records.js +15 -7
- package/dist/targets/cpp/recursive-containers.js +5 -1
- package/dist/targets/cpp/translation-unit.js +17 -2
- package/package.json +4 -2
- package/src/targets/cpp/runtime/gea_runtime.h +212 -7
|
@@ -38,7 +38,7 @@ import { allOperationsOf } from './model.js';
|
|
|
38
38
|
import { nativeArgumentsMatch, receivedCallArguments } from './call-entry.js';
|
|
39
39
|
import { nativeGenericCallEntriesOf, nativeGenericSelectorMatches } from './generic-call-entry.js';
|
|
40
40
|
import { classConstructorBodyMatches, constructMatchesAbi, explicitObjectConstructEntryOf, ordinaryConstructBodyMatches } from './construct-entry.js';
|
|
41
|
-
import { observesNativeCarrierOnly, operandsOfIrOperation, resultOfIrOperation } from './queries.js';
|
|
41
|
+
import { observesNativeCarrierOnly, operandsOfIrOperation, resultOfIrOperation, successorsOfTerminator } from './queries.js';
|
|
42
42
|
import { nativeCallablePrimitiveDataWritePreservesOwner } from './native-callable-data-flow.js';
|
|
43
43
|
/**
|
|
44
44
|
* The collections an origin cell starts with. There is one cell per IR value
|
|
@@ -586,6 +586,106 @@ const ownedOperationKinds = new Set([
|
|
|
586
586
|
* bodies cite, the program-level recipes', and everything they reach. This is
|
|
587
587
|
* the only thing the solve reads of `programConversions` (`nativeCallableFlowOf`).
|
|
588
588
|
*/
|
|
589
|
+
/**
|
|
590
|
+
* The writes that reach each binding read, for the reads where that set is
|
|
591
|
+
* provable from one body's own control flow -- keyed by the read's result.
|
|
592
|
+
*
|
|
593
|
+
* A binding is one mutable cell, so linking every write of a declaration to
|
|
594
|
+
* every read of it is always sound; it is also why `options = filter(options)`
|
|
595
|
+
* made the filtered copy's reads answer for the caller's original too. This
|
|
596
|
+
* narrows a read to the writes that can reach it, and only where nothing else
|
|
597
|
+
* can write the cell between them: every read and write of the declaration in
|
|
598
|
+
* one straight-line-or-branching body (no loop, no try/catch, no
|
|
599
|
+
* iterator-close, generator or async resumption), no closure capturing it, no
|
|
600
|
+
* per-iteration renewal, and a write on EVERY path from entry to the read (a
|
|
601
|
+
* parameter, a hoisted `var` or function binding, or a read before the
|
|
602
|
+
* initializer reaches the entry state, which the IR does not spell as a
|
|
603
|
+
* write). Every other read is absent and keeps linking every write.
|
|
604
|
+
*/
|
|
605
|
+
const exactReachingBindingWritesOf = (bodies, placements) => {
|
|
606
|
+
const owners = new Map();
|
|
607
|
+
const shared = new Set();
|
|
608
|
+
for (const body of bodies) {
|
|
609
|
+
for (const declaration of body.facts?.capturedDeclarations ?? [])
|
|
610
|
+
shared.add(declaration);
|
|
611
|
+
for (const declaration of body.facts?.boxed ?? [])
|
|
612
|
+
shared.add(declaration);
|
|
613
|
+
for (const block of body.blocks.values())
|
|
614
|
+
for (const operation of block.operations) {
|
|
615
|
+
if (operation.kind !== 'binding-read' && operation.kind !== 'binding-write' && operation.kind !== 'binding-renew')
|
|
616
|
+
continue;
|
|
617
|
+
if (operation.kind === 'binding-renew')
|
|
618
|
+
shared.add(operation.declaration);
|
|
619
|
+
const owner = owners.get(operation.declaration);
|
|
620
|
+
if (owner === undefined)
|
|
621
|
+
owners.set(operation.declaration, body);
|
|
622
|
+
else if (owner !== body)
|
|
623
|
+
owners.set(operation.declaration, null);
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
const tracked = (declaration, body) => owners.get(declaration) === body &&
|
|
627
|
+
!shared.has(declaration) &&
|
|
628
|
+
['local', 'region'].includes(placements.get(declaration)?.storage.kind ?? '');
|
|
629
|
+
const exact = new Map();
|
|
630
|
+
const entryState = null;
|
|
631
|
+
for (const body of bodies) {
|
|
632
|
+
if (body.tryRegions.length > 0 || (body.iteratorCloseRegions?.length ?? 0) > 0)
|
|
633
|
+
continue;
|
|
634
|
+
if (body.generator || body.async || body.generatorPrologueBoundary)
|
|
635
|
+
continue;
|
|
636
|
+
// Reverse postorder over an acyclic graph; a back edge (any loop) or a
|
|
637
|
+
// block the entry never reaches leaves the whole body on the fallback.
|
|
638
|
+
const order = [];
|
|
639
|
+
const state = new Map();
|
|
640
|
+
let acyclic = true;
|
|
641
|
+
const visit = (id) => {
|
|
642
|
+
const block = body.blocks.get(id);
|
|
643
|
+
if (!block) {
|
|
644
|
+
acyclic = false;
|
|
645
|
+
return;
|
|
646
|
+
}
|
|
647
|
+
state.set(id, 'open');
|
|
648
|
+
for (const next of successorsOfTerminator(block.terminator)) {
|
|
649
|
+
const seen = state.get(next);
|
|
650
|
+
if (seen === 'open')
|
|
651
|
+
acyclic = false;
|
|
652
|
+
else if (seen === undefined)
|
|
653
|
+
visit(next);
|
|
654
|
+
if (!acyclic)
|
|
655
|
+
return;
|
|
656
|
+
}
|
|
657
|
+
state.set(id, 'done');
|
|
658
|
+
order.push(id);
|
|
659
|
+
};
|
|
660
|
+
visit(body.entry);
|
|
661
|
+
if (!acyclic || order.length !== body.blocks.size)
|
|
662
|
+
continue;
|
|
663
|
+
order.reverse();
|
|
664
|
+
const exits = new Map();
|
|
665
|
+
const predecessors = new Map();
|
|
666
|
+
for (const id of order)
|
|
667
|
+
for (const next of successorsOfTerminator(body.blocks.get(id).terminator))
|
|
668
|
+
predecessors.set(next, [...(predecessors.get(next) ?? []), id]);
|
|
669
|
+
// A declaration absent from a block's exit still holds the entry state there.
|
|
670
|
+
for (const id of order) {
|
|
671
|
+
const incoming = (predecessors.get(id) ?? []).map((predecessor) => exits.get(predecessor));
|
|
672
|
+
const reaching = new Map();
|
|
673
|
+
for (const declaration of new Set(incoming.flatMap((exit) => [...exit.keys()])))
|
|
674
|
+
reaching.set(declaration, new Set(incoming.flatMap((exit) => [...(exit.get(declaration) ?? [entryState])])));
|
|
675
|
+
for (const operation of body.blocks.get(id).operations) {
|
|
676
|
+
if (operation.kind === 'binding-write' && tracked(operation.declaration, body))
|
|
677
|
+
reaching.set(operation.declaration, new Set([operation.value.value]));
|
|
678
|
+
else if (operation.kind === 'binding-read' && tracked(operation.declaration, body)) {
|
|
679
|
+
const writes = reaching.get(operation.declaration);
|
|
680
|
+
if (writes && !writes.has(entryState))
|
|
681
|
+
exact.set(operation.result.id, [...writes]);
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
exits.set(id, reaching);
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
return exact;
|
|
688
|
+
};
|
|
589
689
|
const flowViewNodesOf = (bodies, conversions, programConversions) => {
|
|
590
690
|
const citedViewNodes = bodies
|
|
591
691
|
.flatMap((body) => nativeFieldViewBodyCitationsOf(body).map((id) => conversions?.nodeById(id)))
|
|
@@ -807,6 +907,9 @@ const solveNativeCallableFlow = (viewNodes, bodies, placements, classes, convers
|
|
|
807
907
|
const arrayHeaps = new Map();
|
|
808
908
|
const dictionaryHeaps = new Map();
|
|
809
909
|
const proxyHeaps = new Map();
|
|
910
|
+
// Every compiled allocation of each proxy carrier, keyed by the carrier's summary heap.
|
|
911
|
+
const proxyAllocations = new Map();
|
|
912
|
+
let proxyHoldersSettled = false;
|
|
810
913
|
const recordViews = new WeakMap();
|
|
811
914
|
const adaptedFrames = new Map();
|
|
812
915
|
const transportsCallablePrefix = (from, to, node) => {
|
|
@@ -861,6 +964,7 @@ const solveNativeCallableFlow = (viewNodes, bodies, placements, classes, convers
|
|
|
861
964
|
classHeaps.set(layout.declaration, { declaration: layout.declaration, fields: slots, layoutKey: null, valid: true });
|
|
862
965
|
}
|
|
863
966
|
const operations = bodies.flatMap((body) => [...body.blocks.values()].flatMap((block) => [...block.operations, block.terminator]));
|
|
967
|
+
const reachingBindingWrites = exactReachingBindingWritesOf(bodies, placements);
|
|
864
968
|
const staticSlots = censusClassStaticFieldSlots(bodies, classes);
|
|
865
969
|
const staticHeaps = new Map([...staticSlots.slots].map(([declaration, slots]) => [
|
|
866
970
|
declaration,
|
|
@@ -1593,6 +1697,47 @@ const solveNativeCallableFlow = (viewNodes, bodies, placements, classes, convers
|
|
|
1593
1697
|
const body = bodyById.get(id);
|
|
1594
1698
|
return implicitEntriesComplete && body?.abi != null && body.construct === null && !implicitEntries.has(id);
|
|
1595
1699
|
}));
|
|
1700
|
+
// A conversion the census does not vouch for may build a proxy carrier
|
|
1701
|
+
// itself, with parts no compiled allocation describes, so an unknown holder
|
|
1702
|
+
// of that carrier cannot be narrowed to the compiled allocations.
|
|
1703
|
+
const foreignProxyCarriers = new Set();
|
|
1704
|
+
const proxyCarriersOf = (representation) => representation.kind === 'proxy-object'
|
|
1705
|
+
? [representation]
|
|
1706
|
+
: representation.kind === 'optional'
|
|
1707
|
+
? proxyCarriersOf(representation.payload)
|
|
1708
|
+
: representation.kind === 'borrowed-ref'
|
|
1709
|
+
? proxyCarriersOf(representation.referent)
|
|
1710
|
+
: representation.kind === 'tagged-union'
|
|
1711
|
+
? representation.arms.flatMap((arm) => proxyCarriersOf(arm.value))
|
|
1712
|
+
: [];
|
|
1713
|
+
for (const operation of operations) {
|
|
1714
|
+
if (operation.kind !== 'convert')
|
|
1715
|
+
continue;
|
|
1716
|
+
const node = conversions?.nodeById(operation.conversionUse);
|
|
1717
|
+
if (node &&
|
|
1718
|
+
representationKey(node.source) === representationKey(operation.source.representation) &&
|
|
1719
|
+
representationKey(node.target) === representationKey(operation.result.representation))
|
|
1720
|
+
continue;
|
|
1721
|
+
for (const carrier of proxyCarriersOf(operation.result.representation))
|
|
1722
|
+
for (const heap of nativeReferences(carrier).heaps)
|
|
1723
|
+
foreignProxyCarriers.add(heap);
|
|
1724
|
+
}
|
|
1725
|
+
// The compiled allocations are the ones this flow's bodies hold. A function
|
|
1726
|
+
// the program can enter whose body the flow lacks (a class member, or a
|
|
1727
|
+
// closure allocated here) may allocate proxies of its own, so then no
|
|
1728
|
+
// unknown holder of a proxy carrier is narrowed to the listed allocations.
|
|
1729
|
+
const enterableFunctions = [];
|
|
1730
|
+
for (const layout of classes.values()) {
|
|
1731
|
+
enterableFunctions.push(layout.constructor);
|
|
1732
|
+
for (const method of [...layout.methods, ...layout.staticMethods])
|
|
1733
|
+
enterableFunctions.push(method.callable);
|
|
1734
|
+
for (const accessor of [...layout.accessors, ...layout.staticAccessors])
|
|
1735
|
+
enterableFunctions.push(accessor.getter, accessor.setter);
|
|
1736
|
+
}
|
|
1737
|
+
for (const operation of operations)
|
|
1738
|
+
if (operation.kind === 'allocate-callable')
|
|
1739
|
+
enterableFunctions.push(operation.functionId);
|
|
1740
|
+
const proxyAllocationsComplete = enterableFunctions.every((id) => id === null || bodyById.has(id));
|
|
1596
1741
|
const entered = new Set();
|
|
1597
1742
|
const pendingBodies = [];
|
|
1598
1743
|
const enter = (id) => {
|
|
@@ -2079,27 +2224,52 @@ const solveNativeCallableFlow = (viewNodes, bodies, placements, classes, convers
|
|
|
2079
2224
|
}
|
|
2080
2225
|
link(value(operation.target.value), heap.fields.get('target').cell);
|
|
2081
2226
|
link(value(operation.handler.value), heap.fields.get('handler').cell);
|
|
2227
|
+
if (heap.template !== undefined) {
|
|
2228
|
+
const allocated = proxyAllocations.get(heap.template) ?? [];
|
|
2229
|
+
if (!allocated.includes(heap))
|
|
2230
|
+
allocated.push(heap);
|
|
2231
|
+
proxyAllocations.set(heap.template, allocated);
|
|
2232
|
+
}
|
|
2082
2233
|
break;
|
|
2083
2234
|
}
|
|
2084
2235
|
case 'proxy-part': {
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2236
|
+
// A proxy's carrier is a native type only compiled code allocates,
|
|
2237
|
+
// so a holder of that carrier the solve cannot name -- unknown, or
|
|
2238
|
+
// still empty once every origin has settled -- holds one of the
|
|
2239
|
+
// carrier's compiled allocations, each with its own parts. An empty
|
|
2240
|
+
// holder is not rejected: rejecting it publishes the trap calls its
|
|
2241
|
+
// parts feed before their callees can arrive.
|
|
2242
|
+
const compiledAllocations = () => {
|
|
2243
|
+
const carrier = operation.proxy.representation.kind === 'proxy-object' ? nativeReferences(operation.proxy.representation) : null;
|
|
2244
|
+
return proxyAllocationsComplete && carrier?.complete === true && !carrier.heaps.some((heap) => foreignProxyCarriers.has(heap))
|
|
2245
|
+
? carrier.heaps.flatMap((summary) => proxyAllocations.get(summary) ?? [])
|
|
2246
|
+
: null;
|
|
2247
|
+
};
|
|
2248
|
+
// [[ProxyTarget]] and [[ProxyHandler]] are internal slots that no
|
|
2249
|
+
// holder can replace (`observeProxy`), so their parts stay exact.
|
|
2250
|
+
const linkParts = (heaps) => {
|
|
2251
|
+
for (const heap of heaps) {
|
|
2092
2252
|
const part = heap.fields.get(operation.part);
|
|
2093
2253
|
if (!heap.valid ||
|
|
2094
2254
|
heap.proxy !== true ||
|
|
2095
2255
|
!part ||
|
|
2096
2256
|
representationKey(part.representation) !== representationKey(operation.result.representation)) {
|
|
2097
2257
|
untrusted(operation);
|
|
2098
|
-
return
|
|
2258
|
+
return false;
|
|
2099
2259
|
}
|
|
2100
2260
|
link(part.cell, value(operation.result.id));
|
|
2101
2261
|
}
|
|
2102
|
-
return
|
|
2262
|
+
return true;
|
|
2263
|
+
};
|
|
2264
|
+
heapEffect(operation, () => {
|
|
2265
|
+
const proxy = value(operation.proxy.value);
|
|
2266
|
+
const allocations = proxy.unknown || (proxyHoldersSettled && proxy.heaps.size === 0) ? compiledAllocations() : [];
|
|
2267
|
+
if (allocations === null) {
|
|
2268
|
+
untrusted(operation);
|
|
2269
|
+
return true;
|
|
2270
|
+
}
|
|
2271
|
+
const heaps = [...new Set([...proxy.heaps, ...allocations])];
|
|
2272
|
+
return !linkParts(heaps) || heaps.length > 0 || proxyHoldersSettled;
|
|
2103
2273
|
});
|
|
2104
2274
|
break;
|
|
2105
2275
|
}
|
|
@@ -2194,8 +2364,13 @@ const solveNativeCallableFlow = (viewNodes, bodies, placements, classes, convers
|
|
|
2194
2364
|
if (!['local', 'region'].includes(placements.get(operation.declaration)?.storage.kind ?? ''))
|
|
2195
2365
|
markEscaped(value(operation.value.value), undefined, [operation]);
|
|
2196
2366
|
break;
|
|
2197
|
-
case 'binding-read':
|
|
2198
|
-
|
|
2367
|
+
case 'binding-read': {
|
|
2368
|
+
const reaching = reachingBindingWrites.get(operation.result.id);
|
|
2369
|
+
if (reaching)
|
|
2370
|
+
for (const write of reaching)
|
|
2371
|
+
link(value(write), value(operation.result.id));
|
|
2372
|
+
else
|
|
2373
|
+
link(binding(operation.declaration), value(operation.result.id));
|
|
2199
2374
|
if (!['local', 'region'].includes(placements.get(operation.declaration)?.storage.kind ?? ''))
|
|
2200
2375
|
external(value(operation.result.id), operation.result.representation);
|
|
2201
2376
|
if (operation.closedCallable)
|
|
@@ -2204,6 +2379,7 @@ const solveNativeCallableFlow = (viewNodes, bodies, placements, classes, convers
|
|
|
2204
2379
|
: operation.closedCallable.functionIds)
|
|
2205
2380
|
addFunction(value(operation.result.id), id);
|
|
2206
2381
|
break;
|
|
2382
|
+
}
|
|
2207
2383
|
case 'phi':
|
|
2208
2384
|
for (const incoming of operation.incoming)
|
|
2209
2385
|
link(value(incoming.value.value), value(operation.result.id));
|
|
@@ -2389,6 +2565,19 @@ const solveNativeCallableFlow = (viewNodes, bodies, placements, classes, convers
|
|
|
2389
2565
|
const node = conversions?.nodeById(operation.conversionUse);
|
|
2390
2566
|
const from = operation.source.representation;
|
|
2391
2567
|
const to = operation.result.representation;
|
|
2568
|
+
// A conversion that never completes normally (`unreachable-value` out
|
|
2569
|
+
// of a never-produced `undefined`: the dead `return peer` after an
|
|
2570
|
+
// absent package's `require`) yields no value, so it carries no
|
|
2571
|
+
// identity. Linking its source made that dead value's unknown origin
|
|
2572
|
+
// the function's return, and the proxy it really returns lost the
|
|
2573
|
+
// handler provenance its trap calls are resolved by.
|
|
2574
|
+
if (node !== null &&
|
|
2575
|
+
node !== undefined &&
|
|
2576
|
+
'materializer' in node.capability &&
|
|
2577
|
+
node.capability.materializer.normalCompletion === 'never' &&
|
|
2578
|
+
representationKey(node.source) === representationKey(from) &&
|
|
2579
|
+
representationKey(node.target) === representationKey(to))
|
|
2580
|
+
break;
|
|
2392
2581
|
// A Value injected into a union's own `dynamic` arm stays in that arm:
|
|
2393
2582
|
// it is dispatched by its own [[Get]], never through an installed
|
|
2394
2583
|
// Document entry protocol, so it does not withdraw the protocol every
|
|
@@ -2973,6 +3162,9 @@ const solveNativeCallableFlow = (viewNodes, bodies, placements, classes, convers
|
|
|
2973
3162
|
escape(returned, `implicit-accessor-return:${id}`);
|
|
2974
3163
|
}
|
|
2975
3164
|
}
|
|
3165
|
+
settle();
|
|
3166
|
+
proxyHoldersSettled = true;
|
|
3167
|
+
settle();
|
|
2976
3168
|
for (;;) {
|
|
2977
3169
|
for (const operation of pendingCalls) {
|
|
2978
3170
|
if (matchedCalls.has(operation) || rejectedCalls.has(operation))
|
|
@@ -3192,6 +3384,34 @@ const solveNativeCallableFlow = (viewNodes, bodies, placements, classes, convers
|
|
|
3192
3384
|
storeExpando(owner, null, { kind: 'dynamic', reason: 'declared-any-never-narrowed' });
|
|
3193
3385
|
}
|
|
3194
3386
|
}
|
|
3387
|
+
// A record boxed into `any` can meet any store through a dynamic receiver
|
|
3388
|
+
// (`target[key] = value` on an `any` target): a key its layout lacks lands
|
|
3389
|
+
// in its expando as the Value written, so a live view reading that key
|
|
3390
|
+
// through this allocation meets a Value and must read it checked into its
|
|
3391
|
+
// own carrier. Only a program with such a store, and under only the keys
|
|
3392
|
+
// those stores can name, adds the route.
|
|
3393
|
+
const dynamicStoreKeys = new Set();
|
|
3394
|
+
for (const operation of operations)
|
|
3395
|
+
if (operation.kind === 'set' && operation.receiver.representation.kind === 'dynamic') {
|
|
3396
|
+
const constant = keyOf(operation.key);
|
|
3397
|
+
if (constant !== null)
|
|
3398
|
+
dynamicStoreKeys.add(constant);
|
|
3399
|
+
else
|
|
3400
|
+
for (const key of operation.provenKeyTexts ?? [null])
|
|
3401
|
+
dynamicStoreKeys.add(key);
|
|
3402
|
+
}
|
|
3403
|
+
if (dynamicStoreKeys.size > 0)
|
|
3404
|
+
for (const operation of operations) {
|
|
3405
|
+
if (operation.kind !== 'convert' || operation.result.representation.kind !== 'dynamic')
|
|
3406
|
+
continue;
|
|
3407
|
+
let boxed = operation.source.representation;
|
|
3408
|
+
while (boxed.kind === 'optional' || boxed.kind === 'borrowed-ref')
|
|
3409
|
+
boxed = boxed.kind === 'optional' ? boxed.payload : boxed.referent;
|
|
3410
|
+
if ((boxed.kind !== 'record' && boxed.kind !== 'native-record-ref') || boxed.ownership !== 'shared-refcount')
|
|
3411
|
+
continue;
|
|
3412
|
+
for (const key of dynamicStoreKeys)
|
|
3413
|
+
storeExpando(boxed, key, { kind: 'dynamic', reason: 'declared-any-never-narrowed' });
|
|
3414
|
+
}
|
|
3195
3415
|
// A runtime-keyed store over a live view target (`for (const key in
|
|
3196
3416
|
// parameters) data[key] = parameters[key]`): a key no descriptor names
|
|
3197
3417
|
// lands, in the value's own carrier, in the expando of the plain allocation
|
|
@@ -3462,7 +3682,7 @@ const solveNativeCallableFlow = (viewNodes, bodies, placements, classes, convers
|
|
|
3462
3682
|
// The selected heaps already prove each allocation's own slot or its
|
|
3463
3683
|
// absence; a union arm's certified absence is the unknown-receiver
|
|
3464
3684
|
// answer (`native-field-view-domains.ts`) and is no route behind them.
|
|
3465
|
-
if (routes.some((route) => route.originalAbsent === true || route.dynamicGet === true || route.nativeData === true))
|
|
3685
|
+
if (routes.some((route) => route.originalAbsent === true || route.dynamicGet === true || route.nativeData === true || route.arrayElement === true))
|
|
3466
3686
|
continue;
|
|
3467
3687
|
writable().set(name, [
|
|
3468
3688
|
...(domains.get(name) ?? []),
|
package/dist/ir/certify.js
CHANGED
|
@@ -26,7 +26,7 @@ import { nativeArrayViewPlanMatches } from '../conversion/array-view.js';
|
|
|
26
26
|
import { nativeDescriptorSnapshotPlanMatches } from '../conversion/native-descriptor-snapshot.js';
|
|
27
27
|
import { nativeArrayDescriptorSnapshotMatches, nativeArrayDescriptorReinstallationOf } from './native-array-descriptor-snapshot.js';
|
|
28
28
|
import { operationOfResult } from '../identity/ids.js';
|
|
29
|
-
import { classFamilyMayAllocate, classMethodFamilyHasNativeBody, classMethodReadMayMissAbstractly } from '../projection/dispatch.js';
|
|
29
|
+
import { classAbstractMemberMissesAt, classFamilyMayAllocate, classMethodFamilyHasNativeBody, classMethodReadMayMissAbstractly } from '../projection/dispatch.js';
|
|
30
30
|
import { forEachEmbeddedRepresentation } from '../representation/embedded-carriers.js';
|
|
31
31
|
import { captureCapabilityOf, representationKey } from '../representation/model.js';
|
|
32
32
|
import { propertyAccessKeysOf } from './certify/property-access.js';
|
|
@@ -1229,7 +1229,7 @@ const nativeFieldViewDemandsOf = (operation, ctx) => {
|
|
|
1229
1229
|
return [];
|
|
1230
1230
|
const receipt = operation.kind === 'get' ? operation.nativeFieldViewRead : operation.nativeFieldViewWrite;
|
|
1231
1231
|
const key = constantKeyTextOf(operation, ctx);
|
|
1232
|
-
const required = nativeFieldViewOperationNeedsReceipt(operation, ctx.nativeFieldViewTargets ?? new Set(), ctx.authenticatedHosts, key, ctx.deriver);
|
|
1232
|
+
const required = nativeFieldViewOperationNeedsReceipt(operation, ctx.nativeFieldViewTargets ?? new Set(), ctx.authenticatedHosts, key, ctx.deriver, ctx.nativeFieldViews);
|
|
1233
1233
|
if (!required && receipt === undefined)
|
|
1234
1234
|
return [];
|
|
1235
1235
|
const semantic = ctx.semanticOperationOf(operation.lineage);
|
|
@@ -1295,6 +1295,23 @@ const nativeDocumentEntryDemandsOf = (operation, ctx) => {
|
|
|
1295
1295
|
operation.nativeDocumentEntry.conversion
|
|
1296
1296
|
].map((id) => ({ key: `conversion:${id}` }));
|
|
1297
1297
|
};
|
|
1298
|
+
/** The value is a constructor's `prototype` read, seen through payload conversions only. */
|
|
1299
|
+
const receiverIsClassPrototype = (value, definitionOf) => {
|
|
1300
|
+
const seen = new Set();
|
|
1301
|
+
for (let current = value; !seen.has(current);) {
|
|
1302
|
+
seen.add(current);
|
|
1303
|
+
const definition = definitionOf(current);
|
|
1304
|
+
if (definition?.kind === 'convert' && definition.rebuild === undefined) {
|
|
1305
|
+
current = definition.source.value;
|
|
1306
|
+
continue;
|
|
1307
|
+
}
|
|
1308
|
+
if (definition?.kind !== 'get' || definition.receiver.representation.kind !== 'constructor-family')
|
|
1309
|
+
return false;
|
|
1310
|
+
const key = definitionOf(definition.key.value);
|
|
1311
|
+
return key?.kind === 'constant' && key.literal === 'string' && key.text === 'prototype';
|
|
1312
|
+
}
|
|
1313
|
+
return false;
|
|
1314
|
+
};
|
|
1298
1315
|
const internalConversionDemandsOf = (operation, ctx) => {
|
|
1299
1316
|
const key = 'key' in operation ? ctx.definitionOf(operation.key.value) : null;
|
|
1300
1317
|
const keyText = key?.kind === 'constant' && (key.literal === 'string' || key.literal === 'number') ? key.text : null;
|
|
@@ -1384,6 +1401,19 @@ const internalConversionDemandsOf = (operation, ctx) => {
|
|
|
1384
1401
|
verdict: 'missing',
|
|
1385
1402
|
detail: 'a native method read that misses on an abstract declaration has no carrier for undefined'
|
|
1386
1403
|
});
|
|
1404
|
+
// The class's prototype object exists whether or not any instance does, so
|
|
1405
|
+
// the allocation census cannot waive a read through it: an abstract key
|
|
1406
|
+
// misses there (`Missing.prototype.process` is undefined), and the
|
|
1407
|
+
// emitter's no-instance trap would abort where the language answers.
|
|
1408
|
+
else if (keyText !== null &&
|
|
1409
|
+
operation.receiver.representation.kind === 'class-ref' &&
|
|
1410
|
+
receiverIsClassPrototype(operation.receiver.value, ctx.definitionOf) &&
|
|
1411
|
+
classAbstractMemberMissesAt(ctx.classes, operation.receiver.representation.declaration, keyText))
|
|
1412
|
+
demands.push({
|
|
1413
|
+
key: 'property-access:class-prototype:abstract-method',
|
|
1414
|
+
verdict: 'missing',
|
|
1415
|
+
detail: 'an abstract method read through the class prototype has no function object'
|
|
1416
|
+
});
|
|
1387
1417
|
const abis = ctx.abis ??
|
|
1388
1418
|
new Map([...ctx.bodies.values()].flatMap((body) => (body.abi === null ? [] : [[body.sourceOwner, body.abi]])));
|
|
1389
1419
|
const methods = methodConversionInputsOf(operation, keyText, ctx.classes, abis, ctx.deriver, ctx.body);
|
package/dist/ir/hoist.js
CHANGED
|
@@ -382,6 +382,15 @@ export const loopInvariantHoistsOf = (body, programConstants = new Map(), copied
|
|
|
382
382
|
};
|
|
383
383
|
const relocated = new Set();
|
|
384
384
|
const into = new Map();
|
|
385
|
+
const quietLoops = new Map();
|
|
386
|
+
const runsNoOtherCodeOnce = (blocks) => {
|
|
387
|
+
const known = quietLoops.get(blocks);
|
|
388
|
+
if (known !== undefined)
|
|
389
|
+
return known;
|
|
390
|
+
const quiet = runsNoOtherCode(blocks);
|
|
391
|
+
quietLoops.set(blocks, quiet);
|
|
392
|
+
return quiet;
|
|
393
|
+
};
|
|
385
394
|
/** Whether this operation reads only, and reads only things that cannot move. */
|
|
386
395
|
const isPureRead = (operation, blocks) => {
|
|
387
396
|
if (operation.kind === 'constant')
|
|
@@ -399,7 +408,12 @@ export const loopInvariantHoistsOf = (body, programConstants = new Map(), copied
|
|
|
399
408
|
if (operation.kind === 'binding-read') {
|
|
400
409
|
if (isProgramConstant(operation.declaration))
|
|
401
410
|
return true;
|
|
402
|
-
|
|
411
|
+
// A closure that captured the cell writes it only when it runs, and a
|
|
412
|
+
// loop that runs no other code runs none. Refusing regardless kept every
|
|
413
|
+
// bound in a module body that declares any function re-read from its
|
|
414
|
+
// global each turn, and with the bound unnamed at the preheader
|
|
415
|
+
// `dense-loops.ts` refused every window.
|
|
416
|
+
if (mayCaptureLocals && !runsNoOtherCodeOnce(blocks))
|
|
403
417
|
return false;
|
|
404
418
|
// Invariant only while the loop writes the cell nowhere.
|
|
405
419
|
return (cellWrites.get(operation.declaration) ?? []).every((write) => !blocks.has(write.block));
|
|
@@ -153,6 +153,18 @@ export const hostTemplateConversionInputsOf = (operation, definitionOf, deriver,
|
|
|
153
153
|
callback.abi.receiver === null)
|
|
154
154
|
add('prototype-result', storedCarrier(callback.abi.result), result.element);
|
|
155
155
|
}
|
|
156
|
+
// `reduce(cb, initialValue)` threads ONE accumulator through the seed,
|
|
157
|
+
// every callback argument 0 and every callback answer (23.1.3.24), so
|
|
158
|
+
// the seed enters the callback's own accumulator carrier -- the checker's
|
|
159
|
+
// `T`-overload with `T = any` (an `any[]` receiver) gives a `{}` seed an
|
|
160
|
+
// `any` accumulator, and the runtime reducer has one accumulator type.
|
|
161
|
+
if ((member === 'reduce' || member === 'reduceRight') && operation.arguments.length === 2) {
|
|
162
|
+
const callback = operation.arguments[0]?.representation;
|
|
163
|
+
const seed = operation.arguments[1]?.representation;
|
|
164
|
+
const accumulator = callback?.kind === 'function-value-dispatch' && callback.abi.receiver === null ? callback.abi.parameters[0] : null;
|
|
165
|
+
if (seed && accumulator)
|
|
166
|
+
add('prototype-argument', seed, accumulator.value);
|
|
167
|
+
}
|
|
156
168
|
// SortCompare hands the comparator two elements; the emitter converts
|
|
157
169
|
// each into its parameter's carrier (`sortText`), so both pairs are
|
|
158
170
|
// this call's own certified conversions.
|
|
@@ -11,7 +11,7 @@ import { IrLoweringBlockedError } from './lower-graph.js';
|
|
|
11
11
|
import { lowerProxyConstruct } from './lower-proxy.js';
|
|
12
12
|
import { publishObjectAssignFieldConversions } from './call-entry.js';
|
|
13
13
|
import { plannedHostTemplateOf } from '../projection/callee.js';
|
|
14
|
-
import { abiOfCallee, constructAbiOfCallee, packRestArguments, namedOperand, optionalResultRepresentation, orderedOperandsOf, registerResult, requireLineage, requireResultRepresentation, resolveOptionalOperand, resolveRequiredOperand, enter, convertTo, convertOrDrift } from './lower-operands.js';
|
|
14
|
+
import { abiOfCallee, constructAbiOfCallee, packRestArguments, namedOperand, optionalResultRepresentation, orderedOperandsOf, registerResult, requireLineage, requireResultRepresentation, resolveOptionalOperand, resolveRequiredOperand, enter, convertTo, narrowedBindingRead, convertOrDrift } from './lower-operands.js';
|
|
15
15
|
import { operationOfResult, withoutFunctionSpecialization } from '../identity/ids.js';
|
|
16
16
|
import { calleeRenderingOf, deferredCalleeOf, numericRestHostCallOf } from '../projection/callee.js';
|
|
17
17
|
import { fixedApplyArgumentFieldsOf } from '../projection/apply-arguments.js';
|
|
@@ -618,6 +618,18 @@ export const lowerInvocation = (ctx, block, operation) => {
|
|
|
618
618
|
(abiOfCallee(callee.representation.payload)?.receiver ?? null) !== null;
|
|
619
619
|
const receiver = unbound ?? (declared || callee.representation.kind === 'dynamic' ? supplied : absentableMethod ? resolvedReceiver : null);
|
|
620
620
|
const representation = optionalResultRepresentation(ctx, operation, 'value');
|
|
621
|
+
// `getBuiltinModule('<literal>')` of an ES-module builtin yields that
|
|
622
|
+
// module's namespace object. The registry still evaluates the module (once,
|
|
623
|
+
// through its record) and answers its CommonJS exports cell, which an ES
|
|
624
|
+
// module never fills; the namespace is built from the export cells below.
|
|
625
|
+
const namespaceLookup = operation.builtinModuleLookup?.namespace === undefined ? null : operation.builtinModuleLookup;
|
|
626
|
+
const namespaceShape = namespaceLookup === null || representation === null
|
|
627
|
+
? null
|
|
628
|
+
: representation.kind === 'record'
|
|
629
|
+
? representation
|
|
630
|
+
: representation.kind === 'optional' && representation.payload.kind === 'record'
|
|
631
|
+
? representation.payload
|
|
632
|
+
: null;
|
|
621
633
|
// The call yields what the convention returns; the plan may have selected
|
|
622
634
|
// a narrowing of it for the result (`f()` read as `T` where `f` returns
|
|
623
635
|
// `T | undefined` behind a guard). That narrowing is a `convert` the
|
|
@@ -667,7 +679,7 @@ export const lowerInvocation = (ctx, block, operation) => {
|
|
|
667
679
|
const hostTemplate = hostTemplateOf(ctx, operation, callee);
|
|
668
680
|
if (hostTemplate === 'object-assign' && wholeSpreadArgument === null)
|
|
669
681
|
publishObjectAssignFieldConversions(args, ctx.constantDeriver, ctx.program.classes, ctx.program.conversions);
|
|
670
|
-
const called = ctx.builder.call(block, lineage, callee, receiver, args, yielded, undefined, operation.builtinModuleLookup, wholeSpreadArgument !== null, operation.intrinsicOwnKeys && calleeRenderingOf(ctx.program.slots.input, operation) === 'template' ? true : undefined, fixedDataDefinition ?? undefined, numericRestHostCall ?? undefined, !fixedDataDefinition && wholeSpreadArgument === null && calleeRenderingOf(ctx.program.slots.input, operation) === 'template'
|
|
682
|
+
const called = ctx.builder.call(block, lineage, callee, receiver, args, namespaceShape === null ? yielded : { kind: 'dynamic', reason: 'commonjs-module-boundary' }, undefined, operation.builtinModuleLookup, wholeSpreadArgument !== null, operation.intrinsicOwnKeys && calleeRenderingOf(ctx.program.slots.input, operation) === 'template' ? true : undefined, fixedDataDefinition ?? undefined, numericRestHostCall ?? undefined, !fixedDataDefinition && wholeSpreadArgument === null && calleeRenderingOf(ctx.program.slots.input, operation) === 'template'
|
|
671
683
|
? objectValueConversionsOf(operation.intrinsicMutation, args, ctx.constantDeriver, ctx.program.conversions)
|
|
672
684
|
: undefined,
|
|
673
685
|
// Carried whatever the callee's rendering: unlike `intrinsicOwnKeys`,
|
|
@@ -683,6 +695,34 @@ export const lowerInvocation = (ctx, block, operation) => {
|
|
|
683
695
|
: undefined, calleeRenderingOf(ctx.program.slots.input, operation) === 'template' && wholeSpreadArgument === null
|
|
684
696
|
? nativeObjectDataSlotSchemasOf(ctx.graph).namedDataDefinitions.get(operation.id)
|
|
685
697
|
: undefined);
|
|
698
|
+
if (namespaceShape !== null && namespaceLookup !== null && representation !== null) {
|
|
699
|
+
if (namespaceShape.accessors.length > 0)
|
|
700
|
+
throw new IrLoweringBlockedError('a builtin module namespace type declares accessors');
|
|
701
|
+
const cells = new Map((namespaceLookup.namespace ?? []).map((field) => [field.key, field.declaration]));
|
|
702
|
+
const fields = namespaceShape.fields.map((field) => {
|
|
703
|
+
const declaration = cells.get(field.key);
|
|
704
|
+
if (declaration === undefined)
|
|
705
|
+
throw new IrLoweringBlockedError(`builtin module "${namespaceLookup.builtinModule}" exports no "${field.key}"`);
|
|
706
|
+
// A generic function has no cell; its value is which member of the
|
|
707
|
+
// choice it is, exactly as a bare read of its name lowers (`lower.ts`).
|
|
708
|
+
const member = field.value.kind === 'generic-function-set' ? field.value.members.indexOf(declaration) : -1;
|
|
709
|
+
const value = member >= 0
|
|
710
|
+
? ctx.builder.constant(block, lineage, String(member), 'number', field.value)
|
|
711
|
+
: narrowedBindingRead(ctx, block, lineage, operation, declaration, field.value);
|
|
712
|
+
return { key: field.key, value: { value, representation: field.value } };
|
|
713
|
+
});
|
|
714
|
+
const fresh = ctx.builder.allocateRecord(block, lineage, fields, namespaceShape);
|
|
715
|
+
const namespace = {
|
|
716
|
+
value: ctx.builder.moduleNamespace(block, lineage, namespaceLookup.target, { value: fresh, representation: namespaceShape }),
|
|
717
|
+
representation: namespaceShape
|
|
718
|
+
};
|
|
719
|
+
const answered = convertTo(ctx, block, lineage, namespace, representation, 'builtin-module-namespace');
|
|
720
|
+
if (answered === null)
|
|
721
|
+
throw new IrLoweringBlockedError('a builtin module namespace does not convert into the lookup result');
|
|
722
|
+
registerResult(ctx, operation, answered.value);
|
|
723
|
+
registerCallShortCircuit(ctx, block, operation, answered.value, representation);
|
|
724
|
+
return;
|
|
725
|
+
}
|
|
686
726
|
const returned = identityDefinition !== null && called !== null && identityTarget !== null && representation !== null
|
|
687
727
|
? (convertTo(ctx, block, lineage, { value: called, representation: identityTarget }, representation, 'intrinsic-return-identity')
|
|
688
728
|
?.value ?? called)
|
|
@@ -5,7 +5,7 @@ import { IrLoweringBlockedError } from './lower-graph.js';
|
|
|
5
5
|
import { pendingShortCircuitOf } from './lower-short-circuit.js';
|
|
6
6
|
import { methodValueOriginOf } from '../projection/callee.js';
|
|
7
7
|
import { propertyReadResultRepresentationOf } from '../projection/fields.js';
|
|
8
|
-
import { computedPropertyKeyTextsOf, typedComputedReadRecipeOf, typedComputedWriteRecipeOf } from './typed-property-access.js';
|
|
8
|
+
import { computedPropertyKeyTextsOf, correlatedSourceFieldsOf, typedComputedReadRecipeOf, typedComputedWriteRecipeOf } from './typed-property-access.js';
|
|
9
9
|
import { nativePropertyReadNeedsCoercibility } from './native-property-coercibility.js';
|
|
10
10
|
import { holdsProxyArm, lowerProxyAccess, lowerProxyUnionAccess } from './lower-proxy.js';
|
|
11
11
|
import { namedOperand, optionalResultRepresentation, registerResult, requireLineage, requireResultRepresentation, resolveRequiredOperand, convertOrDrift, assertedCensusUnionReceiver, assertedClassReceiver, nativeBaseReceiverView, enterRequiredOperand, enter, narrowedBindingRead, reactiveFieldReadOf } from './lower-operands.js';
|
|
@@ -218,7 +218,7 @@ const lowerPropertyOn = (ctx, block, lineage, operation, receiver) => {
|
|
|
218
218
|
const value = operation.nativeCallableReadonlySet === undefined
|
|
219
219
|
? enterRequiredOperand(ctx, block, lineage, operation, namedOperand(operation, 'value'))
|
|
220
220
|
: resolveRequiredOperand(ctx, block, lineage, namedOperand(operation, 'value'));
|
|
221
|
-
return ctx.builder.set(block, lineage, receiver, key, value, operation.strict, optionalResultRepresentation(ctx, operation, 'value'), typedComputedWriteRecipeOf(ctx.graph, operation, receiver.representation, ctx.constantDeriver, ctx.program.classes) ?? undefined, computedPropertyKeyTextsOf(ctx.graph, operation), operation.ordinaryFunctionDataWrite, operation.ordinaryObjectDataWriteAbsent);
|
|
221
|
+
return ctx.builder.set(block, lineage, receiver, key, value, operation.strict, optionalResultRepresentation(ctx, operation, 'value'), typedComputedWriteRecipeOf(ctx.graph, operation, receiver.representation, ctx.constantDeriver, ctx.program.classes) ?? undefined, computedPropertyKeyTextsOf(ctx.graph, operation), operation.ordinaryFunctionDataWrite, operation.ordinaryObjectDataWriteAbsent, correlatedSourceFieldsOf(ctx.graph, operation, ctx.constantDeriver));
|
|
222
222
|
}
|
|
223
223
|
case 'define-own-property': {
|
|
224
224
|
const key = resolveRequiredOperand(ctx, block, lineage, namedOperand(operation, 'key'));
|
package/dist/ir/model.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import type { VirtualMemberRole } from '../projection/dispatch.js';
|
|
|
8
8
|
import type { UnboxedMethodAssumption } from '../projection/method-value-escapes.js';
|
|
9
9
|
import type { NativeEqualityRecipe } from './native-equality.js';
|
|
10
10
|
import type { FixedDataDefinitionRecipe } from './fixed-data-definition.js';
|
|
11
|
-
import type { TypedComputedReadRecipe, TypedComputedWriteRecipe } from './typed-property-access.js';
|
|
11
|
+
import type { CorrelatedSourceField, TypedComputedReadRecipe, TypedComputedWriteRecipe } from './typed-property-access.js';
|
|
12
12
|
import type { OperationConversion } from './operation-conversions.js';
|
|
13
13
|
import type { NativeMethodValueRecipe } from '../conversion/native-method.js';
|
|
14
14
|
import type { DenseLoopPlan } from './dense-loops.js';
|
|
@@ -256,6 +256,8 @@ export interface SetOperation extends IrOperationBase {
|
|
|
256
256
|
readonly typedComputedWrite?: TypedComputedWriteRecipe;
|
|
257
257
|
/** See `GetOperation.provenKeyTexts` -- the same fact, copied for a `[[Set]]`'s own computed key. */
|
|
258
258
|
readonly provenKeyTexts?: readonly string[];
|
|
259
|
+
/** See `correlatedSourceFieldsOf`: per key, the carrier of the source field the stored value was read from. */
|
|
260
|
+
readonly correlatedSourceFields?: readonly CorrelatedSourceField[];
|
|
259
261
|
}
|
|
260
262
|
export interface DeleteOperation extends IrOperationBase {
|
|
261
263
|
readonly kind: 'delete';
|
|
@@ -360,10 +362,7 @@ export interface CallOperation extends IrOperationBase {
|
|
|
360
362
|
readonly arguments: readonly IrOperand[];
|
|
361
363
|
readonly result: IrResult | null;
|
|
362
364
|
/** A retained ModuleRecord exposed through a host's dynamic builtin lookup. */
|
|
363
|
-
readonly builtinModuleLookup?:
|
|
364
|
-
readonly target: RegionId;
|
|
365
|
-
readonly builtinModule: string;
|
|
366
|
-
};
|
|
365
|
+
readonly builtinModuleLookup?: import('../semantics/model/operations.js').CallBuiltinModuleLookup;
|
|
367
366
|
/**
|
|
368
367
|
* `true` exactly when `arguments` holds ONE operand that is itself the
|
|
369
368
|
* whole, already-materialized element sequence of a spread argument
|
|
@@ -587,6 +586,19 @@ export interface CommonJsRequireOperation extends IrOperationBase {
|
|
|
587
586
|
readonly builtinModule: string | null;
|
|
588
587
|
readonly result: IrResult;
|
|
589
588
|
}
|
|
589
|
+
/**
|
|
590
|
+
* The one namespace object of an ES module reached by a literal builtin lookup
|
|
591
|
+
* (`process.getBuiltinModule('v8')`). `fresh` is a record built from the
|
|
592
|
+
* module's export cells after its evaluation; the first one built in a realm
|
|
593
|
+
* is kept and every later lookup answers that same object, as Node's
|
|
594
|
+
* namespace identity requires.
|
|
595
|
+
*/
|
|
596
|
+
export interface ModuleNamespaceOperation extends IrOperationBase {
|
|
597
|
+
readonly kind: 'module-namespace';
|
|
598
|
+
readonly target: RegionId;
|
|
599
|
+
readonly fresh: IrOperand;
|
|
600
|
+
readonly result: IrResult;
|
|
601
|
+
}
|
|
590
602
|
/** A lexical CommonJS wrapper parameter read. */
|
|
591
603
|
export interface CommonJsBindingOperation extends IrOperationBase {
|
|
592
604
|
readonly kind: 'commonjs-binding';
|
|
@@ -1504,7 +1516,7 @@ export interface TestOperation extends IrOperationBase {
|
|
|
1504
1516
|
readonly result: IrResult;
|
|
1505
1517
|
}
|
|
1506
1518
|
export type IrTerminatorOperation = BranchOperation | JumpOperation | ReturnOperation | ThrowOperation | SwitchOperation;
|
|
1507
|
-
export type IrOperation = GetOperation | SetOperation | DeleteOperation | HasPropertyOperation | OwnPropertyKeysOperation | DefineOwnPropertyOperation | SpreadCopyOperation | CallOperation | CommonJsRequireOperation | CommonJsBindingOperation | CommonJsBindingSetOperation | SuperInitializeOperation | ReparentConstructorOperation | ConstructOperation | ConstantOperation | BindingReadOperation | BindingWriteOperation | BindingRenewOperation | ParameterOperation | ReceiverOperation | GlobalThisOperation | UnresolvableReferenceOperation | AwaitOperation | YieldOperation | CatchBindingOperation | ComputeOperation | PhiOperation | IrTerminatorOperation | AllocateOrdinaryObjectOperation | AllocateArrayObjectOperation | AllocateCallableOperation | BindCallableOperation | AllocateConstructorOperation | AllocateProxyOperation | ProxyPartOperation | ProxyTrapCheckOperation | ProxyArmTestOperation | AllocateRecordOperation | AllocateTemplateObjectOperation | AllocateRegExpOperation | ConvertOperation | MergeLiveArmRebuildOperation | DeadLogicalMergeValueOperation | GetIteratorOperation | IteratorNextOperation | IteratorDoneOperation | IteratorCloseOperation | ElementOperation | ElementPropOperation | ElementChildOperation | TestOperation;
|
|
1519
|
+
export type IrOperation = GetOperation | SetOperation | DeleteOperation | HasPropertyOperation | OwnPropertyKeysOperation | DefineOwnPropertyOperation | SpreadCopyOperation | CallOperation | CommonJsRequireOperation | ModuleNamespaceOperation | CommonJsBindingOperation | CommonJsBindingSetOperation | SuperInitializeOperation | ReparentConstructorOperation | ConstructOperation | ConstantOperation | BindingReadOperation | BindingWriteOperation | BindingRenewOperation | ParameterOperation | ReceiverOperation | GlobalThisOperation | UnresolvableReferenceOperation | AwaitOperation | YieldOperation | CatchBindingOperation | ComputeOperation | PhiOperation | IrTerminatorOperation | AllocateOrdinaryObjectOperation | AllocateArrayObjectOperation | AllocateCallableOperation | BindCallableOperation | AllocateConstructorOperation | AllocateProxyOperation | ProxyPartOperation | ProxyTrapCheckOperation | ProxyArmTestOperation | AllocateRecordOperation | AllocateTemplateObjectOperation | AllocateRegExpOperation | ConvertOperation | MergeLiveArmRebuildOperation | DeadLogicalMergeValueOperation | GetIteratorOperation | IteratorNextOperation | IteratorDoneOperation | IteratorCloseOperation | ElementOperation | ElementPropOperation | ElementChildOperation | TestOperation;
|
|
1508
1520
|
/** Every operation kind that may terminate a block. Used to keep the "terminator is last" invariant checkable. */
|
|
1509
1521
|
export declare const terminatorKinds: readonly ["branch", "jump", "return", "throw", "switch"];
|
|
1510
1522
|
export declare const isTerminatorOperation: (operation: IrOperation) => operation is IrTerminatorOperation;
|