@yabgu_gm/tensionscript 0.11.2 → 0.11.4
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/asc.generated.d.ts +49 -5
- package/dist/asc.js +1 -1
- package/dist/asc.js.map +1 -1
- package/dist/assemblyscript.generated.d.ts +49 -5
- package/dist/assemblyscript.js +116 -116
- package/dist/assemblyscript.js.map +3 -3
- package/dist/importmap.json +2 -2
- package/dist/web.js +3 -3
- package/package.json +1 -1
|
@@ -4597,6 +4597,16 @@ declare module "types:tensionscript/src/program" {
|
|
|
4597
4597
|
* (there are none: a view has no per-field locals to copy into).
|
|
4598
4598
|
*/
|
|
4599
4599
|
isViewParam: boolean;
|
|
4600
|
+
/**
|
|
4601
|
+
* Whether this local is a **view local**: `const p = changetype<@unmanaged T>(ptr)`
|
|
4602
|
+
* where `T` is an inline type.
|
|
4603
|
+
*
|
|
4604
|
+
* The same idea as {@link isViewParam} — the local holds an address, not a
|
|
4605
|
+
* value — but a body local rather than a parameter. `type` stays the record
|
|
4606
|
+
* type, because that is what makes `p.field` resolve; `getNonParameterLocalTypes`
|
|
4607
|
+
* is what gives it one `i32` slot instead of the record's reference type.
|
|
4608
|
+
*/
|
|
4609
|
+
isViewLocal: boolean;
|
|
4600
4610
|
/** Constructs a new local variable. */
|
|
4601
4611
|
constructor(
|
|
4602
4612
|
/** Simple name. */
|
|
@@ -6063,7 +6073,35 @@ declare module "types:tensionscript/src/compiler" {
|
|
|
6063
6073
|
checkSignatureSupported(signature: Signature, reportNode: FunctionTypeNode): boolean;
|
|
6064
6074
|
/** Is `type` an `@inline struct`: a value carried as its fields, never as a
|
|
6065
6075
|
* pointer? */
|
|
6076
|
+
/**
|
|
6077
|
+
* Whether `node` is syntactically `changetype<@unmanaged T>(...)`.
|
|
6078
|
+
*
|
|
6079
|
+
* The resolver's `isViewCall` is authoritative once the call has been
|
|
6080
|
+
* compiled, but `compileSroaLocal` decides *before* compiling the initialiser,
|
|
6081
|
+
* so it has to read the shape off the AST. The two agree: the mark is set
|
|
6082
|
+
* from exactly this test (`compileCallExpressionBuiltin`).
|
|
6083
|
+
*/
|
|
6084
|
+
private isUnmanagedChangetype;
|
|
6066
6085
|
private isInlineStructType;
|
|
6086
|
+
/**
|
|
6087
|
+
* Reads `field` through a view of the record's bytes at `basePtr`.
|
|
6088
|
+
*
|
|
6089
|
+
* A scalar field is a load at its offset. A field whose type is itself an
|
|
6090
|
+
* `@inline struct` is **not** a load: the field is bytes inside the viewed
|
|
6091
|
+
* record, so what the caller needs is their *address* — `basePtr + offset` —
|
|
6092
|
+
* the same shape the declared-`@unmanaged` path produces through the
|
|
6093
|
+
* inline-field branch of `compilePropertyAccess`, and the same `i32` a
|
|
6094
|
+
* record accessor takes as `this`.
|
|
6095
|
+
*
|
|
6096
|
+
* Loading it instead was a silent miscompile: a 4-byte load of the field's
|
|
6097
|
+
* first bytes was handed to the inner setter as if it were a pointer.
|
|
6098
|
+
* Measured — `changetype<@unmanaged R>(ptr).pos.x = v` read a float's bit
|
|
6099
|
+
* pattern as an address and trapped with `memory access out of bounds`.
|
|
6100
|
+
*
|
|
6101
|
+
* A fixed-array field is storage for the same reason, so it takes the address
|
|
6102
|
+
* branch too.
|
|
6103
|
+
*/
|
|
6104
|
+
private viewFieldAccess;
|
|
6067
6105
|
/** The WASM result type of a value of `type`: `None` for an `@inline struct`,
|
|
6068
6106
|
* whose value is written to the caller's slot instead of returned. Calling
|
|
6069
6107
|
* `type.toRef()` on an inline struct is what this replaces — it has no
|
|
@@ -6177,8 +6215,14 @@ declare module "types:tensionscript/src/compiler" {
|
|
|
6177
6215
|
/** The bytes one call-temp slot needs for `type`, rounded up to the region's
|
|
6178
6216
|
* 16-byte alignment so every slot stays aligned for any field. */
|
|
6179
6217
|
private sretSizeOf;
|
|
6180
|
-
/**
|
|
6181
|
-
* passes assume a single parent per expression.
|
|
6218
|
+
/** The call-temp slot address: the mark alone, freshly built so callers never
|
|
6219
|
+
* share a node (Binaryen's passes assume a single parent per expression).
|
|
6220
|
+
*
|
|
6221
|
+
* **Not `base + mark`.** `ensureSretStack` initialises the bump global to
|
|
6222
|
+
* `base`, so a mark saved from it is already absolute — which is also what
|
|
6223
|
+
* `makeSretGuard` assumes when it tests `mark + size > base + SIZE`. Adding
|
|
6224
|
+
* `base` a second time yields `2 * base + ...`; measured, that produced a
|
|
6225
|
+
* fault at exactly `0x1002a60 = 2 * 0x801418`. */
|
|
6182
6226
|
private makeSretAddress;
|
|
6183
6227
|
/** A load of one field of an `@inline struct` at a slot address. */
|
|
6184
6228
|
private makeSretFieldLoad;
|
|
@@ -6198,7 +6242,7 @@ declare module "types:tensionscript/src/compiler" {
|
|
|
6198
6242
|
* the caller's later mutation of the struct cannot be observed by the body.
|
|
6199
6243
|
*/
|
|
6200
6244
|
private emitExportByValPrologue;
|
|
6201
|
-
/** `
|
|
6245
|
+
/** `mark + extra`, freshly built. Callers must not share the node:
|
|
6202
6246
|
* Binaryen's passes assume a single parent per expression. */
|
|
6203
6247
|
private makeSretAddressPlus;
|
|
6204
6248
|
/**
|
|
@@ -6209,7 +6253,7 @@ declare module "types:tensionscript/src/compiler" {
|
|
|
6209
6253
|
* descended into. Keeping one recursion is what makes a nested value cross a
|
|
6210
6254
|
* host boundary at the layout the C side expects.
|
|
6211
6255
|
*/
|
|
6212
|
-
emitTempArgumentLeaves(type: Type, fieldLocals: Map<string, Local>,
|
|
6256
|
+
emitTempArgumentLeaves(type: Type, fieldLocals: Map<string, Local>, markLocal: Local, baseOffset: number, stmts: ExpressionRef[]): void;
|
|
6213
6257
|
/**
|
|
6214
6258
|
* Materialises one `@inline struct` argument of an `@external` call on the
|
|
6215
6259
|
* static call-temp stack and returns the address to pass.
|
|
@@ -6344,7 +6388,7 @@ declare module "types:tensionscript/src/compiler" {
|
|
|
6344
6388
|
* back into the leaf locals a read path walks. A fresh slot address per load,
|
|
6345
6389
|
* for the same one-parent-per-node reason.
|
|
6346
6390
|
*/
|
|
6347
|
-
emitSretLoadsInto(type: Type, fieldLocals: Map<string, Local>,
|
|
6391
|
+
emitSretLoadsInto(type: Type, fieldLocals: Map<string, Local>, markLocal: Local, baseOffset: number, stmts: ExpressionRef[]): void;
|
|
6348
6392
|
/**
|
|
6349
6393
|
* The `fieldLocals` tree behind an SROA-tracked expression, or `null`.
|
|
6350
6394
|
*
|