@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
package/dist/cli.js
CHANGED
|
@@ -10,15 +10,21 @@ import { preflightReportLines } from './preflight/report.js';
|
|
|
10
10
|
import { structuralShapeKey } from './semantics/model/structural-types.js';
|
|
11
11
|
import { closeSync, openSync, writeSync } from 'node:fs';
|
|
12
12
|
import { dirname } from 'node:path';
|
|
13
|
-
import { setFlagsFromString } from 'node:v8';
|
|
13
|
+
import { getHeapStatistics, setFlagsFromString } from 'node:v8';
|
|
14
14
|
// V8 grows the heap after each collection by up to four times what survived
|
|
15
15
|
// it, bounded only by the old-space limit -- which builds raise to 32 GB so a
|
|
16
16
|
// large program cannot fail on the default. A compile allocates fast and keeps
|
|
17
17
|
// a few GB live, so with that headroom a large app's compile held 15.8 GB of
|
|
18
18
|
// resident memory for 3.3 GB of live data. A 25% margin bounded it at 4.6 GB
|
|
19
19
|
// for 9% more wall time. A caller that states its own percentage keeps it.
|
|
20
|
+
//
|
|
21
|
+
// The margin is only for a heap that limit leaves unbounded. A process given a
|
|
22
|
+
// few gigabytes is bounded by them already, and a 25% margin under them only
|
|
23
|
+
// makes it collect more often: a large three.js program compiling under a 4 GB
|
|
24
|
+
// heap took 5% longer with it (406 s against 387 s) and peaked 0.5 GB lower.
|
|
20
25
|
const statedGrowth = [...process.execArgv, ...(process.env['NODE_OPTIONS'] ?? '').split(/\s+/)].some((flag) => /^--heap[-_]growing[-_]percent/.test(flag));
|
|
21
|
-
|
|
26
|
+
const boundedHeap = getHeapStatistics().heap_size_limit <= 8 * 1024 * 1024 * 1024;
|
|
27
|
+
if (!statedGrowth && !boundedHeap)
|
|
22
28
|
setFlagsFromString('--heap-growing-percent=25');
|
|
23
29
|
/**
|
|
24
30
|
* `--project <tsconfig.json>` names the project explicitly; `--no-project`
|
package/dist/conversion/nodes.js
CHANGED
|
@@ -331,9 +331,12 @@ export const createConversionNodes = (input) => {
|
|
|
331
331
|
// A conditional can have one exact record arm and another record
|
|
332
332
|
// that satisfies the same interface. Dispatch the complete source
|
|
333
333
|
// when its native view is admitted; selecting the exact arm would
|
|
334
|
-
// discard the other live value.
|
|
334
|
+
// discard the other live value. An optional record target is the
|
|
335
|
+
// same question: `this._c = c` into a `{...} | null` field selected
|
|
336
|
+
// the record arm of a `record | Vector3` parameter unchecked and
|
|
337
|
+
// stored the Vector3's bytes as the record.
|
|
335
338
|
if (source.kind === 'tagged-union' &&
|
|
336
|
-
(
|
|
339
|
+
(nativeRecord.kind === 'record' || (nativeRecord.kind === 'native-record-ref' && nativeRecord.native === null)) &&
|
|
337
340
|
(capability.materializer.armSelection !== undefined || capability.materializer.nativeSelection !== undefined)) {
|
|
338
341
|
const complete = input.registry.structuralRecipe?.(source, target, nodeFor, undefined, nativeMethodFor, nodeById, dictionaryReadFor, checkedFrameNarrowingFor);
|
|
339
342
|
if (complete?.recordView?.view.kind === 'dispatch')
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getHeapStatistics } from 'node:v8';
|
|
1
2
|
import { nativeBodyIgnoresLogicalReceiver } from './native-logical-receiver-body.js';
|
|
2
3
|
import { nativeConstructorMethodBodiesOf } from './native-constructor-reads.js';
|
|
3
4
|
import { classLayoutOfCopy, classLayoutsConstructedBy, constructedBaseOf } from '../projection/classes.js';
|
|
@@ -255,9 +256,12 @@ class ValueTable {
|
|
|
255
256
|
ordinal = ordinal * 10 + digit;
|
|
256
257
|
}
|
|
257
258
|
this.ordinal = ordinal;
|
|
258
|
-
|
|
259
|
-
|
|
259
|
+
// The body spelled out and compared whole: `id.startsWith(this.lastBody, 4)`
|
|
260
|
+
// asks the same, but took about eight times as long on these long ids, and
|
|
261
|
+
// this is asked millions of times a solve.
|
|
260
262
|
const body = id.slice(4, bar);
|
|
263
|
+
if (this.lastSlots !== null && body === this.lastBody)
|
|
264
|
+
return this.lastSlots;
|
|
261
265
|
let slots = this.byBody.get(body);
|
|
262
266
|
if (slots === undefined) {
|
|
263
267
|
if (!create)
|
|
@@ -3395,31 +3399,34 @@ const repointed = (value, pairs, seen, fresh) => {
|
|
|
3395
3399
|
const partner = pairs.get(value);
|
|
3396
3400
|
if (partner !== undefined)
|
|
3397
3401
|
return partner;
|
|
3398
|
-
if (fresh.objects.has(value))
|
|
3399
|
-
fresh.reached = true;
|
|
3400
3402
|
if (seen.has(value))
|
|
3401
3403
|
return seen.get(value);
|
|
3404
|
+
// An object the new program holds that this answer allocated (`flowOverCopy`):
|
|
3405
|
+
// copied when asked to, so the answer holds its own as a solve's would.
|
|
3406
|
+
const copied = fresh.objects.has(value);
|
|
3407
|
+
if (copied && !fresh.copy)
|
|
3408
|
+
fresh.reached = true;
|
|
3402
3409
|
seen.set(value, value);
|
|
3403
3410
|
let result = value;
|
|
3404
3411
|
if (Array.isArray(value)) {
|
|
3405
3412
|
const items = value.map((item) => repointed(item, pairs, seen, fresh));
|
|
3406
|
-
if (items.some((item, index) => item !== value[index]))
|
|
3413
|
+
if (copied || items.some((item, index) => item !== value[index]))
|
|
3407
3414
|
result = items;
|
|
3408
3415
|
}
|
|
3409
3416
|
else if (value instanceof Map) {
|
|
3410
3417
|
const entries = [...value].map(([key, item]) => [repointed(key, pairs, seen, fresh), repointed(item, pairs, seen, fresh)]);
|
|
3411
|
-
if ([...value].some(([key, item], index) => entries[index][0] !== key || entries[index][1] !== item))
|
|
3418
|
+
if (copied || [...value].some(([key, item], index) => entries[index][0] !== key || entries[index][1] !== item))
|
|
3412
3419
|
result = new Map(entries);
|
|
3413
3420
|
}
|
|
3414
3421
|
else if (value instanceof Set) {
|
|
3415
3422
|
const items = [...value].map((item) => repointed(item, pairs, seen, fresh));
|
|
3416
|
-
if ([...value].some((item, index) => items[index] !== item))
|
|
3423
|
+
if (copied || [...value].some((item, index) => items[index] !== item))
|
|
3417
3424
|
result = new Set(items);
|
|
3418
3425
|
}
|
|
3419
3426
|
else {
|
|
3420
3427
|
const prototype = Object.getPrototypeOf(value);
|
|
3421
3428
|
if (prototype === Object.prototype || prototype === null) {
|
|
3422
|
-
let copy = null;
|
|
3429
|
+
let copy = copied ? { ...value } : null;
|
|
3423
3430
|
for (const key of Object.keys(value)) {
|
|
3424
3431
|
const item = value[key];
|
|
3425
3432
|
const moved = repointed(item, pairs, seen, fresh);
|
|
@@ -3429,6 +3436,8 @@ const repointed = (value, pairs, seen, fresh) => {
|
|
|
3429
3436
|
if (copy !== null)
|
|
3430
3437
|
result = copy;
|
|
3431
3438
|
}
|
|
3439
|
+
else if (copied)
|
|
3440
|
+
fresh.reached = true;
|
|
3432
3441
|
}
|
|
3433
3442
|
seen.set(value, result);
|
|
3434
3443
|
return result;
|
|
@@ -3437,9 +3446,9 @@ const repointed = (value, pairs, seen, fresh) => {
|
|
|
3437
3446
|
* A remembered answer re-pointed from the program it was solved over to a
|
|
3438
3447
|
* same-data copy of it, or null when it cannot stand for a solve of the copy.
|
|
3439
3448
|
*/
|
|
3440
|
-
const flowOverCopy = (flow, pairs) => {
|
|
3449
|
+
const flowOverCopy = (flow, pairs, copy = false) => {
|
|
3441
3450
|
const seen = new Map();
|
|
3442
|
-
const fresh = { objects: new Set(pairs.values()), reached: false };
|
|
3451
|
+
const fresh = { objects: new Set(pairs.values()), reached: false, copy };
|
|
3443
3452
|
const { nativeFieldViewAbsentRoutesOf: absentRoutesOf, callables, ...data } = flow;
|
|
3444
3453
|
const moved = repointed(data, pairs, seen, fresh);
|
|
3445
3454
|
// A solve allocates each callee identity afresh, and the dispatch passes then
|
|
@@ -3447,8 +3456,12 @@ const flowOverCopy = (flow, pairs) => {
|
|
|
3447
3456
|
// re-pointed: handed back as they are, the reused answer would share them
|
|
3448
3457
|
// with the bodies where a solve's never does.
|
|
3449
3458
|
const callees = new Map([...callables].map(([value, callee]) => [value, repointed({ ...callee }, pairs, seen, fresh)]));
|
|
3459
|
+
// An answer holding an object a pass wrote into the program after the solve
|
|
3460
|
+
// is re-pointed once more, copying each such object: a solve of the new
|
|
3461
|
+
// program would allocate its own, equal to the copy and shared with
|
|
3462
|
+
// nothing. Only a plain object, array, map or set can be copied.
|
|
3450
3463
|
if (fresh.reached)
|
|
3451
|
-
return null;
|
|
3464
|
+
return copy ? null : flowOverCopy(flow, pairs, true);
|
|
3452
3465
|
const answer = { ...moved, callables: callees };
|
|
3453
3466
|
if (absentRoutesOf === undefined)
|
|
3454
3467
|
return answer;
|
|
@@ -3609,7 +3622,12 @@ const releasePropagation = (cells) => {
|
|
|
3609
3622
|
}
|
|
3610
3623
|
}
|
|
3611
3624
|
};
|
|
3612
|
-
|
|
3625
|
+
// `id.substring(...) === owner` rather than `id.startsWith(owner, 4)`: the same
|
|
3626
|
+
// question, several times faster for a long owner (see `ValueTable.slotsOf`).
|
|
3627
|
+
const valueOwnedBy = (id, owner) => id.startsWith('ssa|') &&
|
|
3628
|
+
id.substring(4, 4 + owner.length) === owner &&
|
|
3629
|
+
id.charCodeAt(4 + owner.length) === 124 &&
|
|
3630
|
+
id.indexOf('|', 5 + owner.length) === -1;
|
|
3613
3631
|
/**
|
|
3614
3632
|
* Every SSA value's carrier, read through the bodies rather than copied into
|
|
3615
3633
|
* one table: a table of the program's every value, built at the solve's end,
|
|
@@ -3692,6 +3710,8 @@ let rememberedClasses = null;
|
|
|
3692
3710
|
* other kind. A newer answer of the same kind replaces the older one, which
|
|
3693
3711
|
* was solved over an earlier body generation and is only ever a worse match.
|
|
3694
3712
|
*/
|
|
3713
|
+
/** The heap limit from which a solve keeps the other kind's remembered answer (`nativeCallableFlowOf`). */
|
|
3714
|
+
const KEEP_OTHER_KIND_HEAP = 3 * 1024 * 1024 * 1024;
|
|
3695
3715
|
const flowKindOf = (programConversions, constructionTopology) => (programConversions == null ? 0 : 1) + (constructionTopology == null ? 0 : 2);
|
|
3696
3716
|
export const nativeCallableFlowOf = (...args) => {
|
|
3697
3717
|
const [bodies, placements, classes, conversions, trace, deriver, programConversions, constructionTopology] = args;
|
|
@@ -3765,7 +3785,22 @@ export const nativeCallableFlowOf = (...args) => {
|
|
|
3765
3785
|
// solve -- the compile's peak -- held beside its own state. An answer of the
|
|
3766
3786
|
// other kind is still reused when no solve comes between, which is most
|
|
3767
3787
|
// reuses; on a large program two more are solved.
|
|
3768
|
-
|
|
3788
|
+
//
|
|
3789
|
+
// Unless the heap is large enough to hold it: then only this kind's answer
|
|
3790
|
+
// goes, and the other kind's is kept for when the program comes back to it.
|
|
3791
|
+
// A large three.js program under a 4 GB heap asks again, after a solve of
|
|
3792
|
+
// the other kind, for the same data it last asked for of its own kind, and
|
|
3793
|
+
// each was a solve of several seconds. The choice follows the heap the
|
|
3794
|
+
// process was given, never what it holds at the moment: a reuse is the same
|
|
3795
|
+
// data either way, so it changes no answer.
|
|
3796
|
+
if (getHeapStatistics().heap_size_limit < KEEP_OTHER_KIND_HEAP)
|
|
3797
|
+
entries.length = 0;
|
|
3798
|
+
else {
|
|
3799
|
+
const kind = flowKindOf(programConversions, constructionTopology);
|
|
3800
|
+
for (let index = entries.length - 1; index >= 0; index--)
|
|
3801
|
+
if (flowKindOf(entries[index].programConversions, entries[index].constructionTopology) === kind)
|
|
3802
|
+
entries.splice(index, 1);
|
|
3803
|
+
}
|
|
3769
3804
|
const flow = computeNativeCallableFlow(...args);
|
|
3770
3805
|
return remember(flow, -1);
|
|
3771
3806
|
};
|
package/dist/ir/certify.js
CHANGED
|
@@ -1235,7 +1235,7 @@ const nativeFieldViewDemandsOf = (operation, ctx) => {
|
|
|
1235
1235
|
const semantic = ctx.semanticOperationOf(operation.lineage);
|
|
1236
1236
|
if (required &&
|
|
1237
1237
|
receipt === undefined &&
|
|
1238
|
-
nativeFieldViewOpenDocumentRead(operation, key, ctx.nativeFieldViewTargets ?? new Set(), ctx.nativeFieldViewDocumentTargets ?? new Set()))
|
|
1238
|
+
nativeFieldViewOpenDocumentRead(operation, key, ctx.nativeFieldViewTargets ?? new Set(), ctx.nativeFieldViewDocumentTargets ?? new Set(), ctx.nativeFieldViews))
|
|
1239
1239
|
return [];
|
|
1240
1240
|
const keyDomain = key === null && semantic?.family === 'property' ? computedPropertyKeyTextsOf(ctx.graph, semantic) : undefined;
|
|
1241
1241
|
const copiedDomain = operation.provenKeyTexts;
|
|
@@ -5,7 +5,7 @@ import type { ClassLayout } from '../projection/classes.js';
|
|
|
5
5
|
import type { RepresentationDeriver } from '../representation/derive.js';
|
|
6
6
|
import { type Representation } from '../representation/model.js';
|
|
7
7
|
import { type HostSpellings } from '../targets/cpp/host/host-members.js';
|
|
8
|
-
import type
|
|
8
|
+
import { type CallOperation, type IrBody, type IrOperand, type IrOperation } from './model.js';
|
|
9
9
|
import type { HostMethodAlias } from './host-method-aliases.js';
|
|
10
10
|
import type { OperationConversionInput } from './operation-conversions.js';
|
|
11
11
|
/** A host row is authenticated by the producer of the callee, never its C++ spelling. */
|
|
@@ -19,7 +19,7 @@ export declare const hostTemplateMemberOf: (operation: CallOperation, definition
|
|
|
19
19
|
*/
|
|
20
20
|
export declare const nativeArrayDescriptorSnapshotRequired: (operation: CallOperation, definitionOf: (value: IrValueId) => IrOperation | null, liveValues: ReadonlySet<IrValueId> | undefined, aliases?: ReadonlyMap<DeclarationId, HostMethodAlias>) => boolean;
|
|
21
21
|
/** Internal template stores and callback arguments, independent of the ambient callable ABI. */
|
|
22
|
-
export declare const hostTemplateConversionInputsOf: (operation: CallOperation, definitionOf: (value: IrValueId) => IrOperation | null, deriver: RepresentationDeriver, classes: ReadonlyMap<DeclarationId, ClassLayout>, hosts?: Pick<HostSpellings, "members">, aliases?: ReadonlyMap<DeclarationId, HostMethodAlias
|
|
22
|
+
export declare const hostTemplateConversionInputsOf: (operation: CallOperation, definitionOf: (value: IrValueId) => IrOperation | null, deriver: RepresentationDeriver, classes: ReadonlyMap<DeclarationId, ClassLayout>, hosts?: Pick<HostSpellings, "members">, aliases?: ReadonlyMap<DeclarationId, HostMethodAlias>, body?: IrBody) => readonly OperationConversionInput[];
|
|
23
23
|
export interface HostObjectWalkPlan {
|
|
24
24
|
readonly member: string;
|
|
25
25
|
/** Only complete admitted callbacks are present. Omitted routes retain their static copy. */
|
|
@@ -4,9 +4,12 @@ import { abiOfCallee } from '../projection/callee.js';
|
|
|
4
4
|
import { declaredRecordFieldOf, nativeBaseFieldOf, recordFieldsOfShape } from '../projection/fields.js';
|
|
5
5
|
import { canonicalIndexLiteral } from '../representation/array-index.js';
|
|
6
6
|
import { isNativeCallableCarrier } from '../representation/callable-object.js';
|
|
7
|
+
import { storedCarrier } from '../representation/primitives.js';
|
|
7
8
|
import { hostReceiverProtocolOf } from '../representation/host-templates.js';
|
|
8
|
-
import { representationKey } from '../representation/model.js';
|
|
9
|
+
import { isCanonicalNumberPropertyKeyText, representationKey } from '../representation/model.js';
|
|
9
10
|
import { hostMemberOf } from '../targets/cpp/host/host-members.js';
|
|
11
|
+
import { allOperationsOf } from './model.js';
|
|
12
|
+
import { operandsOfIrOperation } from './queries.js';
|
|
10
13
|
import { indexedRecordViewOf } from './certify/carrier-keys.js';
|
|
11
14
|
import { nativePrototypeCallClaimsOf } from './native-prototype-calls.js';
|
|
12
15
|
const dynamic = { kind: 'dynamic', reason: 'declared-any-never-narrowed' };
|
|
@@ -62,8 +65,62 @@ const descriptorValueOf = (deriver, result) => {
|
|
|
62
65
|
const payload = result?.kind === 'optional' ? result.payload : result;
|
|
63
66
|
return payload === undefined ? null : (knownFieldsOf(deriver, payload)?.find((field) => field.key === 'value')?.value ?? null);
|
|
64
67
|
};
|
|
68
|
+
/**
|
|
69
|
+
* The `kValue` each `gea::runtime::array::from*` helper hands `Array.from`'s
|
|
70
|
+
* mapper (ECMA-262 23.1.2.1), or `null` where the mapper is passed unadapted.
|
|
71
|
+
*
|
|
72
|
+
* `fromLength` reads no element: it hands `Undefined{}` for every k, which is
|
|
73
|
+
* step 7.e.i's `Get(arrayLike, Pk)` only while the array-like holds none. The
|
|
74
|
+
* carrier cannot say so -- `ArrayLike<T>`'s index signature gives even
|
|
75
|
+
* `{ length: 8 }` an index table -- so the literal proves it. Each member
|
|
76
|
+
* definition answers the object it installed into, so the chain from the call
|
|
77
|
+
* back to the allocation is that one object; when every key on it is a
|
|
78
|
+
* non-numeric string and nothing but the next link and this call uses any of
|
|
79
|
+
* it, nothing can have stored an element before the call reads it.
|
|
80
|
+
*/
|
|
81
|
+
const arrayFromElementOf = (call, definitionOf, body) => {
|
|
82
|
+
const source = call.arguments[0];
|
|
83
|
+
if (source === undefined)
|
|
84
|
+
return null;
|
|
85
|
+
const carrier = source.representation;
|
|
86
|
+
if (carrier.kind === 'array-object' || carrier.kind === 'iterator')
|
|
87
|
+
return carrier.element;
|
|
88
|
+
if (carrier.kind === 'typed-array')
|
|
89
|
+
return number;
|
|
90
|
+
if (carrier.kind === 'string')
|
|
91
|
+
return string;
|
|
92
|
+
if (carrier.kind === 'keyed-collection' && carrier.family === 'set')
|
|
93
|
+
return carrier.key;
|
|
94
|
+
if (body === undefined || (carrier.kind !== 'record' && carrier.kind !== 'record-with-index' && carrier.kind !== 'native-record-ref'))
|
|
95
|
+
return null;
|
|
96
|
+
const chain = new Set();
|
|
97
|
+
let value = source.value;
|
|
98
|
+
let definition = definitionOf(value);
|
|
99
|
+
while (definition?.kind === 'define-own-property') {
|
|
100
|
+
const key = definitionOf(definition.key.value);
|
|
101
|
+
if (key?.kind !== 'constant' || key.literal !== 'string' || isCanonicalNumberPropertyKeyText(key.text))
|
|
102
|
+
return null;
|
|
103
|
+
chain.add(value);
|
|
104
|
+
value = definition.receiver.value;
|
|
105
|
+
definition = definitionOf(value);
|
|
106
|
+
}
|
|
107
|
+
if (definition?.kind !== 'allocate-record' || definition.fields.some((field) => isCanonicalNumberPropertyKeyText(field.key)))
|
|
108
|
+
return null;
|
|
109
|
+
chain.add(value);
|
|
110
|
+
for (const block of body.blocks.values())
|
|
111
|
+
for (const operation of allOperationsOf(block)) {
|
|
112
|
+
const uses = operandsOfIrOperation(operation).filter((operand) => chain.has(operand.value));
|
|
113
|
+
if (uses.length === 0)
|
|
114
|
+
continue;
|
|
115
|
+
const isThisCall = operation.kind === 'call' && operation.lineage === call.lineage && operation.callee.value === call.callee.value;
|
|
116
|
+
const isLink = operation.kind === 'define-own-property' && operation.result !== null && chain.has(operation.result.id);
|
|
117
|
+
if (uses.length > 1 || !(isThisCall || isLink))
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
120
|
+
return undefinedValue;
|
|
121
|
+
};
|
|
65
122
|
/** Internal template stores and callback arguments, independent of the ambient callable ABI. */
|
|
66
|
-
export const hostTemplateConversionInputsOf = (operation, definitionOf, deriver, classes, hosts, aliases) => {
|
|
123
|
+
export const hostTemplateConversionInputsOf = (operation, definitionOf, deriver, classes, hosts, aliases, body) => {
|
|
67
124
|
if (operation.nativeArrayDescriptorSnapshot || operation.nativeArrayDescriptorReinstallation)
|
|
68
125
|
return [];
|
|
69
126
|
const inputs = new Map();
|
|
@@ -87,6 +144,14 @@ export const hostTemplateConversionInputsOf = (operation, definitionOf, deriver,
|
|
|
87
144
|
const callback = operation.arguments[0]?.representation;
|
|
88
145
|
if (callback?.kind === 'function-value-dispatch' && callback.abi.receiver === null && callback.abi.parameters[0])
|
|
89
146
|
add('prototype-callback', element, callback.abi.parameters[0].value);
|
|
147
|
+
// `map` mints its result, so each callback result enters the call's
|
|
148
|
+
// element as it is stored. A closure narrowed past the checker's `U`
|
|
149
|
+
// returns a carrier the published element does not hold.
|
|
150
|
+
if (member === 'map' &&
|
|
151
|
+
result?.kind === 'array-object' &&
|
|
152
|
+
callback?.kind === 'function-value-dispatch' &&
|
|
153
|
+
callback.abi.receiver === null)
|
|
154
|
+
add('prototype-result', storedCarrier(callback.abi.result), result.element);
|
|
90
155
|
}
|
|
91
156
|
// SortCompare hands the comparator two elements; the emitter converts
|
|
92
157
|
// each into its parameter's carrier (`sortText`), so both pairs are
|
|
@@ -153,6 +218,12 @@ export const hostTemplateConversionInputsOf = (operation, definitionOf, deriver,
|
|
|
153
218
|
}
|
|
154
219
|
}
|
|
155
220
|
const host = hostTemplateMemberOf(operation, definitionOf, aliases);
|
|
221
|
+
if (host?.protocol === 'ArrayConstructor' && host.member === 'from') {
|
|
222
|
+
const callback = operation.arguments[1]?.representation;
|
|
223
|
+
const element = callback ? arrayFromElementOf(operation, definitionOf, body) : null;
|
|
224
|
+
if (element && callback?.kind === 'function-value-dispatch' && callback.abi.receiver === null && callback.abi.parameters[0])
|
|
225
|
+
add('prototype-callback', element, callback.abi.parameters[0].value);
|
|
226
|
+
}
|
|
156
227
|
if (host && hosts) {
|
|
157
228
|
const row = hostMemberOf(hosts.members, host.protocol, host.member);
|
|
158
229
|
if (row?.kind === 'method' && row.arity === 'pass-through') {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { operationOfResult } from '../identity/ids.js';
|
|
2
|
-
import { carriesUndefined, representationKey } from '../representation/model.js';
|
|
2
|
+
import { carriesUndefined, isArrayPatternCapable, representationKey } from '../representation/model.js';
|
|
3
3
|
import { edgesOfKind } from '../semantics/model/edges.js';
|
|
4
4
|
import { operandOf } from '../semantics/model/operands.js';
|
|
5
5
|
import { IrLoweringBlockedError } from './lower-graph.js';
|
|
@@ -216,8 +216,27 @@ const lowerArrayPatternSource = (ctx, block, operation) => {
|
|
|
216
216
|
throw new IrLoweringBlockedError(`an array binding pattern's source resolved to a tagged union none of whose arms carry the declared ` +
|
|
217
217
|
`"${representationKey(declared)}" iterator-record shape`);
|
|
218
218
|
}
|
|
219
|
-
|
|
220
|
-
|
|
219
|
+
// The guard below is ECMA-262 7.4.2's TypeError for an arm GetIterator
|
|
220
|
+
// rejects (`number` beside `number[]`). An arm the pattern can read
|
|
221
|
+
// positionally is no such value: `cond ? split(...) : [ids, []]` holds a
|
|
222
|
+
// tuple record beside the declared array, and refusing it at run time
|
|
223
|
+
// aborted on a valid program. Every arm then enters the declared carrier
|
|
224
|
+
// through its own conversion, dispatched on the live tag.
|
|
225
|
+
const arms = source.representation.arms;
|
|
226
|
+
if (arms.some((arm, index) => index !== armIndex && isArrayPatternCapable(arm.value))) {
|
|
227
|
+
const unconverted = arms.find((arm) => ctx.program.conversions.nodeFor(arm.value, declared).capability.kind === 'never');
|
|
228
|
+
if (unconverted !== undefined) {
|
|
229
|
+
throw new IrLoweringBlockedError(`an array binding pattern reads "${representationKey(declared)}" from a tagged union whose arm ` +
|
|
230
|
+
`"${representationKey(unconverted.value)}" has no conversion into it`);
|
|
231
|
+
}
|
|
232
|
+
const live = arms.map((_, index) => index);
|
|
233
|
+
const value = ctx.builder.mergeLiveArmRebuild(block, lineage, source, declared, live, false, ctx.program.conversions);
|
|
234
|
+
source = { value, representation: declared };
|
|
235
|
+
}
|
|
236
|
+
else {
|
|
237
|
+
const value = ctx.builder.compute(block, lineage, 'require-tagged-union-arm', String(armIndex), [source], declared);
|
|
238
|
+
source = { value, representation: declared };
|
|
239
|
+
}
|
|
221
240
|
}
|
|
222
241
|
if (isSnapshotSource(source.representation.kind) && declared.kind === 'array-object') {
|
|
223
242
|
registerResult(ctx, operation, ctx.builder.allocateArrayObject(block, lineage, [{ kind: 'spread', value: source, from: 0 }], declared));
|
|
@@ -304,6 +304,7 @@ export const enter = (ctx, block, lineage, operation, operand, resolved) => {
|
|
|
304
304
|
unproven ??
|
|
305
305
|
assertedUnionEntry(ctx, block, lineage, operation, operand, resolved, answer.representation) ??
|
|
306
306
|
unsharedFreshTableEntry(ctx, block, lineage, operand, resolved, answer.representation) ??
|
|
307
|
+
unprovenClassEntry(ctx, block, lineage, operand, resolved, answer.representation) ??
|
|
307
308
|
convertTo(ctx, block, lineage, resolved, answer.representation) ??
|
|
308
309
|
familyMemberEntry(ctx, block, lineage, operation, operand, resolved, answer.representation) ??
|
|
309
310
|
assertedArmEntry(ctx, block, lineage, operand, resolved, answer.representation) ??
|
|
@@ -657,6 +658,29 @@ export const assertedClassReceiver = (ctx, block, lineage, operand, resolved, vi
|
|
|
657
658
|
return null;
|
|
658
659
|
return { value: ctx.builder.convert(block, lineage, node.id, held, target), representation: target };
|
|
659
660
|
};
|
|
661
|
+
/**
|
|
662
|
+
* A base class handle entering a slot typed at one of its descendants while
|
|
663
|
+
* the operand's own type is still a class the slot does not accept: no
|
|
664
|
+
* `instanceof` narrowed it. The checker never matches a call made through an
|
|
665
|
+
* `any` callee against the body value flow finds for it -- three's
|
|
666
|
+
* `background.render( scene )` hands an `Object3D` to a `@param {Scene}` --
|
|
667
|
+
* and the ordinary downcast (`downcastClassRef`) trusts a guard that never
|
|
668
|
+
* ran, so the body then read a Mesh's bytes as a Scene. An assertion renders
|
|
669
|
+
* no guard either, and its operand carries the type of what it wraps. The
|
|
670
|
+
* checked downcast the census already has for `as Derived` receivers is the
|
|
671
|
+
* value when it is that class and a TypeError otherwise.
|
|
672
|
+
*/
|
|
673
|
+
const unprovenClassEntry = (ctx, block, lineage, operand, resolved, slot) => {
|
|
674
|
+
if (resolved.representation.kind !== 'class-ref' || slot.kind !== 'class-ref')
|
|
675
|
+
return null;
|
|
676
|
+
const stated = ctx.constantDeriver.derive(operand.type);
|
|
677
|
+
if (stated.kind === 'class-ref' && (stated.declaration === slot.declaration || stated.ancestors.includes(slot.declaration)))
|
|
678
|
+
return null;
|
|
679
|
+
const node = ctx.program.conversions.assertedClassDowncastFor(resolved.representation, slot);
|
|
680
|
+
if (node === null)
|
|
681
|
+
return null;
|
|
682
|
+
return { value: ctx.builder.convert(block, lineage, node.id, resolved, slot), representation: slot };
|
|
683
|
+
};
|
|
660
684
|
/** Whether a carrier has a `null` state of its own (a class reference's empty `Ref` is read separately). */
|
|
661
685
|
const holdsNull = (representation) => {
|
|
662
686
|
if (representation.kind === 'null' || representation.kind === 'dynamic')
|
|
@@ -1151,7 +1175,12 @@ export const packRestArguments = (ctx, block, lineage, operation, abi, passed) =
|
|
|
1151
1175
|
throw new IrLoweringBlockedError(`a tuple-shaped rest slot's required field ${index} has no matching trailing argument`);
|
|
1152
1176
|
return [];
|
|
1153
1177
|
}
|
|
1154
|
-
|
|
1178
|
+
// Converted here, as a packed array's element is below: a position
|
|
1179
|
+
// several call forms fill (a number in one, an image source in another)
|
|
1180
|
+
// carries their join, and the record's store is not where a conversion
|
|
1181
|
+
// into it can be certified.
|
|
1182
|
+
const actual = packingValueOf(entry);
|
|
1183
|
+
return [{ key: field.key, value: convertTo(ctx, block, lineage, actual, field.value) ?? actual }];
|
|
1155
1184
|
});
|
|
1156
1185
|
const packed = ctx.builder.allocateRecord(block, lineage, fields, slot.value);
|
|
1157
1186
|
return [...args.slice(0, abi.restFrom).map((entry) => entry.value), { value: packed, representation: slot.value }];
|
|
@@ -90,8 +90,15 @@ export declare const nativeFieldViewDocumentTargetSetOf: (plans: readonly Native
|
|
|
90
90
|
* receipt can exist for it, and none is needed: the ordinary native [[Get]]
|
|
91
91
|
* reads the view's original Document entry, and a plain allocation its own
|
|
92
92
|
* slots and sidecar.
|
|
93
|
+
*
|
|
94
|
+
* A fixed key that no layout, accessor or installed view of the receiver
|
|
95
|
+
* names (`parameters.morphAttributeCount` off a record that never declares
|
|
96
|
+
* it) is the same read once no receipt exists for it. Its only receipt route
|
|
97
|
+
* claims `undefined` and needs an unescaped allocation
|
|
98
|
+
* (`originalDescriptorAbsent`); a published record can gain the key in its
|
|
99
|
+
* sidecar, and the ordinary [[Get]] answers that too.
|
|
93
100
|
*/
|
|
94
|
-
export declare const nativeFieldViewOpenDocumentRead: (operation: GetOperation | SetOperation, constantKey: string | null | undefined, targets: ReadonlySet<string>, documents: ReadonlySet<string>) => boolean;
|
|
101
|
+
export declare const nativeFieldViewOpenDocumentRead: (operation: GetOperation | SetOperation, constantKey: string | null | undefined, targets: ReadonlySet<string>, documents: ReadonlySet<string>, flow?: Pick<FieldFlow, "nativeFieldViewAbsentRoutesOf">) => boolean;
|
|
95
102
|
/**
|
|
96
103
|
* A receiver the host census resolved to a namespace PATH is no allocation:
|
|
97
104
|
* `navigator.bluetooth.keyboard` has no object behind it, only spellings for
|
|
@@ -85,12 +85,22 @@ const carrierTargetsAreDocuments = (value, targets, documents) => {
|
|
|
85
85
|
* receipt can exist for it, and none is needed: the ordinary native [[Get]]
|
|
86
86
|
* reads the view's original Document entry, and a plain allocation its own
|
|
87
87
|
* slots and sidecar.
|
|
88
|
+
*
|
|
89
|
+
* A fixed key that no layout, accessor or installed view of the receiver
|
|
90
|
+
* names (`parameters.morphAttributeCount` off a record that never declares
|
|
91
|
+
* it) is the same read once no receipt exists for it. Its only receipt route
|
|
92
|
+
* claims `undefined` and needs an unescaped allocation
|
|
93
|
+
* (`originalDescriptorAbsent`); a published record can gain the key in its
|
|
94
|
+
* sidecar, and the ordinary [[Get]] answers that too.
|
|
88
95
|
*/
|
|
89
|
-
export const nativeFieldViewOpenDocumentRead = (operation, constantKey, targets, documents) => operation.kind === 'get' &&
|
|
90
|
-
(constantKey === null || constantKey === undefined) &&
|
|
96
|
+
export const nativeFieldViewOpenDocumentRead = (operation, constantKey, targets, documents, flow) => operation.kind === 'get' &&
|
|
91
97
|
operation.provenKeyTexts === undefined &&
|
|
92
98
|
documents.size > 0 &&
|
|
93
|
-
carrierTargetsAreDocuments(operation.receiver.representation, targets, documents)
|
|
99
|
+
carrierTargetsAreDocuments(operation.receiver.representation, targets, documents) &&
|
|
100
|
+
(constantKey === null || constantKey === undefined || keyNamedByNoDescriptor(operation.receiver.value, constantKey, flow));
|
|
101
|
+
const keyNamedByNoDescriptor = (receiver, key, flow) => flow
|
|
102
|
+
?.nativeFieldViewAbsentRoutesOf?.(receiver, key)
|
|
103
|
+
?.every((route) => route.originalAbsent === true || route.declaredAnyEntry === true) ?? false;
|
|
94
104
|
/**
|
|
95
105
|
* A receiver the host census resolved to a namespace PATH is no allocation:
|
|
96
106
|
* `navigator.bluetooth.keyboard` has no object behind it, only spellings for
|
|
@@ -262,7 +262,7 @@ export const operationConversionInputsOf = (operation, keyText, deriver, classes
|
|
|
262
262
|
for (const conversion of nativePrototypeConversionInputsOf(operation, prototypeClaims))
|
|
263
263
|
add(conversion.role, conversion.source, conversion.target);
|
|
264
264
|
if (definitionOf)
|
|
265
|
-
for (const conversion of hostTemplateConversionInputsOf(operation, definitionOf, deriver, classes, hosts, hostMethodAliases))
|
|
265
|
+
for (const conversion of hostTemplateConversionInputsOf(operation, definitionOf, deriver, classes, hosts, hostMethodAliases, body))
|
|
266
266
|
add(conversion.role, conversion.source, conversion.target);
|
|
267
267
|
if (definitionOf)
|
|
268
268
|
for (const conversion of promiseReactionConversionInputsOf(operation, definitionOf, classes))
|
|
@@ -7,7 +7,7 @@ import type { RepresentationDeriver } from '../representation/derive.js';
|
|
|
7
7
|
import { type Representation } from '../representation/model.js';
|
|
8
8
|
import type { IrBody } from './model.js';
|
|
9
9
|
import type { ReflectionExposure } from './reflection-demand.js';
|
|
10
|
-
export type ProgramConversionRole = 'async-entry' | 'construct-argument' | 'field-initializer' | 'dynamic-field-write' | 'prototype-method' | 'prototype-setter-argument' | 'prototype-setter-receiver' | 'prototype-getter-receiver' | 'prototype-getter-result' | 'virtual-receiver' | 'virtual-parameter' | 'virtual-result' | 'virtual-field';
|
|
10
|
+
export type ProgramConversionRole = 'async-entry' | 'construct-argument' | 'field-initializer' | 'dynamic-field-write' | 'dynamic-call-argument' | 'prototype-method' | 'prototype-setter-argument' | 'prototype-setter-receiver' | 'prototype-getter-receiver' | 'prototype-getter-result' | 'virtual-receiver' | 'virtual-parameter' | 'virtual-result' | 'virtual-field';
|
|
11
11
|
/** One selected native artifact boundary, independent of operation-local conversions. */
|
|
12
12
|
export interface ProgramConversionInput {
|
|
13
13
|
readonly role: ProgramConversionRole;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { abiOfCallee } from '../projection/callee.js';
|
|
1
2
|
import { runtimeClassLayoutsOf } from '../projection/classes.js';
|
|
2
3
|
import { virtualDispatchVerdictOf } from '../projection/dispatch.js';
|
|
3
4
|
import { declaredRecordFieldOf, recordShapeLayoutsOf } from '../projection/fields.js';
|
|
4
5
|
import { classMethodOverrideOf } from '../projection/fields.js';
|
|
5
6
|
import { representationKey, walkRepresentation } from '../representation/model.js';
|
|
6
7
|
import { dynamicRecordLoadNeedsPlan } from '../conversion/document-record-view.js';
|
|
8
|
+
import { recipeClosureOf } from '../conversion/recipe-closure.js';
|
|
7
9
|
import { capturesNothing } from './captures.js';
|
|
8
10
|
import { asyncPromiseViewOf } from './coroutine-bodies.js';
|
|
9
11
|
import { allOperationsOf } from './model.js';
|
|
@@ -48,6 +50,41 @@ export const prototypePropertyDeclarationsOf = (classes, reflection) => {
|
|
|
48
50
|
return held;
|
|
49
51
|
};
|
|
50
52
|
export const prototypeSetterValue = { kind: 'dynamic', reason: 'declared-any-never-narrowed' };
|
|
53
|
+
/**
|
|
54
|
+
* Whether the census carries out `any -> value`, every cited recipe included.
|
|
55
|
+
* A plan without one would refuse the whole program at certification; with no
|
|
56
|
+
* plan the one operation that reaches the slot keeps its named refusal.
|
|
57
|
+
*/
|
|
58
|
+
const dynamicLoadInstalled = (value, conversions) => {
|
|
59
|
+
try {
|
|
60
|
+
const closure = recipeClosureOf([conversions.nodeFor(prototypeSetterValue, value)], conversions.nodeById);
|
|
61
|
+
return [...closure.values()].every((node) => node.capability.kind !== 'never');
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
// Conflicting citations are certification's `missing` verdict: no plan.
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* A Function field written through a dynamic receiver (`mat.onBeforeCompile =
|
|
70
|
+
* fn` on an `any` material) stores the box adapted to the field's own frame.
|
|
71
|
+
* Only the census knows which frames the runtime can adapt and whether the
|
|
72
|
+
* slot admits an unknown Function at all, so the write cites its installed
|
|
73
|
+
* reader; a field with none keeps the dispatcher's named refusal.
|
|
74
|
+
*/
|
|
75
|
+
const dynamicCallableLoadInstalled = (value, conversions) => abiOfCallee(value) !== null && dynamicLoadInstalled(value, conversions);
|
|
76
|
+
/**
|
|
77
|
+
* The shared records a boxed callable's frame reads its arguments into: a
|
|
78
|
+
* record parameter, the present arm of an optional one, and an Array's
|
|
79
|
+
* element (each element crosses the same per-carrier rule).
|
|
80
|
+
*/
|
|
81
|
+
const argumentRecordsOf = (value) => value.kind === 'optional'
|
|
82
|
+
? argumentRecordsOf(value.payload)
|
|
83
|
+
: value.kind === 'array-object'
|
|
84
|
+
? argumentRecordsOf(value.element)
|
|
85
|
+
: value.kind === 'record' || value.kind === 'record-with-index' || value.kind === 'native-record-ref'
|
|
86
|
+
? [value]
|
|
87
|
+
: [];
|
|
51
88
|
export const programConversionKey = (input) => JSON.stringify([input.role, input.owner, input.slot]);
|
|
52
89
|
export const virtualConversionOwnerOf = (family, declaration) => JSON.stringify([family.root, family.key, family.role, family.copy ?? null, declaration]);
|
|
53
90
|
/** Every conversion the final native construction, coroutine and virtual artifacts actually spell. */
|
|
@@ -58,10 +95,19 @@ export const programConversionInputsOf = (input) => {
|
|
|
58
95
|
const inputs = new Map();
|
|
59
96
|
const propertyDeclarations = prototypePropertyDeclarationsOf(input.classes, input.reflection);
|
|
60
97
|
const prototypeDeclarations = new Set();
|
|
98
|
+
// Every frame a dynamic caller can invoke with its own arguments: a
|
|
99
|
+
// Function boxed into `any`, a prototype method a boxed instance answers
|
|
100
|
+
// with, and a callable own field a full-reflection receiver answers with.
|
|
101
|
+
const boxedFrames = [];
|
|
61
102
|
for (const body of bodies) {
|
|
62
103
|
const operations = [...body.blocks.values()].flatMap((block) => allOperationsOf(block));
|
|
63
104
|
const definitions = new Map(operations.flatMap((operation) => (operation.kind === 'constant' ? [[operation.result.id, operation]] : [])));
|
|
64
105
|
for (const operation of operations) {
|
|
106
|
+
if (operation.kind === 'convert' && operation.result.representation.kind === 'dynamic') {
|
|
107
|
+
const abi = abiOfCallee(operation.source.representation);
|
|
108
|
+
if (abi !== null)
|
|
109
|
+
boxedFrames.push(abi);
|
|
110
|
+
}
|
|
65
111
|
if (operation.kind !== 'get' || constantPropertyKeyTextOf(definitions.get(operation.key.value)) !== 'prototype')
|
|
66
112
|
continue;
|
|
67
113
|
const receivers = operation.receiver.representation.kind === 'tagged-union'
|
|
@@ -110,12 +156,33 @@ export const programConversionInputsOf = (input) => {
|
|
|
110
156
|
if (isPrivateNameKey(field.key))
|
|
111
157
|
continue;
|
|
112
158
|
const operations = demand.fieldOperations?.get(field.key);
|
|
159
|
+
const callable = abiOfCallee(field.value);
|
|
160
|
+
if (callable !== null && (demand.fieldOperations === undefined || operations?.has('read')))
|
|
161
|
+
boxedFrames.push(callable);
|
|
113
162
|
if (demand.fieldOperations !== undefined && !operations?.has('write') && !operations?.has('define'))
|
|
114
163
|
continue;
|
|
115
|
-
if (dynamicRecordLoadNeedsPlan(field.value, layouts) ||
|
|
164
|
+
if (dynamicRecordLoadNeedsPlan(field.value, layouts) ||
|
|
165
|
+
dynamicTableLoadNeedsPlan(field.value, layouts) ||
|
|
166
|
+
dynamicCallableLoadInstalled(field.value, input.conversions))
|
|
116
167
|
add('dynamic-field-write', owner, field.key, prototypeSetterValue, field.value);
|
|
117
168
|
}
|
|
118
169
|
}
|
|
170
|
+
for (const layout of runtimeClassLayoutsOf(input.classes))
|
|
171
|
+
if (propertyDeclarations === null || propertyDeclarations.has(layout.declaration))
|
|
172
|
+
for (const method of layout.methods) {
|
|
173
|
+
const abi = method.callable === null ? null : abiOf(method.callable);
|
|
174
|
+
if (abi !== null)
|
|
175
|
+
boxedFrames.push(abi);
|
|
176
|
+
}
|
|
177
|
+
for (const abi of boxedFrames)
|
|
178
|
+
for (const parameter of abi.parameters)
|
|
179
|
+
for (const record of argumentRecordsOf(parameter.value)) {
|
|
180
|
+
const owner = dynamicFieldConversionOwnerOf(record);
|
|
181
|
+
if (owner === null || inputs.has(programConversionKey({ role: 'dynamic-call-argument', owner, slot: '' })))
|
|
182
|
+
continue;
|
|
183
|
+
if (dynamicRecordLoadNeedsPlan(record, layouts) && dynamicLoadInstalled(record, input.conversions))
|
|
184
|
+
add('dynamic-call-argument', owner, '', prototypeSetterValue, record);
|
|
185
|
+
}
|
|
119
186
|
for (const body of bodies) {
|
|
120
187
|
const view = asyncPromiseViewOf(body);
|
|
121
188
|
if (view?.abi && body.abi)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { classMemberOf, declaredRecordFieldOf, propertyReadResultRepresentationOf, recordAccessorsOfShape, recordFieldsOfShape } from '../projection/fields.js';
|
|
2
|
-
import { virtualDispatchKey } from '../projection/dispatch.js';
|
|
2
|
+
import { classFieldAccessorArmsOf, virtualDispatchKey } from '../projection/dispatch.js';
|
|
3
3
|
import { nativeExpandoSidecarOf } from '../projection/native-expando.js';
|
|
4
4
|
import { regexpFieldStorageOf } from '../projection/regexp-fields.js';
|
|
5
5
|
import { representationKey } from '../representation/model.js';
|
|
@@ -72,6 +72,12 @@ export const propertyReadConversionInputsOf = (operation, keyText, deriver, clas
|
|
|
72
72
|
const physical = virtual?.result ?? propertyReadResultRepresentationOf(deriver, classes, abis, leaf, keyText);
|
|
73
73
|
if (physical !== null)
|
|
74
74
|
add(physical);
|
|
75
|
+
if (leaf.kind === 'class-ref' && !unionReceiver && operation.spreadSnapshot !== true)
|
|
76
|
+
for (const { accessor } of classFieldAccessorArmsOf(classes, leaf.declaration, keyText)) {
|
|
77
|
+
const result = accessor.getter === null ? undefined : abis.get(accessor.getter)?.result;
|
|
78
|
+
if (result !== undefined)
|
|
79
|
+
add(result);
|
|
80
|
+
}
|
|
75
81
|
const member = leaf.kind === 'class-ref' ? classMemberOf(classes, leaf.declaration, keyText) : null;
|
|
76
82
|
if (unionReceiver && (member === null || member.kind === 'field')) {
|
|
77
83
|
const field = declaredRecordFieldOf(deriver, leaf, keyText, classes);
|
|
@@ -74,6 +74,10 @@ export const publishNativeFieldViewFacts = (input) => {
|
|
|
74
74
|
? nativeFieldViewReadOf(operation, key, flow, input.conversions)
|
|
75
75
|
: (nativeFieldViewReadSelectionOf(operation, operation.provenKeyTexts ?? [], flow, input.conversions) ??
|
|
76
76
|
nativeFieldViewOpenReadOf(operation, flow, input.conversions));
|
|
77
|
+
if (read === null && key !== undefined && nativeFieldViewOpenDocumentRead(operation, key, targets, documents, flow)) {
|
|
78
|
+
const { nativeFieldViewRead: previousRead, ...open } = ordinary;
|
|
79
|
+
return open;
|
|
80
|
+
}
|
|
77
81
|
return read === null
|
|
78
82
|
? ordinary
|
|
79
83
|
: {
|