From 6ade9f3dd1ac9bfacc552dc28392758747390b6f Mon Sep 17 00:00:00 2001 From: MaxGraey Date: Tue, 11 Feb 2020 21:19:46 +0200 Subject: [PATCH] return ref to self for Map#set and Set#add --- std/assembly/index.d.ts | 4 +- std/assembly/map.ts | 3 +- std/assembly/set.ts | 3 +- tests/compiler/std/map.optimized.wat | 189 +++++++++++++++++------- tests/compiler/std/map.untouched.wat | 143 ++++++++++++++---- tests/compiler/std/set.optimized.wat | 116 +++++++++++---- tests/compiler/std/set.untouched.wat | 91 +++++++++--- tests/compiler/std/symbol.untouched.wat | 18 ++- 8 files changed, 427 insertions(+), 140 deletions(-) diff --git a/std/assembly/index.d.ts b/std/assembly/index.d.ts index 5a08d69078..a0fd2064be 100644 --- a/std/assembly/index.d.ts +++ b/std/assembly/index.d.ts @@ -1535,7 +1535,7 @@ interface RegExp {} declare class Map { readonly size: i32; has(key: K): bool; - set(key: K, value: V): void; + set(key: K, value: V): this; get(key: K): V; delete(key: K): bool; clear(): void; @@ -1547,7 +1547,7 @@ declare class Map { declare class Set { readonly size: i32; has(value: K): bool; - add(value: K): void; + add(value: K): this; delete(value: K): bool; clear(): void; values(): K[]; // preliminary diff --git a/std/assembly/map.ts b/std/assembly/map.ts index 2444ad7b1f..51fdf243af 100644 --- a/std/assembly/map.ts +++ b/std/assembly/map.ts @@ -113,7 +113,7 @@ export class Map { } @operator("[]=") - set(key: K, value: V): void { + set(key: K, value: V): this { var hashCode = HASH(key); var entry = this.find(key, hashCode); // unmanaged! if (entry) { @@ -151,6 +151,7 @@ export class Map { entry.taggedNext = load(bucketPtrBase); store(bucketPtrBase, changetype(entry)); } + return this; } delete(key: K): bool { diff --git a/std/assembly/set.ts b/std/assembly/set.ts index e5d7157af9..76a7b66ed3 100644 --- a/std/assembly/set.ts +++ b/std/assembly/set.ts @@ -101,7 +101,7 @@ export class Set { return this.find(key, HASH(key)) !== null; } - add(key: T): void { + add(key: T): this { var hashCode = HASH(key); var entry = this.find(key, hashCode); // unmanaged! if (!entry) { @@ -124,6 +124,7 @@ export class Set { entry.taggedNext = load(bucketPtrBase); store(bucketPtrBase, changetype(entry)); } + return this; } @operator("[]=") diff --git a/tests/compiler/std/map.optimized.wat b/tests/compiler/std/map.optimized.wat index 2af6de2ae7..41c95dca5e 100644 --- a/tests/compiler/std/map.optimized.wat +++ b/tests/compiler/std/map.optimized.wat @@ -3,29 +3,26 @@ (type $none_=>_i32 (func (result i32))) (type $i32_=>_i32 (func (param i32) (result i32))) (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) - (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) + (type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32))) (type $i32_=>_none (func (param i32))) (type $none_=>_none (func)) - (type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32))) - (type $i32_i64_=>_i32 (func (param i32 i64) (result i32))) + (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) (type $i32_i64_i32_=>_i32 (func (param i32 i64 i32) (result i32))) + (type $i32_f64_i32_=>_i32 (func (param i32 f64 i32) (result i32))) + (type $i32_i64_=>_i32 (func (param i32 i64) (result i32))) (type $i32_f32_=>_i32 (func (param i32 f32) (result i32))) + (type $i32_f32_i32_=>_i32 (func (param i32 f32 i32) (result i32))) (type $i32_f64_=>_i32 (func (param i32 f64) (result i32))) - (type $i32_f64_i32_=>_i32 (func (param i32 f64 i32) (result i32))) (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) (type $i32_i32_i64_=>_none (func (param i32 i32 i64))) (type $i32_i32_f32_=>_none (func (param i32 i32 f32))) (type $i32_i32_f64_=>_none (func (param i32 i32 f64))) (type $i32_i64_=>_none (func (param i32 i64))) - (type $i32_i64_i32_=>_none (func (param i32 i64 i32))) - (type $i32_i64_i64_=>_none (func (param i32 i64 i64))) (type $i32_f32_=>_none (func (param i32 f32))) - (type $i32_f32_i32_=>_none (func (param i32 f32 i32))) - (type $i32_f32_f32_=>_none (func (param i32 f32 f32))) (type $i32_f64_=>_none (func (param i32 f64))) - (type $i32_f64_i32_=>_none (func (param i32 f64 i32))) - (type $i32_f64_f64_=>_none (func (param i32 f64 f64))) - (type $i32_f32_i32_=>_i32 (func (param i32 f32 i32) (result i32))) + (type $i32_i64_i64_=>_i32 (func (param i32 i64 i64) (result i32))) + (type $i32_f32_f32_=>_i32 (func (param i32 f32 f32) (result i32))) + (type $i32_f64_f64_=>_i32 (func (param i32 f64 f64) (result i32))) (type $i64_=>_i32 (func (param i64) (result i32))) (type $i32_i32_=>_i64 (func (param i32 i32) (result i64))) (type $i32_i32_=>_f32 (func (param i32 i32) (result f32))) @@ -1636,7 +1633,7 @@ local.get $4 call $~lib/rt/pure/__release ) - (func $~lib/map/Map#set (; 27 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/map/Map#set (; 27 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -1720,13 +1717,15 @@ i32.const 2 i32.shl i32.add - local.tee $0 + local.tee $1 i32.load i32.store offset=8 - local.get $0 + local.get $1 local.get $3 i32.store end + local.get $0 + call $~lib/rt/pure/__retain ) (func $~lib/map/Map#get (; 28 ;) (param $0 i32) (param $1 i32) (result i32) local.get $0 @@ -2751,7 +2750,7 @@ local.get $4 call $~lib/rt/pure/__release ) - (func $~lib/map/Map#set (; 49 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/map/Map#set (; 49 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -2835,13 +2834,15 @@ i32.const 2 i32.shl i32.add - local.tee $0 + local.tee $1 i32.load i32.store offset=4 - local.get $0 + local.get $1 local.get $3 i32.store end + local.get $0 + call $~lib/rt/pure/__retain ) (func $~lib/util/hash/hash32 (; 50 ;) (param $0 i32) (result i32) local.get $0 @@ -3046,7 +3047,7 @@ local.get $4 call $~lib/rt/pure/__release ) - (func $~lib/map/Map#set (; 53 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/map/Map#set (; 53 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -3126,13 +3127,15 @@ i32.const 2 i32.shl i32.add - local.tee $0 + local.tee $1 i32.load i32.store offset=8 - local.get $0 + local.get $1 local.get $3 i32.store end + local.get $0 + call $~lib/rt/pure/__retain ) (func $~lib/map/Map#delete (; 54 ;) (param $0 i32) (param $1 i32) (local $2 i32) @@ -3238,6 +3241,7 @@ i32.const 10 i32.add call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $1 local.get $0 call $~lib/map/Map#has @@ -3340,6 +3344,7 @@ i32.const 20 i32.add call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $1 local.get $0 call $~lib/map/Map#has @@ -3446,6 +3451,7 @@ local.get $2 local.get $2 call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $5 local.get $7 i32.const 20 @@ -3453,6 +3459,7 @@ local.tee $2 local.get $2 call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $0 i32.const 1 i32.add @@ -3591,6 +3598,7 @@ i32.const 10 i32.add call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $1 local.get $0 call $~lib/map/Map#has @@ -3829,7 +3837,7 @@ local.get $4 call $~lib/rt/pure/__release ) - (func $~lib/map/Map#set (; 59 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/map/Map#set (; 59 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -3911,13 +3919,15 @@ i32.const 2 i32.shl i32.add - local.tee $0 + local.tee $1 i32.load i32.store offset=8 - local.get $0 + local.get $1 local.get $3 i32.store end + local.get $0 + call $~lib/rt/pure/__retain ) (func $~lib/map/Map#get (; 60 ;) (param $0 i32) (param $1 i32) (result i32) local.get $0 @@ -4185,7 +4195,7 @@ local.get $4 call $~lib/rt/pure/__release ) - (func $~lib/map/Map#set (; 65 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/map/Map#set (; 65 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -4267,13 +4277,15 @@ i32.const 2 i32.shl i32.add - local.tee $0 + local.tee $1 i32.load i32.store offset=4 - local.get $0 + local.get $1 local.get $3 i32.store end + local.get $0 + call $~lib/rt/pure/__retain ) (func $~lib/map/Map#delete (; 66 ;) (param $0 i32) (param $1 i32) (local $2 i32) @@ -4373,6 +4385,7 @@ i32.const 10 i32.add call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $1 local.get $0 call $~lib/map/Map#has @@ -4467,6 +4480,7 @@ i32.const 20 i32.add call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $1 local.get $0 call $~lib/map/Map#has @@ -4571,6 +4585,7 @@ local.get $2 local.get $2 call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $5 local.get $7 i32.const 20 @@ -4578,6 +4593,7 @@ local.tee $2 local.get $2 call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $0 i32.const 1 i32.add @@ -4708,6 +4724,7 @@ i32.const 10 i32.add call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $1 local.get $0 call $~lib/map/Map#has @@ -5006,7 +5023,7 @@ local.get $4 call $~lib/rt/pure/__release ) - (func $~lib/map/Map#set (; 73 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/map/Map#set (; 73 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -5090,13 +5107,15 @@ i32.const 2 i32.shl i32.add - local.tee $0 + local.tee $1 i32.load i32.store offset=8 - local.get $0 + local.get $1 local.get $3 i32.store end + local.get $0 + call $~lib/rt/pure/__retain ) (func $~lib/map/Map#get (; 74 ;) (param $0 i32) (param $1 i32) (result i32) local.get $0 @@ -5461,7 +5480,7 @@ local.get $4 call $~lib/rt/pure/__release ) - (func $~lib/map/Map#set (; 82 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/map/Map#set (; 82 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -5545,13 +5564,15 @@ i32.const 2 i32.shl i32.add - local.tee $0 + local.tee $1 i32.load i32.store offset=4 - local.get $0 + local.get $1 local.get $3 i32.store end + local.get $0 + call $~lib/rt/pure/__retain ) (func $~lib/map/Map#delete (; 83 ;) (param $0 i32) (param $1 i32) (local $2 i32) @@ -5657,6 +5678,7 @@ i32.const 10 i32.add call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $1 local.get $0 call $~lib/map/Map#has @@ -5759,6 +5781,7 @@ i32.const 20 i32.add call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $1 local.get $0 call $~lib/map/Map#has @@ -5865,6 +5888,7 @@ local.get $2 local.get $2 call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $5 local.get $7 i32.const 20 @@ -5872,6 +5896,7 @@ local.tee $2 local.get $2 call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $0 i32.const 1 i32.add @@ -6010,6 +6035,7 @@ i32.const 10 i32.add call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $1 local.get $0 call $~lib/map/Map#has @@ -6248,7 +6274,7 @@ local.get $4 call $~lib/rt/pure/__release ) - (func $~lib/map/Map#set (; 88 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/map/Map#set (; 88 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -6330,13 +6356,15 @@ i32.const 2 i32.shl i32.add - local.tee $0 + local.tee $1 i32.load i32.store offset=8 - local.get $0 + local.get $1 local.get $3 i32.store end + local.get $0 + call $~lib/rt/pure/__retain ) (func $~lib/map/Map#get (; 89 ;) (param $0 i32) (param $1 i32) (result i32) local.get $0 @@ -6606,7 +6634,7 @@ local.get $4 call $~lib/rt/pure/__release ) - (func $~lib/map/Map#set (; 94 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/map/Map#set (; 94 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -6688,13 +6716,15 @@ i32.const 2 i32.shl i32.add - local.tee $0 + local.tee $1 i32.load i32.store offset=4 - local.get $0 + local.get $1 local.get $3 i32.store end + local.get $0 + call $~lib/rt/pure/__retain ) (func $~lib/map/Map#delete (; 95 ;) (param $0 i32) (param $1 i32) (local $2 i32) @@ -6794,6 +6824,7 @@ i32.const 10 i32.add call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $1 local.get $0 call $~lib/map/Map#has @@ -6888,6 +6919,7 @@ i32.const 20 i32.add call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $1 local.get $0 call $~lib/map/Map#has @@ -6992,6 +7024,7 @@ local.get $2 local.get $2 call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $5 local.get $7 i32.const 20 @@ -6999,6 +7032,7 @@ local.tee $2 local.get $2 call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $0 i32.const 1 i32.add @@ -7129,6 +7163,7 @@ i32.const 10 i32.add call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $1 local.get $0 call $~lib/map/Map#has @@ -7373,6 +7408,7 @@ i32.const 10 i32.add call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $1 local.get $0 call $~lib/map/Map#has @@ -7459,6 +7495,7 @@ i32.const 20 i32.add call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $1 local.get $0 call $~lib/map/Map#has @@ -7561,6 +7598,7 @@ local.get $2 local.get $2 call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $5 local.get $7 i32.const 20 @@ -7568,6 +7606,7 @@ local.tee $2 local.get $2 call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $0 i32.const 1 i32.add @@ -7690,6 +7729,7 @@ i32.const 10 i32.add call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $1 local.get $0 call $~lib/map/Map#has @@ -7914,6 +7954,7 @@ i32.const 10 i32.add call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $1 local.get $0 call $~lib/map/Map#has @@ -8000,6 +8041,7 @@ i32.const 20 i32.add call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $1 local.get $0 call $~lib/map/Map#has @@ -8102,6 +8144,7 @@ local.get $2 local.get $2 call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $5 local.get $7 i32.const 20 @@ -8109,6 +8152,7 @@ local.tee $2 local.get $2 call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $0 i32.const 1 i32.add @@ -8231,6 +8275,7 @@ i32.const 10 i32.add call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $1 local.get $0 call $~lib/map/Map#has @@ -8607,7 +8652,7 @@ local.get $4 call $~lib/rt/pure/__release ) - (func $~lib/map/Map#set (; 112 ;) (param $0 i32) (param $1 i64) (param $2 i32) + (func $~lib/map/Map#set (; 112 ;) (param $0 i32) (param $1 i64) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -8687,13 +8732,15 @@ i32.const 2 i32.shl i32.add - local.tee $0 + local.tee $2 i32.load i32.store offset=12 - local.get $0 + local.get $2 local.get $3 i32.store end + local.get $0 + call $~lib/rt/pure/__retain ) (func $~lib/map/Map#get (; 113 ;) (param $0 i32) (param $1 i64) (result i32) local.get $0 @@ -9141,7 +9188,7 @@ local.get $4 call $~lib/rt/pure/__release ) - (func $~lib/map/Map#set (; 123 ;) (param $0 i32) (param $1 i64) (param $2 i64) + (func $~lib/map/Map#set (; 123 ;) (param $0 i32) (param $1 i64) (param $2 i64) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -9221,13 +9268,15 @@ i32.const 2 i32.shl i32.add - local.tee $0 + local.tee $4 i32.load i32.store offset=16 - local.get $0 + local.get $4 local.get $3 i32.store end + local.get $0 + call $~lib/rt/pure/__retain ) (func $~lib/map/Map#delete (; 124 ;) (param $0 i32) (param $1 i64) (local $2 i32) @@ -9323,6 +9372,7 @@ i32.const 10 i32.add call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $1 local.get $0 call $~lib/map/Map#has @@ -9412,6 +9462,7 @@ i32.const 20 i32.add call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $1 local.get $0 call $~lib/map/Map#has @@ -9514,6 +9565,7 @@ local.get $0 local.get $0 call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $6 local.get $3 i32.const 20 @@ -9521,6 +9573,7 @@ local.tee $3 local.get $3 call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $2 i32.const 1 i32.add @@ -9645,6 +9698,7 @@ i32.const 10 i32.add call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $1 local.get $0 call $~lib/map/Map#has @@ -9870,6 +9924,7 @@ i32.const 10 i32.add call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $1 local.get $0 call $~lib/map/Map#has @@ -9959,6 +10014,7 @@ i32.const 20 i32.add call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $1 local.get $0 call $~lib/map/Map#has @@ -10061,6 +10117,7 @@ local.get $0 local.get $0 call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $6 local.get $3 i32.const 20 @@ -10068,6 +10125,7 @@ local.tee $3 local.get $3 call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $2 i32.const 1 i32.add @@ -10192,6 +10250,7 @@ i32.const 10 i32.add call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $1 local.get $0 call $~lib/map/Map#has @@ -10471,7 +10530,7 @@ local.get $4 call $~lib/rt/pure/__release ) - (func $~lib/map/Map#set (; 134 ;) (param $0 i32) (param $1 f32) (param $2 i32) + (func $~lib/map/Map#set (; 134 ;) (param $0 i32) (param $1 f32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -10552,13 +10611,15 @@ i32.const 2 i32.shl i32.add - local.tee $0 + local.tee $2 i32.load i32.store offset=8 - local.get $0 + local.get $2 local.get $3 i32.store end + local.get $0 + call $~lib/rt/pure/__retain ) (func $~lib/map/Map#get (; 135 ;) (param $0 i32) (param $1 f32) (result i32) local.get $0 @@ -10866,7 +10927,7 @@ local.get $4 call $~lib/rt/pure/__release ) - (func $~lib/map/Map#set (; 141 ;) (param $0 i32) (param $1 f32) (param $2 f32) + (func $~lib/map/Map#set (; 141 ;) (param $0 i32) (param $1 f32) (param $2 f32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -10947,13 +11008,15 @@ i32.const 2 i32.shl i32.add - local.tee $0 + local.tee $4 i32.load i32.store offset=8 - local.get $0 + local.get $4 local.get $3 i32.store end + local.get $0 + call $~lib/rt/pure/__retain ) (func $~lib/map/Map#delete (; 142 ;) (param $0 i32) (param $1 f32) (local $2 i32) @@ -11050,6 +11113,7 @@ i32.const 10 i32.add call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $1 local.get $0 call $~lib/map/Map#has @@ -11139,6 +11203,7 @@ i32.const 20 i32.add call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $1 local.get $0 call $~lib/map/Map#has @@ -11241,6 +11306,7 @@ local.get $0 local.get $0 call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $6 local.get $3 i32.const 20 @@ -11248,6 +11314,7 @@ local.tee $3 local.get $3 call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $2 i32.const 1 i32.add @@ -11372,6 +11439,7 @@ i32.const 10 i32.add call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $1 local.get $0 call $~lib/map/Map#has @@ -11651,7 +11719,7 @@ local.get $4 call $~lib/rt/pure/__release ) - (func $~lib/map/Map#set (; 148 ;) (param $0 i32) (param $1 f64) (param $2 i32) + (func $~lib/map/Map#set (; 148 ;) (param $0 i32) (param $1 f64) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -11732,13 +11800,15 @@ i32.const 2 i32.shl i32.add - local.tee $0 + local.tee $2 i32.load i32.store offset=12 - local.get $0 + local.get $2 local.get $3 i32.store end + local.get $0 + call $~lib/rt/pure/__retain ) (func $~lib/map/Map#get (; 149 ;) (param $0 i32) (param $1 f64) (result i32) local.get $0 @@ -12087,7 +12157,7 @@ local.get $4 call $~lib/rt/pure/__release ) - (func $~lib/map/Map#set (; 156 ;) (param $0 i32) (param $1 f64) (param $2 f64) + (func $~lib/map/Map#set (; 156 ;) (param $0 i32) (param $1 f64) (param $2 f64) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -12168,13 +12238,15 @@ i32.const 2 i32.shl i32.add - local.tee $0 + local.tee $4 i32.load i32.store offset=16 - local.get $0 + local.get $4 local.get $3 i32.store end + local.get $0 + call $~lib/rt/pure/__retain ) (func $~lib/map/Map#delete (; 157 ;) (param $0 i32) (param $1 f64) (local $2 i32) @@ -12271,6 +12343,7 @@ i32.const 10 i32.add call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $1 local.get $0 call $~lib/map/Map#has @@ -12360,6 +12433,7 @@ i32.const 20 i32.add call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $1 local.get $0 call $~lib/map/Map#has @@ -12462,6 +12536,7 @@ local.get $0 local.get $0 call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $6 local.get $3 i32.const 20 @@ -12469,6 +12544,7 @@ local.tee $3 local.get $3 call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $2 i32.const 1 i32.add @@ -12593,6 +12669,7 @@ i32.const 10 i32.add call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $1 local.get $0 call $~lib/map/Map#has diff --git a/tests/compiler/std/map.untouched.wat b/tests/compiler/std/map.untouched.wat index e3ec160c65..bf14613aa7 100644 --- a/tests/compiler/std/map.untouched.wat +++ b/tests/compiler/std/map.untouched.wat @@ -2,30 +2,27 @@ (type $i32_=>_i32 (func (param i32) (result i32))) (type $i32_i32_=>_none (func (param i32 i32))) (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) - (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) (type $i32_=>_none (func (param i32))) (type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32))) + (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) (type $none_=>_none (func)) (type $i32_i64_=>_i32 (func (param i32 i64) (result i32))) - (type $i32_i32_i64_=>_none (func (param i32 i32 i64))) (type $i32_i64_i32_=>_i32 (func (param i32 i64 i32) (result i32))) + (type $i32_i32_i64_=>_none (func (param i32 i32 i64))) (type $i32_i32_=>_i64 (func (param i32 i32) (result i64))) (type $i32_f32_=>_i32 (func (param i32 f32) (result i32))) + (type $i32_f32_i32_=>_i32 (func (param i32 f32 i32) (result i32))) (type $i32_f64_=>_i32 (func (param i32 f64) (result i32))) + (type $i32_f64_i32_=>_i32 (func (param i32 f64 i32) (result i32))) (type $i32_i32_f32_=>_none (func (param i32 i32 f32))) (type $i32_i32_f64_=>_none (func (param i32 i32 f64))) - (type $i32_i64_i32_=>_none (func (param i32 i64 i32))) - (type $i32_i64_i64_=>_none (func (param i32 i64 i64))) - (type $i32_f32_i32_=>_i32 (func (param i32 f32 i32) (result i32))) - (type $i32_f64_i32_=>_i32 (func (param i32 f64 i32) (result i32))) + (type $i32_i64_i64_=>_i32 (func (param i32 i64 i64) (result i32))) (type $i32_i32_=>_f32 (func (param i32 i32) (result f32))) (type $i32_i32_=>_f64 (func (param i32 i32) (result f64))) (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) - (type $i32_f32_i32_=>_none (func (param i32 f32 i32))) - (type $i32_f32_f32_=>_none (func (param i32 f32 f32))) - (type $i32_f64_i32_=>_none (func (param i32 f64 i32))) - (type $i32_f64_f64_=>_none (func (param i32 f64 f64))) (type $none_=>_i32 (func (result i32))) + (type $i32_f32_f32_=>_i32 (func (param i32 f32 f32) (result i32))) + (type $i32_f64_f64_=>_i32 (func (param i32 f64 f64) (result i32))) (type $i64_=>_i32 (func (param i64) (result i32))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) (import "rtrace" "onalloc" (func $~lib/rt/rtrace/onalloc (param i32))) @@ -2083,7 +2080,7 @@ local.get $5 call $~lib/rt/pure/__release ) - (func $~lib/map/Map#set (; 27 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/map/Map#set (; 27 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -2189,6 +2186,8 @@ local.get $3 call $~lib/rt/pure/__release end + local.get $0 + call $~lib/rt/pure/__retain ) (func $~lib/map/Map#get (; 28 ;) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) @@ -4496,7 +4495,7 @@ local.get $5 call $~lib/rt/pure/__release ) - (func $~lib/map/Map#set (; 59 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/map/Map#set (; 59 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -4602,6 +4601,8 @@ local.get $3 call $~lib/rt/pure/__release end + local.get $0 + call $~lib/rt/pure/__retain ) (func $~lib/util/hash/hash32 (; 60 ;) (param $0 i32) (result i32) (local $1 i32) @@ -4850,7 +4851,7 @@ local.get $5 call $~lib/rt/pure/__release ) - (func $~lib/map/Map#set (; 63 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/map/Map#set (; 63 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -4952,6 +4953,8 @@ local.get $3 call $~lib/rt/pure/__release end + local.get $0 + call $~lib/rt/pure/__retain ) (func $~lib/map/Map#get:size (; 64 ;) (param $0 i32) (result i32) local.get $0 @@ -5088,6 +5091,7 @@ i32.shr_s i32.add call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $0 local.get $1 call $~lib/map/Map#has @@ -5195,6 +5199,7 @@ i32.shr_s i32.add call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $0 local.get $1 call $~lib/map/Map#has @@ -5307,6 +5312,7 @@ local.get $9 local.get $9 call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $6 local.get $10 i32.const 20 @@ -5315,6 +5321,7 @@ i32.const 20 i32.sub call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $7 i32.const 1 i32.add @@ -5466,6 +5473,7 @@ i32.shr_s i32.add call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $0 local.get $7 call $~lib/map/Map#has @@ -5837,7 +5845,7 @@ local.get $5 call $~lib/rt/pure/__release ) - (func $~lib/map/Map#set (; 73 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/map/Map#set (; 73 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -5941,6 +5949,8 @@ local.get $3 call $~lib/rt/pure/__release end + local.get $0 + call $~lib/rt/pure/__retain ) (func $~lib/map/Map#get (; 74 ;) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) @@ -6496,7 +6506,7 @@ local.get $5 call $~lib/rt/pure/__release ) - (func $~lib/map/Map#set (; 89 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/map/Map#set (; 89 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -6600,6 +6610,8 @@ local.get $3 call $~lib/rt/pure/__release end + local.get $0 + call $~lib/rt/pure/__retain ) (func $~lib/map/Map#get:size (; 90 ;) (param $0 i32) (result i32) local.get $0 @@ -6726,6 +6738,7 @@ i32.and i32.add call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $0 local.get $1 call $~lib/map/Map#has @@ -6825,6 +6838,7 @@ i32.and i32.add call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $0 local.get $1 call $~lib/map/Map#has @@ -6935,6 +6949,7 @@ local.get $9 local.get $9 call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $6 local.get $10 i32.const 20 @@ -6943,6 +6958,7 @@ i32.const 20 i32.sub call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $7 i32.const 1 i32.add @@ -7086,6 +7102,7 @@ i32.and i32.add call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $0 local.get $7 call $~lib/map/Map#has @@ -7483,7 +7500,7 @@ local.get $5 call $~lib/rt/pure/__release ) - (func $~lib/map/Map#set (; 99 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/map/Map#set (; 99 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -7589,6 +7606,8 @@ local.get $3 call $~lib/rt/pure/__release end + local.get $0 + call $~lib/rt/pure/__retain ) (func $~lib/map/Map#get (; 100 ;) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) @@ -8148,7 +8167,7 @@ local.get $5 call $~lib/rt/pure/__release ) - (func $~lib/map/Map#set (; 115 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/map/Map#set (; 115 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -8254,6 +8273,8 @@ local.get $3 call $~lib/rt/pure/__release end + local.get $0 + call $~lib/rt/pure/__retain ) (func $~lib/map/Map#get:size (; 116 ;) (param $0 i32) (result i32) local.get $0 @@ -8386,6 +8407,7 @@ i32.shr_s i32.add call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $0 local.get $1 call $~lib/map/Map#has @@ -8493,6 +8515,7 @@ i32.shr_s i32.add call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $0 local.get $1 call $~lib/map/Map#has @@ -8605,6 +8628,7 @@ local.get $9 local.get $9 call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $6 local.get $10 i32.const 20 @@ -8613,6 +8637,7 @@ i32.const 20 i32.sub call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $7 i32.const 1 i32.add @@ -8764,6 +8789,7 @@ i32.shr_s i32.add call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $0 local.get $7 call $~lib/map/Map#has @@ -9135,7 +9161,7 @@ local.get $5 call $~lib/rt/pure/__release ) - (func $~lib/map/Map#set (; 124 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/map/Map#set (; 124 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -9239,6 +9265,8 @@ local.get $3 call $~lib/rt/pure/__release end + local.get $0 + call $~lib/rt/pure/__retain ) (func $~lib/map/Map#get (; 125 ;) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) @@ -9794,7 +9822,7 @@ local.get $5 call $~lib/rt/pure/__release ) - (func $~lib/map/Map#set (; 140 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/map/Map#set (; 140 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -9898,6 +9926,8 @@ local.get $3 call $~lib/rt/pure/__release end + local.get $0 + call $~lib/rt/pure/__retain ) (func $~lib/map/Map#get:size (; 141 ;) (param $0 i32) (result i32) local.get $0 @@ -10024,6 +10054,7 @@ i32.and i32.add call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $0 local.get $1 call $~lib/map/Map#has @@ -10123,6 +10154,7 @@ i32.and i32.add call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $0 local.get $1 call $~lib/map/Map#has @@ -10233,6 +10265,7 @@ local.get $9 local.get $9 call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $6 local.get $10 i32.const 20 @@ -10241,6 +10274,7 @@ i32.const 20 i32.sub call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $7 i32.const 1 i32.add @@ -10384,6 +10418,7 @@ i32.and i32.add call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $0 local.get $7 call $~lib/map/Map#has @@ -10748,6 +10783,7 @@ local.get $1 i32.add call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $0 local.get $1 call $~lib/map/Map#has @@ -10839,6 +10875,7 @@ local.get $1 i32.add call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $0 local.get $1 call $~lib/map/Map#has @@ -10947,6 +10984,7 @@ local.get $7 local.get $7 call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $4 local.get $8 i32.const 20 @@ -10955,6 +10993,7 @@ i32.const 20 i32.sub call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $5 i32.const 1 i32.add @@ -11090,6 +11129,7 @@ local.get $5 i32.add call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $0 local.get $5 call $~lib/map/Map#has @@ -11457,7 +11497,7 @@ local.get $5 call $~lib/rt/pure/__release ) - (func $~lib/map/Map#set (; 156 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/map/Map#set (; 156 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -11559,6 +11599,8 @@ local.get $3 call $~lib/rt/pure/__release end + local.get $0 + call $~lib/rt/pure/__retain ) (func $~lib/map/Map#get (; 157 ;) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) @@ -12110,7 +12152,7 @@ local.get $5 call $~lib/rt/pure/__release ) - (func $~lib/map/Map#set (; 172 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/map/Map#set (; 172 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -12212,6 +12254,8 @@ local.get $3 call $~lib/rt/pure/__release end + local.get $0 + call $~lib/rt/pure/__retain ) (func $~lib/map/Map#get:size (; 173 ;) (param $0 i32) (result i32) local.get $0 @@ -12330,6 +12374,7 @@ local.get $1 i32.add call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $0 local.get $1 call $~lib/map/Map#has @@ -12421,6 +12466,7 @@ local.get $1 i32.add call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $0 local.get $1 call $~lib/map/Map#has @@ -12529,6 +12575,7 @@ local.get $7 local.get $7 call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $4 local.get $8 i32.const 20 @@ -12537,6 +12584,7 @@ i32.const 20 i32.sub call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $5 i32.const 1 i32.add @@ -12672,6 +12720,7 @@ local.get $5 i32.add call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $0 local.get $5 call $~lib/map/Map#has @@ -13128,7 +13177,7 @@ local.get $5 call $~lib/rt/pure/__release ) - (func $~lib/map/Map#set (; 182 ;) (param $0 i32) (param $1 i64) (param $2 i32) + (func $~lib/map/Map#set (; 182 ;) (param $0 i32) (param $1 i64) (param $2 i32) (result i32) (local $3 i64) (local $4 i32) (local $5 i32) @@ -13231,6 +13280,8 @@ local.get $6 call $~lib/rt/pure/__release end + local.get $0 + call $~lib/rt/pure/__retain ) (func $~lib/map/Map#get (; 183 ;) (param $0 i32) (param $1 i64) (result i32) (local $2 i64) @@ -13783,7 +13834,7 @@ local.get $5 call $~lib/rt/pure/__release ) - (func $~lib/map/Map#set (; 198 ;) (param $0 i32) (param $1 i64) (param $2 i64) + (func $~lib/map/Map#set (; 198 ;) (param $0 i32) (param $1 i64) (param $2 i64) (result i32) (local $3 i64) (local $4 i32) (local $5 i32) @@ -13886,6 +13937,8 @@ local.get $6 call $~lib/rt/pure/__release end + local.get $0 + call $~lib/rt/pure/__retain ) (func $~lib/map/Map#get:size (; 199 ;) (param $0 i32) (result i32) local.get $0 @@ -14006,6 +14059,7 @@ i32.wrap_i64 i32.add call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $0 local.get $1 call $~lib/map/Map#has @@ -14100,6 +14154,7 @@ i32.wrap_i64 i32.add call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $0 local.get $1 call $~lib/map/Map#has @@ -14210,6 +14265,7 @@ local.get $1 local.get $1 call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $5 local.get $8 i32.const 20 @@ -14218,6 +14274,7 @@ i32.const 20 i32.sub call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $6 i32.const 1 i32.add @@ -14355,6 +14412,7 @@ i32.wrap_i64 i32.add call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $0 local.get $1 call $~lib/map/Map#has @@ -14723,7 +14781,7 @@ local.get $5 call $~lib/rt/pure/__release ) - (func $~lib/map/Map#set (; 207 ;) (param $0 i32) (param $1 i64) (param $2 i32) + (func $~lib/map/Map#set (; 207 ;) (param $0 i32) (param $1 i64) (param $2 i32) (result i32) (local $3 i64) (local $4 i32) (local $5 i32) @@ -14826,6 +14884,8 @@ local.get $6 call $~lib/rt/pure/__release end + local.get $0 + call $~lib/rt/pure/__retain ) (func $~lib/map/Map#get (; 208 ;) (param $0 i32) (param $1 i64) (result i32) (local $2 i64) @@ -15378,7 +15438,7 @@ local.get $5 call $~lib/rt/pure/__release ) - (func $~lib/map/Map#set (; 223 ;) (param $0 i32) (param $1 i64) (param $2 i64) + (func $~lib/map/Map#set (; 223 ;) (param $0 i32) (param $1 i64) (param $2 i64) (result i32) (local $3 i64) (local $4 i32) (local $5 i32) @@ -15481,6 +15541,8 @@ local.get $6 call $~lib/rt/pure/__release end + local.get $0 + call $~lib/rt/pure/__retain ) (func $~lib/map/Map#get:size (; 224 ;) (param $0 i32) (result i32) local.get $0 @@ -15601,6 +15663,7 @@ i32.wrap_i64 i32.add call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $0 local.get $1 call $~lib/map/Map#has @@ -15695,6 +15758,7 @@ i32.wrap_i64 i32.add call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $0 local.get $1 call $~lib/map/Map#has @@ -15805,6 +15869,7 @@ local.get $1 local.get $1 call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $5 local.get $8 i32.const 20 @@ -15813,6 +15878,7 @@ i32.const 20 i32.sub call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $6 i32.const 1 i32.add @@ -15950,6 +16016,7 @@ i32.wrap_i64 i32.add call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $0 local.get $1 call $~lib/map/Map#has @@ -16320,7 +16387,7 @@ local.get $5 call $~lib/rt/pure/__release ) - (func $~lib/map/Map#set (; 232 ;) (param $0 i32) (param $1 f32) (param $2 i32) + (func $~lib/map/Map#set (; 232 ;) (param $0 i32) (param $1 f32) (param $2 i32) (result i32) (local $3 f32) (local $4 i32) (local $5 i32) @@ -16424,6 +16491,8 @@ local.get $6 call $~lib/rt/pure/__release end + local.get $0 + call $~lib/rt/pure/__retain ) (func $~lib/map/Map#get (; 233 ;) (param $0 i32) (param $1 f32) (result i32) (local $2 f32) @@ -16978,7 +17047,7 @@ local.get $5 call $~lib/rt/pure/__release ) - (func $~lib/map/Map#set (; 248 ;) (param $0 i32) (param $1 f32) (param $2 f32) + (func $~lib/map/Map#set (; 248 ;) (param $0 i32) (param $1 f32) (param $2 f32) (result i32) (local $3 f32) (local $4 i32) (local $5 i32) @@ -17082,6 +17151,8 @@ local.get $6 call $~lib/rt/pure/__release end + local.get $0 + call $~lib/rt/pure/__retain ) (func $~lib/map/Map#get:size (; 249 ;) (param $0 i32) (result i32) local.get $0 @@ -17203,6 +17274,7 @@ i32.trunc_f32_s i32.add call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $0 local.get $1 call $~lib/map/Map#has @@ -17297,6 +17369,7 @@ i32.trunc_f32_s i32.add call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $0 local.get $1 call $~lib/map/Map#has @@ -17407,6 +17480,7 @@ local.get $1 local.get $1 call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $5 local.get $8 i32.const 20 @@ -17415,6 +17489,7 @@ i32.const 20 i32.sub call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $6 i32.const 1 i32.add @@ -17552,6 +17627,7 @@ i32.trunc_f32_s i32.add call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $0 local.get $1 call $~lib/map/Map#has @@ -17922,7 +17998,7 @@ local.get $5 call $~lib/rt/pure/__release ) - (func $~lib/map/Map#set (; 257 ;) (param $0 i32) (param $1 f64) (param $2 i32) + (func $~lib/map/Map#set (; 257 ;) (param $0 i32) (param $1 f64) (param $2 i32) (result i32) (local $3 f64) (local $4 i32) (local $5 i32) @@ -18026,6 +18102,8 @@ local.get $6 call $~lib/rt/pure/__release end + local.get $0 + call $~lib/rt/pure/__retain ) (func $~lib/map/Map#get (; 258 ;) (param $0 i32) (param $1 f64) (result i32) (local $2 f64) @@ -18580,7 +18658,7 @@ local.get $5 call $~lib/rt/pure/__release ) - (func $~lib/map/Map#set (; 273 ;) (param $0 i32) (param $1 f64) (param $2 f64) + (func $~lib/map/Map#set (; 273 ;) (param $0 i32) (param $1 f64) (param $2 f64) (result i32) (local $3 f64) (local $4 i32) (local $5 i32) @@ -18684,6 +18762,8 @@ local.get $6 call $~lib/rt/pure/__release end + local.get $0 + call $~lib/rt/pure/__retain ) (func $~lib/map/Map#get:size (; 274 ;) (param $0 i32) (result i32) local.get $0 @@ -18805,6 +18885,7 @@ i32.trunc_f64_s i32.add call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $0 local.get $1 call $~lib/map/Map#has @@ -18899,6 +18980,7 @@ i32.trunc_f64_s i32.add call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $0 local.get $1 call $~lib/map/Map#has @@ -19009,6 +19091,7 @@ local.get $1 local.get $1 call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $5 local.get $8 i32.const 20 @@ -19017,6 +19100,7 @@ i32.const 20 i32.sub call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $6 i32.const 1 i32.add @@ -19154,6 +19238,7 @@ i32.trunc_f64_s i32.add call $~lib/map/Map#set + call $~lib/rt/pure/__release local.get $0 local.get $1 call $~lib/map/Map#has diff --git a/tests/compiler/std/set.optimized.wat b/tests/compiler/std/set.optimized.wat index 65ac307eb2..733734f5a0 100644 --- a/tests/compiler/std/set.optimized.wat +++ b/tests/compiler/std/set.optimized.wat @@ -7,18 +7,18 @@ (type $none_=>_i32 (func (result i32))) (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) (type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32))) - (type $i32_i64_=>_none (func (param i32 i64))) - (type $i32_f32_=>_none (func (param i32 f32))) - (type $i32_f64_=>_none (func (param i32 f64))) + (type $i32_i64_=>_i32 (func (param i32 i64) (result i32))) + (type $i32_f32_=>_i32 (func (param i32 f32) (result i32))) + (type $i32_f64_=>_i32 (func (param i32 f64) (result i32))) (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) (type $i32_i32_i64_=>_none (func (param i32 i32 i64))) (type $i32_i32_f32_=>_none (func (param i32 i32 f32))) (type $i32_i32_f64_=>_none (func (param i32 i32 f64))) - (type $i32_i64_=>_i32 (func (param i32 i64) (result i32))) + (type $i32_i64_=>_none (func (param i32 i64))) + (type $i32_f32_=>_none (func (param i32 f32))) + (type $i32_f64_=>_none (func (param i32 f64))) (type $i32_i64_i32_=>_i32 (func (param i32 i64 i32) (result i32))) - (type $i32_f32_=>_i32 (func (param i32 f32) (result i32))) (type $i32_f32_i32_=>_i32 (func (param i32 f32 i32) (result i32))) - (type $i32_f64_=>_i32 (func (param i32 f64) (result i32))) (type $i32_f64_i32_=>_i32 (func (param i32 f64 i32) (result i32))) (type $i64_=>_i32 (func (param i64) (result i32))) (type $i32_i32_=>_i64 (func (param i32 i32) (result i64))) @@ -1624,7 +1624,7 @@ local.get $4 call $~lib/rt/pure/__release ) - (func $~lib/set/Set#add (; 27 ;) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#add (; 27 ;) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -1701,13 +1701,15 @@ i32.const 2 i32.shl i32.add - local.tee $0 + local.tee $1 i32.load i32.store offset=4 - local.get $0 + local.get $1 local.get $2 i32.store end + local.get $0 + call $~lib/rt/pure/__retain ) (func $~lib/arraybuffer/ArrayBufferView#constructor (; 28 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) @@ -2380,6 +2382,7 @@ local.get $1 local.get $0 call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $1 local.get $0 call $~lib/set/Set#has @@ -2437,6 +2440,7 @@ local.get $1 local.get $0 call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $1 local.get $0 call $~lib/set/Set#has @@ -2500,6 +2504,7 @@ local.get $0 call $~lib/array/Array#__get call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $0 i32.const 1 i32.add @@ -2601,6 +2606,7 @@ local.get $1 local.get $0 call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $1 local.get $0 call $~lib/set/Set#has @@ -2831,7 +2837,7 @@ local.get $4 call $~lib/rt/pure/__release ) - (func $~lib/set/Set#add (; 42 ;) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#add (; 42 ;) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -2906,13 +2912,15 @@ i32.const 2 i32.shl i32.add - local.tee $0 + local.tee $1 i32.load i32.store offset=4 - local.get $0 + local.get $1 local.get $2 i32.store end + local.get $0 + call $~lib/rt/pure/__retain ) (func $~lib/set/Set#values (; 43 ;) (param $0 i32) (result i32) (local $1 i32) @@ -3086,6 +3094,7 @@ local.get $1 local.get $0 call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $1 local.get $0 call $~lib/set/Set#has @@ -3141,6 +3150,7 @@ local.get $1 local.get $0 call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $1 local.get $0 call $~lib/set/Set#has @@ -3204,6 +3214,7 @@ local.get $0 call $~lib/array/Array#__get call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $0 i32.const 1 i32.add @@ -3301,6 +3312,7 @@ local.get $1 local.get $0 call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $1 local.get $0 call $~lib/set/Set#has @@ -3591,7 +3603,7 @@ local.get $4 call $~lib/rt/pure/__release ) - (func $~lib/set/Set#add (; 52 ;) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#add (; 52 ;) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -3668,13 +3680,15 @@ i32.const 2 i32.shl i32.add - local.tee $0 + local.tee $1 i32.load i32.store offset=4 - local.get $0 + local.get $1 local.get $2 i32.store end + local.get $0 + call $~lib/rt/pure/__retain ) (func $~lib/array/Array#__set (; 53 ;) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) @@ -3892,6 +3906,7 @@ local.get $1 local.get $0 call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $1 local.get $0 call $~lib/set/Set#has @@ -3949,6 +3964,7 @@ local.get $1 local.get $0 call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $1 local.get $0 call $~lib/set/Set#has @@ -4012,6 +4028,7 @@ local.get $0 call $~lib/array/Array#__get call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $0 i32.const 1 i32.add @@ -4113,6 +4130,7 @@ local.get $1 local.get $0 call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $1 local.get $0 call $~lib/set/Set#has @@ -4343,7 +4361,7 @@ local.get $4 call $~lib/rt/pure/__release ) - (func $~lib/set/Set#add (; 61 ;) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#add (; 61 ;) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4418,13 +4436,15 @@ i32.const 2 i32.shl i32.add - local.tee $0 + local.tee $1 i32.load i32.store offset=4 - local.get $0 + local.get $1 local.get $2 i32.store end + local.get $0 + call $~lib/rt/pure/__retain ) (func $~lib/set/Set#values (; 62 ;) (param $0 i32) (result i32) (local $1 i32) @@ -4600,6 +4620,7 @@ local.get $1 local.get $0 call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $1 local.get $0 call $~lib/set/Set#has @@ -4655,6 +4676,7 @@ local.get $1 local.get $0 call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $1 local.get $0 call $~lib/set/Set#has @@ -4718,6 +4740,7 @@ local.get $0 call $~lib/array/Array#__get call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $0 i32.const 1 i32.add @@ -4815,6 +4838,7 @@ local.get $1 local.get $0 call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $1 local.get $0 call $~lib/set/Set#has @@ -5115,7 +5139,7 @@ local.get $4 call $~lib/rt/pure/__release ) - (func $~lib/set/Set#add (; 71 ;) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#add (; 71 ;) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -5188,13 +5212,15 @@ i32.const 2 i32.shl i32.add - local.tee $0 + local.tee $1 i32.load i32.store offset=4 - local.get $0 + local.get $1 local.get $2 i32.store end + local.get $0 + call $~lib/rt/pure/__retain ) (func $~lib/array/Array#__set (; 72 ;) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) @@ -5404,6 +5430,7 @@ local.get $1 local.get $0 call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $1 local.get $0 call $~lib/set/Set#has @@ -5457,6 +5484,7 @@ local.get $1 local.get $0 call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $1 local.get $0 call $~lib/set/Set#has @@ -5520,6 +5548,7 @@ local.get $0 call $~lib/array/Array#__get call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $0 i32.const 1 i32.add @@ -5613,6 +5642,7 @@ local.get $1 local.get $0 call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $1 local.get $0 call $~lib/set/Set#has @@ -5795,6 +5825,7 @@ local.get $1 local.get $0 call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $1 local.get $0 call $~lib/set/Set#has @@ -5848,6 +5879,7 @@ local.get $1 local.get $0 call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $1 local.get $0 call $~lib/set/Set#has @@ -5911,6 +5943,7 @@ local.get $0 call $~lib/array/Array#__get call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $0 i32.const 1 i32.add @@ -6004,6 +6037,7 @@ local.get $1 local.get $0 call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $1 local.get $0 call $~lib/set/Set#has @@ -6372,7 +6406,7 @@ local.get $4 call $~lib/rt/pure/__release ) - (func $~lib/set/Set#add (; 86 ;) (param $0 i32) (param $1 i64) + (func $~lib/set/Set#add (; 86 ;) (param $0 i32) (param $1 i64) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -6445,13 +6479,15 @@ i32.const 2 i32.shl i32.add - local.tee $0 + local.tee $3 i32.load i32.store offset=8 - local.get $0 + local.get $3 local.get $2 i32.store end + local.get $0 + call $~lib/rt/pure/__retain ) (func $~lib/array/Array#__set (; 87 ;) (param $0 i32) (param $1 i32) (param $2 i64) (local $3 i32) @@ -6663,6 +6699,7 @@ local.get $1 local.get $0 call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $1 local.get $0 call $~lib/set/Set#has @@ -6716,6 +6753,7 @@ local.get $1 local.get $0 call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $1 local.get $0 call $~lib/set/Set#has @@ -6777,6 +6815,7 @@ local.get $3 call $~lib/array/Array#__get call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $3 i32.const 1 i32.add @@ -6870,6 +6909,7 @@ local.get $1 local.get $0 call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $1 local.get $0 call $~lib/set/Set#has @@ -7053,6 +7093,7 @@ local.get $1 local.get $0 call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $1 local.get $0 call $~lib/set/Set#has @@ -7106,6 +7147,7 @@ local.get $1 local.get $0 call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $1 local.get $0 call $~lib/set/Set#has @@ -7167,6 +7209,7 @@ local.get $3 call $~lib/array/Array#__get call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $3 i32.const 1 i32.add @@ -7260,6 +7303,7 @@ local.get $1 local.get $0 call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $1 local.get $0 call $~lib/set/Set#has @@ -7531,7 +7575,7 @@ local.get $4 call $~lib/rt/pure/__release ) - (func $~lib/set/Set#add (; 99 ;) (param $0 i32) (param $1 f32) + (func $~lib/set/Set#add (; 99 ;) (param $0 i32) (param $1 f32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -7605,13 +7649,15 @@ i32.const 2 i32.shl i32.add - local.tee $0 + local.tee $3 i32.load i32.store offset=4 - local.get $0 + local.get $3 local.get $2 i32.store end + local.get $0 + call $~lib/rt/pure/__retain ) (func $~lib/array/Array#__set (; 100 ;) (param $0 i32) (param $1 i32) (param $2 f32) (local $3 i32) @@ -7824,6 +7870,7 @@ local.get $1 local.get $0 call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $1 local.get $0 call $~lib/set/Set#has @@ -7877,6 +7924,7 @@ local.get $1 local.get $0 call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $1 local.get $0 call $~lib/set/Set#has @@ -7938,6 +7986,7 @@ local.get $3 call $~lib/array/Array#__get call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $3 i32.const 1 i32.add @@ -8031,6 +8080,7 @@ local.get $1 local.get $0 call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $1 local.get $0 call $~lib/set/Set#has @@ -8302,7 +8352,7 @@ local.get $4 call $~lib/rt/pure/__release ) - (func $~lib/set/Set#add (; 109 ;) (param $0 i32) (param $1 f64) + (func $~lib/set/Set#add (; 109 ;) (param $0 i32) (param $1 f64) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -8376,13 +8426,15 @@ i32.const 2 i32.shl i32.add - local.tee $0 + local.tee $3 i32.load i32.store offset=8 - local.get $0 + local.get $3 local.get $2 i32.store end + local.get $0 + call $~lib/rt/pure/__retain ) (func $~lib/array/Array#__set (; 110 ;) (param $0 i32) (param $1 i32) (param $2 f64) (local $3 i32) @@ -8595,6 +8647,7 @@ local.get $1 local.get $0 call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $1 local.get $0 call $~lib/set/Set#has @@ -8648,6 +8701,7 @@ local.get $1 local.get $0 call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $1 local.get $0 call $~lib/set/Set#has @@ -8709,6 +8763,7 @@ local.get $3 call $~lib/array/Array#__get call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $3 i32.const 1 i32.add @@ -8802,6 +8857,7 @@ local.get $1 local.get $0 call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $1 local.get $0 call $~lib/set/Set#has diff --git a/tests/compiler/std/set.untouched.wat b/tests/compiler/std/set.untouched.wat index 6ce1bac741..abd9db320b 100644 --- a/tests/compiler/std/set.untouched.wat +++ b/tests/compiler/std/set.untouched.wat @@ -1,25 +1,22 @@ (module (type $i32_=>_i32 (func (param i32) (result i32))) - (type $i32_i32_=>_none (func (param i32 i32))) (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) + (type $i32_i32_=>_none (func (param i32 i32))) (type $i32_=>_none (func (param i32))) (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) (type $none_=>_none (func)) (type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32))) - (type $i32_i32_i64_=>_none (func (param i32 i32 i64))) (type $i32_i64_=>_i32 (func (param i32 i64) (result i32))) + (type $i32_i32_i64_=>_none (func (param i32 i32 i64))) (type $i32_i32_=>_i64 (func (param i32 i32) (result i64))) + (type $i32_f32_=>_i32 (func (param i32 f32) (result i32))) + (type $i32_f64_=>_i32 (func (param i32 f64) (result i32))) (type $i32_i32_f32_=>_none (func (param i32 i32 f32))) (type $i32_i32_f64_=>_none (func (param i32 i32 f64))) - (type $i32_i64_=>_none (func (param i32 i64))) (type $i32_i64_i32_=>_i32 (func (param i32 i64 i32) (result i32))) - (type $i32_f32_=>_i32 (func (param i32 f32) (result i32))) - (type $i32_f64_=>_i32 (func (param i32 f64) (result i32))) (type $i32_i32_=>_f32 (func (param i32 i32) (result f32))) (type $i32_i32_=>_f64 (func (param i32 i32) (result f64))) (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) - (type $i32_f32_=>_none (func (param i32 f32))) - (type $i32_f64_=>_none (func (param i32 f64))) (type $none_=>_i32 (func (result i32))) (type $i32_f32_i32_=>_i32 (func (param i32 f32 i32) (result i32))) (type $i32_f64_i32_=>_i32 (func (param i32 f64 i32) (result i32))) @@ -2074,7 +2071,7 @@ local.get $5 call $~lib/rt/pure/__release ) - (func $~lib/set/Set#add (; 27 ;) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#add (; 27 ;) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -2168,6 +2165,8 @@ local.get $4 i32.store end + local.get $0 + call $~lib/rt/pure/__retain ) (func $~lib/set/Set#get:size (; 28 ;) (param $0 i32) (result i32) local.get $0 @@ -4020,6 +4019,7 @@ local.get $0 local.get $1 call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $0 local.get $1 call $~lib/set/Set#has @@ -4080,6 +4080,7 @@ local.get $0 local.get $1 call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $0 local.get $1 call $~lib/set/Set#has @@ -4147,6 +4148,7 @@ local.get $5 call $~lib/array/Array#__get call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $5 i32.const 1 i32.add @@ -4259,6 +4261,7 @@ local.get $0 local.get $5 call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $0 local.get $5 call $~lib/set/Set#has @@ -4622,7 +4625,7 @@ local.get $5 call $~lib/rt/pure/__release ) - (func $~lib/set/Set#add (; 51 ;) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#add (; 51 ;) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4714,6 +4717,8 @@ local.get $4 i32.store end + local.get $0 + call $~lib/rt/pure/__retain ) (func $~lib/set/Set#get:size (; 52 ;) (param $0 i32) (result i32) local.get $0 @@ -4994,6 +4999,7 @@ local.get $0 local.get $1 call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $0 local.get $1 call $~lib/set/Set#has @@ -5052,6 +5058,7 @@ local.get $0 local.get $1 call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $0 local.get $1 call $~lib/set/Set#has @@ -5119,6 +5126,7 @@ local.get $5 call $~lib/array/Array#__get call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $5 i32.const 1 i32.add @@ -5227,6 +5235,7 @@ local.get $0 local.get $5 call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $0 local.get $5 call $~lib/set/Set#has @@ -5616,7 +5625,7 @@ local.get $5 call $~lib/rt/pure/__release ) - (func $~lib/set/Set#add (; 68 ;) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#add (; 68 ;) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -5710,6 +5719,8 @@ local.get $4 i32.store end + local.get $0 + call $~lib/rt/pure/__retain ) (func $~lib/set/Set#get:size (; 69 ;) (param $0 i32) (result i32) local.get $0 @@ -5994,6 +6005,7 @@ local.get $0 local.get $1 call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $0 local.get $1 call $~lib/set/Set#has @@ -6054,6 +6066,7 @@ local.get $0 local.get $1 call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $0 local.get $1 call $~lib/set/Set#has @@ -6121,6 +6134,7 @@ local.get $5 call $~lib/array/Array#__get call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $5 i32.const 1 i32.add @@ -6233,6 +6247,7 @@ local.get $0 local.get $5 call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $0 local.get $5 call $~lib/set/Set#has @@ -6596,7 +6611,7 @@ local.get $5 call $~lib/rt/pure/__release ) - (func $~lib/set/Set#add (; 84 ;) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#add (; 84 ;) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -6688,6 +6703,8 @@ local.get $4 i32.store end + local.get $0 + call $~lib/rt/pure/__retain ) (func $~lib/set/Set#get:size (; 85 ;) (param $0 i32) (result i32) local.get $0 @@ -6968,6 +6985,7 @@ local.get $0 local.get $1 call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $0 local.get $1 call $~lib/set/Set#has @@ -7026,6 +7044,7 @@ local.get $0 local.get $1 call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $0 local.get $1 call $~lib/set/Set#has @@ -7093,6 +7112,7 @@ local.get $5 call $~lib/array/Array#__get call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $5 i32.const 1 i32.add @@ -7201,6 +7221,7 @@ local.get $0 local.get $5 call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $0 local.get $5 call $~lib/set/Set#has @@ -7602,7 +7623,7 @@ local.get $5 call $~lib/rt/pure/__release ) - (func $~lib/set/Set#add (; 101 ;) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#add (; 101 ;) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -7692,6 +7713,8 @@ local.get $4 i32.store end + local.get $0 + call $~lib/rt/pure/__retain ) (func $~lib/set/Set#get:size (; 102 ;) (param $0 i32) (result i32) local.get $0 @@ -7964,6 +7987,7 @@ local.get $0 local.get $1 call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $0 local.get $1 call $~lib/set/Set#has @@ -8020,6 +8044,7 @@ local.get $0 local.get $1 call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $0 local.get $1 call $~lib/set/Set#has @@ -8087,6 +8112,7 @@ local.get $3 call $~lib/array/Array#__get call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $3 i32.const 1 i32.add @@ -8191,6 +8217,7 @@ local.get $0 local.get $3 call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $0 local.get $3 call $~lib/set/Set#has @@ -8550,7 +8577,7 @@ local.get $5 call $~lib/rt/pure/__release ) - (func $~lib/set/Set#add (; 117 ;) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#add (; 117 ;) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -8640,6 +8667,8 @@ local.get $4 i32.store end + local.get $0 + call $~lib/rt/pure/__retain ) (func $~lib/set/Set#get:size (; 118 ;) (param $0 i32) (result i32) local.get $0 @@ -8912,6 +8941,7 @@ local.get $0 local.get $1 call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $0 local.get $1 call $~lib/set/Set#has @@ -8968,6 +8998,7 @@ local.get $0 local.get $1 call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $0 local.get $1 call $~lib/set/Set#has @@ -9035,6 +9066,7 @@ local.get $3 call $~lib/array/Array#__get call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $3 i32.const 1 i32.add @@ -9139,6 +9171,7 @@ local.get $0 local.get $3 call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $0 local.get $3 call $~lib/set/Set#has @@ -9587,7 +9620,7 @@ local.get $5 call $~lib/rt/pure/__release ) - (func $~lib/set/Set#add (; 134 ;) (param $0 i32) (param $1 i64) + (func $~lib/set/Set#add (; 134 ;) (param $0 i32) (param $1 i64) (result i32) (local $2 i64) (local $3 i32) (local $4 i32) @@ -9678,6 +9711,8 @@ local.get $4 i32.store end + local.get $0 + call $~lib/rt/pure/__retain ) (func $~lib/set/Set#get:size (; 135 ;) (param $0 i32) (result i32) local.get $0 @@ -9952,6 +9987,7 @@ local.get $0 local.get $1 call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $0 local.get $1 call $~lib/set/Set#has @@ -10008,6 +10044,7 @@ local.get $0 local.get $1 call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $0 local.get $1 call $~lib/set/Set#has @@ -10075,6 +10112,7 @@ local.get $4 call $~lib/array/Array#__get call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $4 i32.const 1 i32.add @@ -10179,6 +10217,7 @@ local.get $0 local.get $1 call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $0 local.get $1 call $~lib/set/Set#has @@ -10539,7 +10578,7 @@ local.get $5 call $~lib/rt/pure/__release ) - (func $~lib/set/Set#add (; 150 ;) (param $0 i32) (param $1 i64) + (func $~lib/set/Set#add (; 150 ;) (param $0 i32) (param $1 i64) (result i32) (local $2 i64) (local $3 i32) (local $4 i32) @@ -10630,6 +10669,8 @@ local.get $4 i32.store end + local.get $0 + call $~lib/rt/pure/__retain ) (func $~lib/set/Set#get:size (; 151 ;) (param $0 i32) (result i32) local.get $0 @@ -10904,6 +10945,7 @@ local.get $0 local.get $1 call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $0 local.get $1 call $~lib/set/Set#has @@ -10960,6 +11002,7 @@ local.get $0 local.get $1 call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $0 local.get $1 call $~lib/set/Set#has @@ -11027,6 +11070,7 @@ local.get $4 call $~lib/array/Array#__get call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $4 i32.const 1 i32.add @@ -11131,6 +11175,7 @@ local.get $0 local.get $1 call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $0 local.get $1 call $~lib/set/Set#has @@ -11493,7 +11538,7 @@ local.get $5 call $~lib/rt/pure/__release ) - (func $~lib/set/Set#add (; 166 ;) (param $0 i32) (param $1 f32) + (func $~lib/set/Set#add (; 166 ;) (param $0 i32) (param $1 f32) (result i32) (local $2 f32) (local $3 i32) (local $4 i32) @@ -11585,6 +11630,8 @@ local.get $4 i32.store end + local.get $0 + call $~lib/rt/pure/__retain ) (func $~lib/set/Set#get:size (; 167 ;) (param $0 i32) (result i32) local.get $0 @@ -11860,6 +11907,7 @@ local.get $0 local.get $1 call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $0 local.get $1 call $~lib/set/Set#has @@ -11916,6 +11964,7 @@ local.get $0 local.get $1 call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $0 local.get $1 call $~lib/set/Set#has @@ -11983,6 +12032,7 @@ local.get $4 call $~lib/array/Array#__get call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $4 i32.const 1 i32.add @@ -12087,6 +12137,7 @@ local.get $0 local.get $1 call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $0 local.get $1 call $~lib/set/Set#has @@ -12449,7 +12500,7 @@ local.get $5 call $~lib/rt/pure/__release ) - (func $~lib/set/Set#add (; 182 ;) (param $0 i32) (param $1 f64) + (func $~lib/set/Set#add (; 182 ;) (param $0 i32) (param $1 f64) (result i32) (local $2 f64) (local $3 i32) (local $4 i32) @@ -12541,6 +12592,8 @@ local.get $4 i32.store end + local.get $0 + call $~lib/rt/pure/__retain ) (func $~lib/set/Set#get:size (; 183 ;) (param $0 i32) (result i32) local.get $0 @@ -12816,6 +12869,7 @@ local.get $0 local.get $1 call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $0 local.get $1 call $~lib/set/Set#has @@ -12872,6 +12926,7 @@ local.get $0 local.get $1 call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $0 local.get $1 call $~lib/set/Set#has @@ -12939,6 +12994,7 @@ local.get $4 call $~lib/array/Array#__get call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $4 i32.const 1 i32.add @@ -13043,6 +13099,7 @@ local.get $0 local.get $1 call $~lib/set/Set#add + call $~lib/rt/pure/__release local.get $0 local.get $1 call $~lib/set/Set#has diff --git a/tests/compiler/std/symbol.untouched.wat b/tests/compiler/std/symbol.untouched.wat index 51d30d5d49..341895a2af 100644 --- a/tests/compiler/std/symbol.untouched.wat +++ b/tests/compiler/std/symbol.untouched.wat @@ -1,11 +1,11 @@ (module (type $i32_=>_i32 (func (param i32) (result i32))) (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) - (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) (type $i32_=>_none (func (param i32))) + (type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32))) + (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) (type $none_=>_none (func)) (type $i32_i32_=>_none (func (param i32 i32))) - (type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32))) (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) (type $i32_i32_i32_i32_i32_=>_i32 (func (param i32 i32 i32 i32 i32) (result i32))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) @@ -1172,7 +1172,7 @@ local.get $5 call $~lib/rt/stub/__release ) - (func $~lib/map/Map<~lib/string/String,usize>#set (; 20 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/map/Map<~lib/string/String,usize>#set (; 20 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -1283,8 +1283,12 @@ local.get $3 call $~lib/rt/stub/__release end + local.get $0 + call $~lib/rt/stub/__retain + local.set $4 local.get $1 call $~lib/rt/stub/__release + local.get $4 ) (func $~lib/util/hash/hash32 (; 21 ;) (param $0 i32) (result i32) (local $1 i32) @@ -1533,7 +1537,7 @@ local.get $5 call $~lib/rt/stub/__release ) - (func $~lib/map/Map#set (; 24 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/map/Map#set (; 24 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -1650,8 +1654,12 @@ local.get $3 call $~lib/rt/stub/__release end + local.get $0 + call $~lib/rt/stub/__retain + local.set $6 local.get $2 call $~lib/rt/stub/__release + local.get $6 ) (func $~lib/symbol/_Symbol.for (; 25 ;) (param $0 i32) (result i32) (local $1 i32) @@ -1707,10 +1715,12 @@ local.get $0 local.get $2 call $~lib/map/Map<~lib/string/String,usize>#set + call $~lib/rt/stub/__release global.get $~lib/symbol/idToString local.get $2 local.get $0 call $~lib/map/Map#set + call $~lib/rt/stub/__release local.get $2 local.set $1 local.get $0