Skip to content

Commit da77630

Browse files
authored
fix: remove unused tmp local in array literal generated code (#2917)
1 parent 91976df commit da77630

26 files changed

+11305
-11898
lines changed

‎src/compiler.ts‎

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8189,11 +8189,9 @@ export class Compiler extends DiagnosticEmitter{
81898189
letarrayInstance=<Class>element;
81908190
letarrayType=arrayInstance.type;
81918191
letelementType=arrayInstance.getTypeArgumentsTo(program.arrayPrototype)![0];
8192-
letarrayBufferInstance=assert(program.arrayBufferInstance);
81938192

81948193
// block those here so compiling expressions doesn't conflict
81958194
lettempThis=flow.getTempLocal(this.options.usizeType);
8196-
lettempDataStart=flow.getTempLocal(arrayBufferInstance.type);
81978195

81988196
// compile value expressions and find out whether all are constant
81998197
letexpressions=expression.elementExpressions;
@@ -8269,16 +8267,6 @@ export class Compiler extends DiagnosticEmitter{
82698267
letdataStartProperty=(<PropertyPrototype>dataStartMember).instance;
82708268
if(!dataStartProperty)returnmodule.unreachable();
82718269
assert(dataStartProperty.isField&&dataStartProperty.memoryOffset>=0);
8272-
stmts.push(
8273-
module.local_set(tempDataStart.index,
8274-
module.load(arrayType.byteSize,false,
8275-
module.local_get(tempThis.index,arrayTypeRef),
8276-
arrayTypeRef,
8277-
dataStartProperty.memoryOffset
8278-
),
8279-
true// ArrayBuffer
8280-
)
8281-
);
82828270
for(leti=0;i<length;++i){
82838271
// this[i] = value
82848272
stmts.push(

‎tests/compiler/bindings/noExportRuntime.debug.wat‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2361,8 +2361,6 @@
23612361
(func$start:bindings/noExportRuntime
23622362
(local$0i32)
23632363
(local$1i32)
2364-
(local$2i32)
2365-
(local$3i32)
23662364
memory.size
23672365
i32.const16
23682366
i32.shl

0 commit comments

Comments
(0)