@geastack/compiler 1.0.42 → 1.0.44
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.js +8 -2
- package/dist/conversion/nodes.js +5 -2
- package/dist/ir/callable-class-flow.js +48 -13
- package/dist/ir/certify.js +1 -1
- package/dist/ir/host-template-conversions.d.ts +2 -2
- package/dist/ir/host-template-conversions.js +73 -2
- package/dist/ir/lower-destructuring.js +22 -3
- package/dist/ir/lower-operands.js +30 -1
- package/dist/ir/native-field-view-facts.d.ts +8 -1
- package/dist/ir/native-field-view-facts.js +13 -3
- package/dist/ir/operation-conversions.js +1 -1
- package/dist/ir/program-conversions.d.ts +1 -1
- package/dist/ir/program-conversions.js +68 -1
- package/dist/ir/property-read-conversions.js +7 -1
- package/dist/ir/publish-native-field-view-facts.js +4 -0
- package/dist/ir/reflection-demand.js +29 -3
- package/dist/ir/shake.js +21 -0
- package/dist/projection/dispatch.d.ts +19 -1
- package/dist/projection/dispatch.js +34 -0
- package/dist/representation/value-records.js +182 -13
- package/dist/semantics/frontend.js +18 -14
- package/dist/semantics/normalize/collection-bindings.d.ts +7 -0
- package/dist/semantics/normalize/collection-bindings.js +35 -1
- package/dist/semantics/normalize/derived-expression-type.js +49 -0
- package/dist/semantics/normalize/field-bindings.js +6 -1
- package/dist/semantics/normalize/flow/component-solver.js +37 -2
- package/dist/semantics/normalize/flow/source-value-session.d.ts +12 -2
- package/dist/semantics/normalize/flow/source-value-session.js +861 -212
- package/dist/semantics/normalize/global-host-mutations.js +14 -6
- package/dist/semantics/normalize/implicit-arguments-tuple.d.ts +11 -10
- package/dist/semantics/normalize/implicit-arguments-tuple.js +15 -3
- package/dist/semantics/normalize/local-bindings.js +23 -1
- package/dist/semantics/normalize/producers/references.js +26 -18
- package/dist/semantics/normalize/structural-array-element.d.ts +7 -0
- package/dist/semantics/normalize/structural-array-element.js +24 -1
- package/dist/semantics/normalize/structural-layout-type.js +5 -1
- package/dist/semantics/normalize/structural-mutable-method.js +88 -2
- package/dist/semantics/normalize/structural-parts.js +13 -8
- package/dist/semantics/normalize/structural.js +25 -1
- package/dist/targets/cpp/borrowed-call-entry.d.ts +41 -2
- package/dist/targets/cpp/borrowed-call-entry.js +91 -6
- package/dist/targets/cpp/class-properties/emit-class-properties.js +5 -1
- package/dist/targets/cpp/emit-callable.js +81 -39
- package/dist/targets/cpp/emit-native-field-view.d.ts +2 -0
- package/dist/targets/cpp/emit-native-field-view.js +1 -1
- package/dist/targets/cpp/emit-properties.js +114 -12
- package/dist/targets/cpp/host/emit-host-invoke.js +16 -2
- package/dist/targets/cpp/host/emit-host-object.js +69 -2
- package/dist/targets/cpp/host/host-members.js +4 -0
- package/dist/targets/cpp/prototype/emit-prototype-array.d.ts +42 -0
- package/dist/targets/cpp/prototype/emit-prototype-array.js +31 -9
- package/dist/targets/cpp/records.d.ts +1 -0
- package/dist/targets/cpp/records.js +40 -17
- package/dist/targets/cpp/translation-unit.js +82 -24
- package/dist/targets/cpp/virtual-methods.js +9 -4
- package/package.json +1 -1
- package/src/targets/cpp/runtime/gea_dynamic_proxy.h +17 -1
- package/src/targets/cpp/runtime/gea_runtime.h +485 -64
|
@@ -22,6 +22,7 @@ export const emptyFieldBindingCensus = {
|
|
|
22
22
|
};
|
|
23
23
|
const WIDENED = process.env['GEA_FLOW_WIDE'] === '1';
|
|
24
24
|
const isAnyType = (type) => (type.flags & ts.TypeFlags.Any) !== 0;
|
|
25
|
+
const isNullish = (type) => (type.flags & (ts.TypeFlags.Null | ts.TypeFlags.Undefined)) !== 0;
|
|
25
26
|
/** Duplicated from `parameter-bindings.ts` (not exported there): `any`/`void`/`never` say nothing about storage. */
|
|
26
27
|
const isUnusableEvidence = (type) => (type.flags & (ts.TypeFlags.Any | ts.TypeFlags.Void | ts.TypeFlags.Never)) !== 0;
|
|
27
28
|
/**
|
|
@@ -1017,7 +1018,11 @@ flow) => {
|
|
|
1017
1018
|
// a vector class's `x`/`y`/`z` carry dozens of writes each, all typed
|
|
1018
1019
|
// `number` but one (`this.x = e[ 12 ]`, `e` unannotated) silent -- every
|
|
1019
1020
|
// read boxed by a veto that read no fact.
|
|
1020
|
-
|
|
1021
|
+
// Writes that speak only of ABSENCE do not count: `this.shaku = null` in a
|
|
1022
|
+
// constructor, filled later by one silent `this.shaku = index.shakuhachi`,
|
|
1023
|
+
// joined to `null` alone, and that silent write -- the only one carrying
|
|
1024
|
+
// what the field holds -- then aborted in its checked unbox.
|
|
1025
|
+
else if (silent > 0 && (!lenientPhase || types.every(isNullish)))
|
|
1021
1026
|
attribute(symbol, 'write-unresolved');
|
|
1022
1027
|
else {
|
|
1023
1028
|
// A FRESH `{}` written into the field contributes a value with no keys,
|
|
@@ -482,6 +482,8 @@ const componentEngine = (graph, mode) => {
|
|
|
482
482
|
};
|
|
483
483
|
/** Past this many entries an edge collection becomes a hash table: a lookup is a linear scan below it. */
|
|
484
484
|
const SMALL_EDGES = 8;
|
|
485
|
+
/** How far ahead of its last edge read `observedState` looks before asking the dependency. */
|
|
486
|
+
const CURSOR_WINDOW = 4;
|
|
485
487
|
const edgeCount = (edges) => edges === null ? 0 : edges instanceof Map || edges instanceof Set ? edges.size : Array.isArray(edges) ? edges.length : 1;
|
|
486
488
|
const NO_EDGE_STATES = [];
|
|
487
489
|
const edgeStates = (edges) => edges === null ? NO_EDGE_STATES : edges instanceof Set || Array.isArray(edges) ? edges : [edges];
|
|
@@ -814,11 +816,32 @@ export const dependencyFactSolver = (expand, mode, keysAreStates = false) => {
|
|
|
814
816
|
return candidate;
|
|
815
817
|
return undefined;
|
|
816
818
|
}
|
|
819
|
+
// A transfer re-reads its edges in the order it first read them, so the
|
|
820
|
+
// running owner's next edge is nearly always the one asked for: checked
|
|
821
|
+
// first, a few places ahead for a read the transfer skipped this time.
|
|
822
|
+
// The test below asks a dependency's dependents, which for a node read
|
|
823
|
+
// from everywhere is a table of hundreds of thousands of states; on a
|
|
824
|
+
// large three.js program it was a tenth of the session's time.
|
|
825
|
+
if (owner === cursorOwner) {
|
|
826
|
+
const end = Math.min(observed.length, readCursor + CURSOR_WINDOW);
|
|
827
|
+
for (let at = readCursor; at < end; at++) {
|
|
828
|
+
const candidate = observed[at];
|
|
829
|
+
if (candidate.solverKey === dependency) {
|
|
830
|
+
readCursor = at + 1;
|
|
831
|
+
return candidate;
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
}
|
|
817
835
|
// An owner is among a dependency's dependents exactly when it observes
|
|
818
836
|
// it: the two edges are only ever added together (`factsFrom`).
|
|
819
837
|
const state = existingStateOf(dependency);
|
|
820
838
|
return state !== undefined && edgeHas(state.dependents, owner) ? state : undefined;
|
|
821
839
|
};
|
|
840
|
+
// The state whose transfer or seal is running and where its edge reads have
|
|
841
|
+
// reached (`observedState`). Only a hint: every hit is checked against the
|
|
842
|
+
// dependency's key, so a stale cursor costs a miss, never a wrong edge.
|
|
843
|
+
let cursorOwner = null;
|
|
844
|
+
let readCursor = 0;
|
|
822
845
|
const withObserved = (observed, dependencyState) => {
|
|
823
846
|
if (observed === null)
|
|
824
847
|
return dependencyState;
|
|
@@ -981,6 +1004,10 @@ export const dependencyFactSolver = (expand, mode, keysAreStates = false) => {
|
|
|
981
1004
|
const holding = holders.get(fact);
|
|
982
1005
|
if (holding === undefined)
|
|
983
1006
|
return NO_HOLDERS;
|
|
1007
|
+
// A key that is its own state needs no copy: the collection only grows in
|
|
1008
|
+
// `index`, which runs after the transfer asking has returned.
|
|
1009
|
+
if (keysAreStates)
|
|
1010
|
+
return edgeStates(holding);
|
|
984
1011
|
const found = [];
|
|
985
1012
|
for (const holder of edgeStates(holding))
|
|
986
1013
|
found.push(holder.solverKey);
|
|
@@ -1046,8 +1073,16 @@ export const dependencyFactSolver = (expand, mode, keysAreStates = false) => {
|
|
|
1046
1073
|
const observeFrom = (ownerState, dependency) => factsFrom(ownerState, dependency, false);
|
|
1047
1074
|
// A state's edge readers, minted per transfer or seal call rather than kept
|
|
1048
1075
|
// on every state (see `stateOf`).
|
|
1049
|
-
const transferOf = (state) =>
|
|
1050
|
-
|
|
1076
|
+
const transferOf = (state) => {
|
|
1077
|
+
cursorOwner = state;
|
|
1078
|
+
readCursor = 0;
|
|
1079
|
+
return definitionOf(state).transfer((dependency) => readFrom(state, dependency), (dependency) => observeFrom(state, dependency), (fact) => holdersOfFrom(state, fact), state.solverKey);
|
|
1080
|
+
};
|
|
1081
|
+
const sealOf = (state) => {
|
|
1082
|
+
cursorOwner = state;
|
|
1083
|
+
readCursor = 0;
|
|
1084
|
+
return definitionOf(state).seal((dependency) => readFrom(state, dependency), (dependency) => observeFrom(state, dependency), (fact) => holdersOfFrom(state, fact), state.solverKey);
|
|
1085
|
+
};
|
|
1051
1086
|
const propagate = () => {
|
|
1052
1087
|
for (let cursor = 0; cursor < queue.length; cursor++) {
|
|
1053
1088
|
const state = queue[cursor];
|
|
@@ -45,7 +45,14 @@ type QueryShape = {
|
|
|
45
45
|
readonly kind: 'own-keys';
|
|
46
46
|
readonly node: ObjectRoot;
|
|
47
47
|
} | {
|
|
48
|
-
readonly kind: '
|
|
48
|
+
readonly kind: 'enumerated-keys';
|
|
49
|
+
readonly node: ts.Expression;
|
|
50
|
+
} | {
|
|
51
|
+
readonly kind: 'use' | 'root-use';
|
|
52
|
+
readonly node: ts.Expression;
|
|
53
|
+
readonly root: Value;
|
|
54
|
+
} | {
|
|
55
|
+
readonly kind: 'enumerated-slots';
|
|
49
56
|
readonly node: ts.Expression;
|
|
50
57
|
readonly root: Value;
|
|
51
58
|
} | {
|
|
@@ -57,7 +64,10 @@ type QueryShape = {
|
|
|
57
64
|
readonly kind: 'unknown-reads';
|
|
58
65
|
readonly node: ObjectRoot;
|
|
59
66
|
} | {
|
|
60
|
-
readonly kind: '
|
|
67
|
+
readonly kind: 'copy-sites';
|
|
68
|
+
readonly node: ObjectRoot;
|
|
69
|
+
} | {
|
|
70
|
+
readonly kind: 'key-reads' | 'key-uses' | 'family-slot';
|
|
61
71
|
readonly node: ObjectRoot;
|
|
62
72
|
readonly key: string;
|
|
63
73
|
} | {
|