@hew-lang/sandbox-vm 0.9.3 → 0.10.0
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/interpreter/run-program.js +5 -0
- package/dist/interpreter/strings.d.ts +6 -0
- package/dist/interpreter/strings.js +8 -0
- package/dist/interpreter/types.d.ts +1 -1
- package/dist/interpreter/v1/browser-directory.js +2 -2
- package/dist/interpreter/v1/codecs.js +2 -2
- package/dist/interpreter/v1/encoding-storage.d.ts +33 -0
- package/dist/interpreter/v1/encoding-storage.js +113 -0
- package/dist/interpreter/v1/encoding-values.js +28 -18
- package/dist/interpreter/v1/exec.js +1506 -130
- package/dist/interpreter/v1/instructions.generated.d.ts +100 -8
- package/dist/interpreter/v1/instructions.generated.js +1 -0
- package/dist/interpreter/v1/managed-budget.d.ts +88 -0
- package/dist/interpreter/v1/managed-budget.js +561 -0
- package/dist/interpreter/v1/package-graph.js +77 -2
- package/dist/interpreter/v1/package-validator.generated.js +22796 -17531
- package/dist/interpreter/v1/package.d.ts +4 -2
- package/dist/interpreter/v1/package.js +6 -0
- package/dist/interpreter/v1/pipes.d.ts +24 -1
- package/dist/interpreter/v1/pipes.js +91 -8
- package/dist/interpreter/v1/shims.d.ts +1 -0
- package/dist/interpreter/v1/shims.js +88 -62
- package/dist/interpreter/v1/structural.js +4 -2
- package/dist/interpreter/v1/validate.js +4 -2
- package/dist/interpreter/v1/value-operations.d.ts +3 -1
- package/dist/interpreter/v1/value-operations.js +32 -18
- package/dist/interpreter/values.d.ts +45 -11
- package/dist/interpreter/values.js +176 -8
- package/package.json +4 -4
|
@@ -90,6 +90,7 @@ export type ActorShape = {
|
|
|
90
90
|
id: number;
|
|
91
91
|
name: string;
|
|
92
92
|
state_fields: Array<ActorField>;
|
|
93
|
+
state_type?: number | null;
|
|
93
94
|
init?: number | null;
|
|
94
95
|
start?: number | null;
|
|
95
96
|
stop: Array<number>;
|
|
@@ -103,7 +104,7 @@ export type ActorShape = {
|
|
|
103
104
|
mailbox_capacity?: number | null;
|
|
104
105
|
overflow: ActorOverflow;
|
|
105
106
|
coalesce?: Coalesce | null;
|
|
106
|
-
max_heap_bytes?:
|
|
107
|
+
max_heap_bytes?: string | null;
|
|
107
108
|
};
|
|
108
109
|
export type AggregateBuiltin = "Timestamp";
|
|
109
110
|
export type AggregateShape = {
|
|
@@ -244,7 +245,7 @@ export type ExternEntry = {
|
|
|
244
245
|
*/
|
|
245
246
|
native_capability?: string | null;
|
|
246
247
|
};
|
|
247
|
-
export type FileReadOp = "Open" | "IsValid" | "Collect" | "Close" | "StreamOpen" | "StreamIsValid" | "
|
|
248
|
+
export type FileReadOp = "Open" | "IsValid" | "Collect" | "Close" | "StreamOpen" | "StreamIsValid" | "HasError" | "LastErrorKind" | "LastErrno" | "LastError";
|
|
248
249
|
export type FloatMethodOp = "ToBits" | "IsNan" | "IsFinite" | "IsInfinite" | "IsSignNegative";
|
|
249
250
|
export type FunctionV1 = {
|
|
250
251
|
actor_construction?: boolean;
|
|
@@ -268,6 +269,77 @@ export type JoinDetail = {
|
|
|
268
269
|
mode: JoinMode;
|
|
269
270
|
};
|
|
270
271
|
export type JoinMode = "wait" | "cancel_losers" | "propagate_fault";
|
|
272
|
+
export type ManagedHandle = "actor" | "pointer" | "borrow" | "cancellation";
|
|
273
|
+
export type ManagedProvider = "task" | "stream" | "sink" | "json" | "yaml" | "toml" | "opaque";
|
|
274
|
+
export type ManagedType = {
|
|
275
|
+
id: number;
|
|
276
|
+
/**
|
|
277
|
+
* Canonical width of a slot holding this value, encoded without JS rounding.
|
|
278
|
+
*/
|
|
279
|
+
slot_bytes: string;
|
|
280
|
+
} & ({
|
|
281
|
+
kind: "scalar";
|
|
282
|
+
} | {
|
|
283
|
+
kind: "handle";
|
|
284
|
+
category: ManagedHandle;
|
|
285
|
+
} | {
|
|
286
|
+
kind: "string";
|
|
287
|
+
} | {
|
|
288
|
+
kind: "bytes";
|
|
289
|
+
} | {
|
|
290
|
+
kind: "vector";
|
|
291
|
+
element: number;
|
|
292
|
+
share_on_copy: boolean;
|
|
293
|
+
} | {
|
|
294
|
+
kind: "array";
|
|
295
|
+
element: number;
|
|
296
|
+
length: string;
|
|
297
|
+
share_on_copy: boolean;
|
|
298
|
+
} | {
|
|
299
|
+
kind: "slice";
|
|
300
|
+
element: number;
|
|
301
|
+
share_on_copy: boolean;
|
|
302
|
+
} | {
|
|
303
|
+
kind: "map";
|
|
304
|
+
key: number;
|
|
305
|
+
value: number;
|
|
306
|
+
} | {
|
|
307
|
+
kind: "set";
|
|
308
|
+
element: number;
|
|
309
|
+
} | {
|
|
310
|
+
kind: "aggregate";
|
|
311
|
+
fields: Array<number>;
|
|
312
|
+
} | {
|
|
313
|
+
kind: "variant";
|
|
314
|
+
shape: number;
|
|
315
|
+
indirect: boolean;
|
|
316
|
+
payload_bytes: string;
|
|
317
|
+
cases: Array<Array<number>>;
|
|
318
|
+
} | {
|
|
319
|
+
kind: "callable";
|
|
320
|
+
captures: Array<number> | null;
|
|
321
|
+
} | {
|
|
322
|
+
kind: "generator";
|
|
323
|
+
yielded: number;
|
|
324
|
+
returned: number;
|
|
325
|
+
payload_bytes: string;
|
|
326
|
+
} | {
|
|
327
|
+
kind: "shared";
|
|
328
|
+
payload: number;
|
|
329
|
+
weak: boolean;
|
|
330
|
+
} | {
|
|
331
|
+
kind: "dynamic";
|
|
332
|
+
} | {
|
|
333
|
+
kind: "actor_call";
|
|
334
|
+
completion: number;
|
|
335
|
+
reply: number;
|
|
336
|
+
declared_failure: boolean;
|
|
337
|
+
} | {
|
|
338
|
+
kind: "provider";
|
|
339
|
+
provider: ManagedProvider;
|
|
340
|
+
children: Array<number>;
|
|
341
|
+
invocation_slot_bytes?: string;
|
|
342
|
+
});
|
|
271
343
|
export type MapValueOp = "New" | "Len" | "Index" | "Get" | "GetBorrow" | "ContainsKey" | "Insert" | "Remove" | "Clear" | "Keys" | "Values" | "Entries";
|
|
272
344
|
export type MathIntrinsic = "Sqrt" | "Exp" | "Log" | "Sin" | "Cos" | "AbsI64" | "MinI64" | "MaxI64" | "AbsF64" | "MinF64" | "MaxF64" | "Pow" | "Floor" | "Ceil" | "Round" | "Tan" | "Asin" | "Acos" | "Atan" | "Atan2" | "Sinh" | "Cosh" | "Tanh" | "Exp2" | "Log2" | "Log10" | "Log1p" | "Expm1" | "Cbrt" | "Hypot" | "Fma" | "Trunc" | "Copysign" | "Powi" | "FromBits";
|
|
273
345
|
export type MutableInvocation = {
|
|
@@ -283,6 +355,7 @@ export type OffloadDetail = {
|
|
|
283
355
|
function: number;
|
|
284
356
|
};
|
|
285
357
|
export type OpV1 = {
|
|
358
|
+
definitions?: Array<ValueDef>;
|
|
286
359
|
own?: Own | null;
|
|
287
360
|
span?: SpanV1 | null | null;
|
|
288
361
|
} & ({
|
|
@@ -419,7 +492,6 @@ export type OpV1 = {
|
|
|
419
492
|
op: "array.repeat";
|
|
420
493
|
dst: number;
|
|
421
494
|
value: number;
|
|
422
|
-
count?: number | null;
|
|
423
495
|
} | {
|
|
424
496
|
op: "variant.make";
|
|
425
497
|
dst: number;
|
|
@@ -537,6 +609,7 @@ export type OpV1 = {
|
|
|
537
609
|
dst: number;
|
|
538
610
|
scope: number;
|
|
539
611
|
members: Array<number>;
|
|
612
|
+
member_slot_bytes: string;
|
|
540
613
|
} | {
|
|
541
614
|
op: "task.spawn";
|
|
542
615
|
dst: number;
|
|
@@ -551,6 +624,10 @@ export type OpV1 = {
|
|
|
551
624
|
});
|
|
552
625
|
export type Own = "none" | "owned" | "guaranteed";
|
|
553
626
|
export type PackageV1 = {
|
|
627
|
+
/**
|
|
628
|
+
* Compiler-authored language accounting layouts; widths are never host sizes.
|
|
629
|
+
*/
|
|
630
|
+
managed_types?: Array<ManagedType>;
|
|
554
631
|
codecs?: Array<string>;
|
|
555
632
|
structural_render?: Array<StructuralRecipe>;
|
|
556
633
|
resources?: Array<Resource>;
|
|
@@ -588,23 +665,28 @@ export type PlaceBase = {
|
|
|
588
665
|
export type PlaceDecl = {
|
|
589
666
|
origin: "local";
|
|
590
667
|
id: number;
|
|
668
|
+
managed_type?: number | null;
|
|
591
669
|
} | {
|
|
592
670
|
origin: "runtime";
|
|
593
671
|
id: number;
|
|
672
|
+
managed_type?: number | null;
|
|
594
673
|
} | {
|
|
595
674
|
origin: "aggregate";
|
|
596
675
|
id: number;
|
|
676
|
+
managed_type?: number | null;
|
|
597
677
|
base: PlaceBase;
|
|
598
678
|
shape?: number | null;
|
|
599
679
|
field: number;
|
|
600
680
|
} | {
|
|
601
681
|
origin: "capture";
|
|
602
682
|
id: number;
|
|
683
|
+
managed_type?: number | null;
|
|
603
684
|
environment: number;
|
|
604
685
|
field: number;
|
|
605
686
|
} | {
|
|
606
687
|
origin: "actor_state";
|
|
607
688
|
id: number;
|
|
689
|
+
managed_type?: number | null;
|
|
608
690
|
environment: number;
|
|
609
691
|
field: number;
|
|
610
692
|
initialized: boolean;
|
|
@@ -667,7 +749,7 @@ export type RuntimeCallFamily = {
|
|
|
667
749
|
IntArith: [IntArithKind, IntMethodWidth];
|
|
668
750
|
} | {
|
|
669
751
|
FloatMethod: FloatMethodOp;
|
|
670
|
-
} | "NodeConnect" | "NodeId" | "NodeIdDisplay" | "LocationNodeId" | "LocationIncarnation" | "LocationDisplay" | "NodeIdentityKey" | "NodeLoadKeys" | "NodeLookup" | "NodeRegister" | "NodeSetTransport" | "NodeShutdown" | "NodeStart" | "MetricCounterRegister" | "MetricCounterInc" | "MetricCounterAdd" | "MetricGaugeRegister" | "MetricGaugeSet" | "MetricGaugeInc" | "MetricGaugeDec" | "MetricGaugeAdd" | "MetricHistogramRegister" | "MetricHistogramRegisterSimple" | "MetricHistogramRecord" | "MetricVecRegister" | "MetricVecWith" | "ObserveReadU64" | "ObserveScrape" | "ObserveSeries" | "ObserveBarrier" | "RcClone" | "RcDowngrade" | "RcDrop" | "RcGet" | "RcIsUnique" | "RcNew" | "RcSet" | "RcStrongCount" | "RcWeakCount" | "WeakCloneRc" | "WeakDropRc" | "WeakUpgradeRc" | "RegexCapture" | "RegexCompile" | "RegexFreeCapture" | "RegexHandle" | "RegexMatch" | "ReplyChannelCancel" | "ReplyChannelFree" | "ReplyChannelNew" | "ReplyPayloadFree" | "ReplyWait" | "SelectFirst" | "SinkClone" | "SinkClose" | "StreamClose" | "
|
|
752
|
+
} | "NodeConnect" | "NodeId" | "NodeIdDisplay" | "LocationNodeId" | "LocationIncarnation" | "LocationDisplay" | "NodeIdentityKey" | "NodeLoadKeys" | "NodeLookup" | "NodeRegister" | "NodeSetTransport" | "NodeShutdown" | "NodeStart" | "MetricCounterRegister" | "MetricCounterInc" | "MetricCounterAdd" | "MetricGaugeRegister" | "MetricGaugeSet" | "MetricGaugeInc" | "MetricGaugeDec" | "MetricGaugeAdd" | "MetricHistogramRegister" | "MetricHistogramRegisterSimple" | "MetricHistogramRecord" | "MetricVecRegister" | "MetricVecWith" | "ObserveReadU64" | "ObserveScrape" | "ObserveSeries" | "ObserveBarrier" | "RcClone" | "RcDowngrade" | "RcDrop" | "RcGet" | "RcIsUnique" | "RcNew" | "RcSet" | "RcStrongCount" | "RcWeakCount" | "WeakCloneRc" | "WeakDropRc" | "WeakUpgradeRc" | "RegexCapture" | "RegexCompile" | "RegexFreeCapture" | "RegexHandle" | "RegexMatch" | "ReplyChannelCancel" | "ReplyChannelFree" | "ReplyChannelNew" | "ReplyPayloadFree" | "ReplyWait" | "SelectFirst" | "SinkClone" | "SinkClose" | "StreamClose" | "StreamForward" | "StreamPipe" | "StreamFromGenerator" | "SinkFromEncoder" | "StreamNextLayout" | "StreamPairSink" | "StreamPairStream" | "StreamSendLayout" | "StreamTake" | "StreamTryNextLayout" | "StreamTrySendLayout" | "CharIsDigit" | "CharIsLetter" | "CharIsAlphanumeric" | "CharIsWhitespace" | "CharIsUpper" | "CharIsLower" | "CharIsPunctuation" | "CharIsControl" | "CharIsAscii" | "CharToUpper" | "CharToLower" | "CharToTitle" | "CharLenUtf8" | "CharToDigit" | "CharFromI64" | "CharFromU64" | "StringGet" | "StringGetRange" | "StringSliceRange" | "StringAppend" | "StringPush" | "StringClear" | "StringFindFrom" | "StringByteLen" | "StringConcat" | "StringEquals" | "StringCompare" | "StringStartsWith" | "StringEndsWith" | "StringContains" | "StringIsEmpty" | "StructuralFormat" | "StringFind" | "StringIndex" | "StringLen" | "StringRepeat" | "StringReplace" | "StringClone" | "StringSplit" | "StringLines" | "StringSliceCodepoints" | "StringSliceCodepointsFrom" | "StringToLowercase" | "StringToBytes" | "StringToUppercase" | "StringTrim" | "U8ToString" | "I32ToString" | "I64ToString" | "U32ToString" | "U64ToString" | "F64ToString" | "CharToString" | {
|
|
671
753
|
Print: {
|
|
672
754
|
kind: PrintKind;
|
|
673
755
|
newline: boolean;
|
|
@@ -694,7 +776,7 @@ export type RuntimeCallFamily = {
|
|
|
694
776
|
} | "VecRemoveAtBool" | "VecRemoveAtLayout" | "VecRemoveAtOwned" | "VecSetBool" | "VecSetLayout" | "VecSetOwned" | "VecSetOwnedMove" | {
|
|
695
777
|
VecSliceRange: VecSliceElem;
|
|
696
778
|
} | "VtableDispatchPanicOnOob";
|
|
697
|
-
export type RuntimeVariantRole = "CrashKindFault" | "CrashKindHeapExceeded" | "CrashKindPartitionDetected" | "CrashKindHandlerFailed" | "CrashKindTimerOverdue" | "OptionSome" | "OptionNone" | "ResultOk" | "ResultErr" | "ActorErrorRejected" | "ActorErrorFailed" | "ActorErrorTrapped" | "ActorErrorRefused" | "CallerActor" | "CallerTask" | "CallerTimer" | "CallerNode" | "ActorErrorDead" | "ActorErrorTimedOut" | "ActorErrorNodeNotRunning" | "ActorErrorRoutingFailed" | "ActorErrorEncodeFailed" | "ActorErrorMessageTooLarge" | "ActorErrorConnectionDropped" | "ActorErrorPartition" | "SendErrorFull" | "SendErrorClosed" | "SendErrorPartition" | "SendErrorStaleRef" | "SendErrorLocalShutdown" | "SendErrorCancelled" | "SendErrorVersionMismatch" | "SendErrorBackpressure" | "SendErrorDead" | "SendErrorUnauthorized" | "SendErrorInvalidMessage" | "SendErrorMessageTooLarge" | "SendErrorTimedOut" | "SendErrorWriteTimedOut" | "DeliveryAccepted" | "DeliveryDiscarded" | "LinkErrorNoContext";
|
|
779
|
+
export type RuntimeVariantRole = "CrashKindFault" | "CrashKindHeapExceeded" | "CrashKindPartitionDetected" | "CrashKindHandlerFailed" | "CrashKindTimerOverdue" | "CrashKindStackOverflow" | "OptionSome" | "OptionNone" | "ResultOk" | "ResultErr" | "ActorErrorRejected" | "ActorErrorFailed" | "ActorErrorTrapped" | "ActorErrorRefused" | "CallerActor" | "CallerTask" | "CallerTimer" | "CallerNode" | "ActorErrorDead" | "ActorErrorTimedOut" | "ActorErrorNodeNotRunning" | "ActorErrorRoutingFailed" | "ActorErrorEncodeFailed" | "ActorErrorMessageTooLarge" | "ActorErrorConnectionDropped" | "ActorErrorPartition" | "SendErrorFull" | "SendErrorClosed" | "SendErrorPartition" | "SendErrorStaleRef" | "SendErrorLocalShutdown" | "SendErrorCancelled" | "SendErrorVersionMismatch" | "SendErrorBackpressure" | "SendErrorDead" | "SendErrorUnauthorized" | "SendErrorInvalidMessage" | "SendErrorMessageTooLarge" | "SendErrorTimedOut" | "SendErrorWriteTimedOut" | "DeliveryAccepted" | "DeliveryDiscarded" | "LinkErrorNoContext";
|
|
698
780
|
export type SafepointDetail = {
|
|
699
781
|
budget: number;
|
|
700
782
|
};
|
|
@@ -783,6 +865,11 @@ export type SupervisorChild = {
|
|
|
783
865
|
stop_ns?: number | null;
|
|
784
866
|
stop_config?: number | null;
|
|
785
867
|
is_pool?: boolean;
|
|
868
|
+
/**
|
|
869
|
+
* Construction transfers this child's effective restart delay as an
|
|
870
|
+
* `(initial, maximum)` argument pair after the config, in declaration order.
|
|
871
|
+
*/
|
|
872
|
+
backoff?: boolean;
|
|
786
873
|
spawn: number;
|
|
787
874
|
};
|
|
788
875
|
export type SupervisorPoolOp = "Len" | "Member" | "Get";
|
|
@@ -791,7 +878,6 @@ export type SupervisorShape = {
|
|
|
791
878
|
strategy: RestartStrategy;
|
|
792
879
|
max_restarts: number;
|
|
793
880
|
window_secs: number;
|
|
794
|
-
backoff?: boolean;
|
|
795
881
|
children: Array<SupervisorChild>;
|
|
796
882
|
startup_order?: Array<number>;
|
|
797
883
|
};
|
|
@@ -804,6 +890,11 @@ export type TcpOp = "Listen" | "ListenerValid" | "ConnectionValid" | "ListenerPo
|
|
|
804
890
|
export type TermV1 = {
|
|
805
891
|
span?: SpanV1 | null | null;
|
|
806
892
|
} & ({
|
|
893
|
+
op: "materialize";
|
|
894
|
+
operation: OpV1;
|
|
895
|
+
normal: Edge;
|
|
896
|
+
failure: Edge;
|
|
897
|
+
} | {
|
|
807
898
|
op: "return";
|
|
808
899
|
value: BoundaryOperand | null;
|
|
809
900
|
} | {
|
|
@@ -1054,7 +1145,7 @@ export type TermV1 = {
|
|
|
1054
1145
|
})));
|
|
1055
1146
|
export type TimerSendPolicy = "reject" | "drop_newest";
|
|
1056
1147
|
export type TimestampBinaryOp = "Add" | "Subtract";
|
|
1057
|
-
export type TrapName = "integer_overflow" | "divide_by_zero" | "shift_out_of_range" | "vector_bounds" | "actor_refused";
|
|
1148
|
+
export type TrapName = "heap_exceeded" | "integer_overflow" | "divide_by_zero" | "signed_min_div_neg_one" | "shift_out_of_range" | "vector_bounds" | "actor_refused" | "stack_overflow";
|
|
1058
1149
|
export type ValueCapability = {
|
|
1059
1150
|
id: number;
|
|
1060
1151
|
capability: Capability;
|
|
@@ -1070,6 +1161,7 @@ export type ValueComponentCapabilities = {
|
|
|
1070
1161
|
export type ValueDef = {
|
|
1071
1162
|
value: number;
|
|
1072
1163
|
own: Own;
|
|
1164
|
+
managed_type?: number | null;
|
|
1073
1165
|
};
|
|
1074
1166
|
export type ValueOrderingCapabilities = {
|
|
1075
1167
|
less: number;
|
|
@@ -1129,7 +1221,7 @@ export type RuntimeFamilyEntry = {
|
|
|
1129
1221
|
id: number;
|
|
1130
1222
|
} & RuntimeIdentity<RuntimeCallFamily>;
|
|
1131
1223
|
export declare const OP_NAMES: readonly ["coverage.hit", "const.int", "const.bool", "const.float", "const.char", "const.unit", "const.duration", "const.str", "const.bytes", "copy_value", "move", "fork", "destroy_value", "begin_borrow", "end_borrow", "finish_linear_receiver", "alloc_place", "store.init", "store.assign", "load.copy", "load.take", "load.borrow", "end_lifetime", "tuple.make", "tuple.get", "aggregate.make", "aggregate.project_copy", "aggregate.project_borrow", "destructure", "array.make", "array.repeat", "variant.make", "variant.is", "variant.project_copy", "variant.project_borrow", "variant.destructure", "unary", "binary", "cast", "str.eq", "bytes.eq", "function.make", "closure.make", "callable.coerce", "dyn.make", "register_defer", "generator.make", "actor.ingress_adapter", "stream.pipe", "task_scope.enter", "task_scope.close", "task.race", "task.spawn", "task.invoke"];
|
|
1132
|
-
export declare const TERM_NAMES: readonly ["return", "goto", "branch", "switch.variant", "checked.binary", "timestamp.binary", "unreachable", "call", "indirect.call", "dyn.call", "value.call", "wire.codec", "runtime.call", "extern.call", "actor.call", "panic", "trap", "checked_raise", "cleanup.dispatch", "resume_unwind", "enter_defer", "finish_defer", "recover_fault", "suspend"];
|
|
1224
|
+
export declare const TERM_NAMES: readonly ["materialize", "return", "goto", "branch", "switch.variant", "checked.binary", "timestamp.binary", "unreachable", "call", "indirect.call", "dyn.call", "value.call", "wire.codec", "runtime.call", "extern.call", "actor.call", "panic", "trap", "checked_raise", "cleanup.dispatch", "resume_unwind", "enter_defer", "finish_defer", "recover_fault", "suspend"];
|
|
1133
1225
|
export declare const SUSPENSION_NAMES: readonly ["Sleep", "SleepUntil", "Await", "ActorSend", "RestartWait", "Read", "Accept", "CallClosure", "Timeout", "ScopeDeadline", "Yield", "GeneratorNext", "Safepoint", "ServiceAcquire", "SemaphoreAcquire", "NativeIo", "Offload", "Ask", "Join", "StreamSend", "StreamNext", "Select"];
|
|
1134
1226
|
export type OpName = OpV1["op"];
|
|
1135
1227
|
export type TermName = TermV1["op"];
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { type VmValue } from "../values.js";
|
|
2
|
+
import type { ManagedType } from "./package.js";
|
|
3
|
+
export declare class HeapExceeded extends Error {
|
|
4
|
+
constructor();
|
|
5
|
+
}
|
|
6
|
+
type Allocations = Map<object, bigint>;
|
|
7
|
+
type StorageVisitor = (identity: object, bytes: bigint, children: () => void) => void;
|
|
8
|
+
export interface ManagedRoot {
|
|
9
|
+
value: VmValue;
|
|
10
|
+
type: number;
|
|
11
|
+
slots?: boolean;
|
|
12
|
+
identity?: object;
|
|
13
|
+
}
|
|
14
|
+
export interface ManagedProjection {
|
|
15
|
+
identity: object;
|
|
16
|
+
bytes: bigint;
|
|
17
|
+
children: readonly ManagedRoot[];
|
|
18
|
+
}
|
|
19
|
+
export interface ManagedLease {
|
|
20
|
+
readonly roots?: readonly ManagedRoot[];
|
|
21
|
+
release(): void;
|
|
22
|
+
}
|
|
23
|
+
/** Compiler-authored widths and children describe payloads; VM backings supply
|
|
24
|
+
* identity and capacity. No host-object or allocator size enters this graph. */
|
|
25
|
+
export declare class ManagedLayouts {
|
|
26
|
+
readonly rows: readonly ManagedType[];
|
|
27
|
+
private readonly retained?;
|
|
28
|
+
private readonly types;
|
|
29
|
+
private readonly retired;
|
|
30
|
+
private readonly adoption;
|
|
31
|
+
constructor(rows: readonly ManagedType[], retained?: ((value: VmValue, type: number) => ManagedProjection) | undefined);
|
|
32
|
+
row(type: number): ManagedType;
|
|
33
|
+
stamp(value: VmValue, type: number): void;
|
|
34
|
+
width(type: number, capacity?: number | bigint): bigint;
|
|
35
|
+
/** Propagate nested compiler descriptors before an unbounded value is copied
|
|
36
|
+
* or suspended. Unknown foreign payloads need no quota graph here; acquiring
|
|
37
|
+
* the same value into a bounded owner still requires its real visitor. */
|
|
38
|
+
stampGraph(root: ManagedRoot): void;
|
|
39
|
+
needsAdoption(type: number): boolean;
|
|
40
|
+
retire(value: VmValue): void;
|
|
41
|
+
type(value: VmValue): number;
|
|
42
|
+
/** Describe native copy allocations without retaining or changing inputs. */
|
|
43
|
+
copy(value: VmValue, type: number): VmValue;
|
|
44
|
+
collect(root: ManagedRoot, allocations: Allocations, substitution?: {
|
|
45
|
+
before: VmValue;
|
|
46
|
+
after: VmValue;
|
|
47
|
+
}, stringGrowth?: {
|
|
48
|
+
value: VmValue;
|
|
49
|
+
identity: object;
|
|
50
|
+
capacity: number;
|
|
51
|
+
}, retained?: (value: VmValue, type: number) => void, providerGraph?: ((value: VmValue, type: number) => ManagedProjection) | undefined, storageVisitor?: StorageVisitor): void;
|
|
52
|
+
}
|
|
53
|
+
/** One incarnation owns backing edges. Retaining an existing backing does not
|
|
54
|
+
* revisit its payload; its children belong to that backing until its final
|
|
55
|
+
* local retention ends. Mutable/provider publication invalidates those edges
|
|
56
|
+
* and reconciles them through the same typed visitor before acquisition. */
|
|
57
|
+
export declare class ManagedBudget {
|
|
58
|
+
readonly layouts: ManagedLayouts;
|
|
59
|
+
readonly limit: bigint;
|
|
60
|
+
private readonly acquired?;
|
|
61
|
+
private readonly roots;
|
|
62
|
+
private nodes;
|
|
63
|
+
private edges;
|
|
64
|
+
private retainedBytes;
|
|
65
|
+
private dirty;
|
|
66
|
+
constructor(layouts: ManagedLayouts, limit: bigint, acquired?: ((root: ManagedRoot) => void) | undefined);
|
|
67
|
+
allocations(extra?: readonly ManagedRoot[], substitution?: {
|
|
68
|
+
before: VmValue;
|
|
69
|
+
after: VmValue;
|
|
70
|
+
}, stringGrowth?: {
|
|
71
|
+
value: VmValue;
|
|
72
|
+
identity: object;
|
|
73
|
+
capacity: number;
|
|
74
|
+
}): Allocations;
|
|
75
|
+
get liveBytes(): bigint;
|
|
76
|
+
changed(): void;
|
|
77
|
+
private bytes;
|
|
78
|
+
private graph;
|
|
79
|
+
private refresh;
|
|
80
|
+
private prune;
|
|
81
|
+
check(extra: readonly ManagedRoot[]): void;
|
|
82
|
+
checkPayload(bytes: bigint, children: readonly ManagedRoot[]): void;
|
|
83
|
+
checkMutation(before: VmValue, after: VmValue, detached?: boolean): void;
|
|
84
|
+
checkStringGrowth(value: VmValue, capacity: number, detached?: boolean): void;
|
|
85
|
+
retain(root: ManagedRoot): ManagedLease;
|
|
86
|
+
retainMany(roots: readonly ManagedRoot[]): ManagedLease;
|
|
87
|
+
}
|
|
88
|
+
export {};
|