Skip to content

Commit e9094bb

Browse files
committed
Fix TLSF test
1 parent 47f2e09 commit e9094bb

File tree

7 files changed

+575
-595
lines changed

7 files changed

+575
-595
lines changed

std/assembly/allocator/tlsf.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ export function allocate_memory(size: usize): usize {
480480
}
481481

482482
assert((block.info & ~TAGS) >= size);
483-
data = root.use(block, size);
483+
data = root.use(<Block>block, size);
484484
}
485485

486486
return data;

tests/allocators/arena/optimized.wat

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
(type $v (func))
55
(global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0))
66
(global $~lib/allocator/arena/offset (mut i32) (i32.const 0))
7-
(global $HEAP_BASE i32 (i32.const 4))
7+
(global $HEAP_BASE i32 (i32.const 8))
88
(memory $0 1)
99
(export "allocate_memory" (func $~lib/allocator/arena/allocate_memory))
1010
(export "free_memory" (func $~lib/allocator/arena/free_memory))
@@ -38,7 +38,7 @@
3838
;;@ ~lib/allocator/arena.ts:22:8
3939
(i32.gt_u
4040
;;@ ~lib/allocator/arena.ts:20:4
41-
(tee_local $2
41+
(tee_local $0
4242
;;@ ~lib/allocator/arena.ts:20:17
4343
(i32.and
4444
(i32.add
@@ -61,7 +61,7 @@
6161
;;@ ~lib/allocator/arena.ts:22:17
6262
(i32.shl
6363
;;@ ~lib/allocator/arena.ts:21:4
64-
(tee_local $0
64+
(tee_local $2
6565
;;@ ~lib/allocator/arena.ts:21:22
6666
(current_memory)
6767
)
@@ -77,7 +77,7 @@
7777
;;@ ~lib/allocator/arena.ts:24:24
7878
(select
7979
;;@ ~lib/allocator/arena.ts:24:28
80-
(get_local $0)
80+
(get_local $2)
8181
(tee_local $4
8282
;;@ ~lib/allocator/arena.ts:23:6
8383
(tee_local $3
@@ -88,7 +88,7 @@
8888
(i32.add
8989
;;@ ~lib/allocator/arena.ts:23:26
9090
(i32.sub
91-
(get_local $2)
91+
(get_local $0)
9292
;;@ ~lib/allocator/arena.ts:23:35
9393
(get_local $1)
9494
)
@@ -103,15 +103,15 @@
103103
)
104104
)
105105
(i32.gt_s
106-
(get_local $0)
106+
(get_local $2)
107107
(get_local $4)
108108
)
109109
)
110110
)
111111
;;@ ~lib/allocator/arena.ts:25:37
112112
(i32.const 0)
113113
)
114-
;;@ ~lib/allocator/arena.ts:26:8
114+
;;@ ~lib/allocator/arena.ts:25:40
115115
(if
116116
;;@ ~lib/allocator/arena.ts:26:12
117117
(i32.lt_s
@@ -122,15 +122,15 @@
122122
;;@ ~lib/allocator/arena.ts:26:39
123123
(i32.const 0)
124124
)
125-
;;@ ~lib/allocator/arena.ts:27:10
125+
;;@ ~lib/allocator/arena.ts:26:42
126126
(unreachable)
127127
)
128128
)
129129
)
130130
;;@ ~lib/allocator/arena.ts:31:4
131131
(set_global $~lib/allocator/arena/offset
132132
;;@ ~lib/allocator/arena.ts:31:13
133-
(get_local $2)
133+
(get_local $0)
134134
)
135135
;;@ ~lib/allocator/arena.ts:32:11
136136
(return
@@ -146,7 +146,7 @@
146146
(nop)
147147
)
148148
(func $~lib/allocator/arena/reset_memory (; 2 ;) (type $v)
149-
;;@ ~lib/allocator/arena.ts:44:2
149+
;;@ ~lib/allocator/arena.ts:43:37
150150
(set_global $~lib/allocator/arena/offset
151151
;;@ ~lib/allocator/arena.ts:44:11
152152
(get_global $~lib/allocator/arena/startOffset)

tests/allocators/arena/untouched.wat

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
(module
2-
(type $i (func (result i32)))
32
(type $ii (func (param i32) (result i32)))
43
(type $iv (func (param i32)))
54
(type $v (func))
@@ -9,7 +8,7 @@
98
(global $~lib/internal/allocator/MAX_SIZE_32 i32 (i32.const 1073741824))
109
(global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0))
1110
(global $~lib/allocator/arena/offset (mut i32) (i32.const 0))
12-
(global $HEAP_BASE i32 (i32.const 4))
11+
(global $HEAP_BASE i32 (i32.const 8))
1312
(memory $0 1)
1413
(export "allocate_memory" (func $~lib/allocator/arena/allocate_memory))
1514
(export "free_memory" (func $~lib/allocator/arena/free_memory))
@@ -142,7 +141,7 @@
142141
;;@ ~lib/allocator/arena.ts:25:37
143142
(i32.const 0)
144143
)
145-
;;@ ~lib/allocator/arena.ts:26:8
144+
;;@ ~lib/allocator/arena.ts:25:40
146145
(if
147146
;;@ ~lib/allocator/arena.ts:26:12
148147
(i32.lt_s
@@ -153,7 +152,7 @@
153152
;;@ ~lib/allocator/arena.ts:26:39
154153
(i32.const 0)
155154
)
156-
;;@ ~lib/allocator/arena.ts:27:10
155+
;;@ ~lib/allocator/arena.ts:26:42
157156
(unreachable)
158157
)
159158
)
@@ -176,9 +175,11 @@
176175
)
177176
)
178177
(func $~lib/allocator/arena/free_memory (; 1 ;) (type $iv) (param $0 i32)
178+
;;@ ~lib/allocator/arena.ts:38:46
179+
(nop)
179180
)
180181
(func $~lib/allocator/arena/reset_memory (; 2 ;) (type $v)
181-
;;@ ~lib/allocator/arena.ts:44:2
182+
;;@ ~lib/allocator/arena.ts:43:37
182183
(set_global $~lib/allocator/arena/offset
183184
;;@ ~lib/allocator/arena.ts:44:11
184185
(get_global $~lib/allocator/arena/startOffset)

tests/allocators/buddy/optimized.wat

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
(global $~lib/allocator/buddy/NODE_IS_SPLIT_END (mut i32) (i32.const 0))
1212
(global $~lib/allocator/buddy/base_ptr (mut i32) (i32.const 0))
1313
(global $~lib/allocator/buddy/max_ptr (mut i32) (i32.const 0))
14-
(global $HEAP_BASE i32 (i32.const 4))
14+
(global $HEAP_BASE i32 (i32.const 8))
1515
(memory $0 1)
1616
(export "allocate_memory" (func $~lib/allocator/buddy/allocate_memory))
1717
(export "free_memory" (func $~lib/allocator/buddy/free_memory))
@@ -62,8 +62,9 @@
6262
;;@ ~lib/allocator/buddy.ts:182:43
6363
(i32.const 0)
6464
)
65-
;;@ ~lib/allocator/buddy.ts:183:13
65+
;;@ ~lib/allocator/buddy.ts:182:46
6666
(return
67+
;;@ ~lib/allocator/buddy.ts:183:13
6768
(i32.const 0)
6869
)
6970
)
@@ -479,8 +480,9 @@
479480
)
480481
)
481482
)
482-
;;@ ~lib/allocator/buddy.ts:323:13
483+
;;@ ~lib/allocator/buddy.ts:322:50
483484
(return
485+
;;@ ~lib/allocator/buddy.ts:323:13
484486
(i32.const 0)
485487
)
486488
)
@@ -527,7 +529,7 @@
527529
(i32.const 2)
528530
)
529531
)
530-
;;@ ~lib/allocator/buddy.ts:334:6
532+
;;@ ~lib/allocator/buddy.ts:333:19
531533
(call $~lib/allocator/buddy/flip_parent_is_split
532534
;;@ ~lib/allocator/buddy.ts:334:27
533535
(get_local $1)
@@ -634,8 +636,9 @@
634636
)
635637
)
636638
)
637-
;;@ ~lib/allocator/buddy.ts:363:13
639+
;;@ ~lib/allocator/buddy.ts:362:47
638640
(return
641+
;;@ ~lib/allocator/buddy.ts:363:13
639642
(i32.const 0)
640643
)
641644
)
@@ -694,8 +697,9 @@
694697
(get_local $1)
695698
)
696699
)
697-
;;@ ~lib/allocator/buddy.ts:390:13
700+
;;@ ~lib/allocator/buddy.ts:389:37
698701
(return
702+
;;@ ~lib/allocator/buddy.ts:390:13
699703
(i32.const 0)
700704
)
701705
)
@@ -761,8 +765,9 @@
761765
)
762766
)
763767
)
764-
;;@ ~lib/allocator/buddy.ts:416:15
768+
;;@ ~lib/allocator/buddy.ts:415:43
765769
(return
770+
;;@ ~lib/allocator/buddy.ts:416:15
766771
(i32.const 0)
767772
)
768773
)
@@ -855,7 +860,7 @@
855860
(get_local $1)
856861
)
857862
)
858-
;;@ ~lib/allocator/buddy.ts:445:6
863+
;;@ ~lib/allocator/buddy.ts:444:16
859864
(call $~lib/allocator/buddy/flip_parent_is_split
860865
;;@ ~lib/allocator/buddy.ts:445:27
861866
(get_local $3)
@@ -946,7 +951,7 @@
946951
;;@ ~lib/allocator/buddy.ts:483:7
947952
(get_local $0)
948953
)
949-
;;@ ~lib/allocator/buddy.ts:484:4
954+
;;@ ~lib/allocator/buddy.ts:483:12
950955
(return)
951956
)
952957
;;@ ~lib/allocator/buddy.ts:493:2
@@ -993,7 +998,7 @@
993998
;;@ ~lib/allocator/buddy.ts:507:25
994999
(get_local $0)
9951000
)
996-
;;@ ~lib/allocator/buddy.ts:518:6
1001+
;;@ ~lib/allocator/buddy.ts:517:54
9971002
(br_if $break|0
9981003
;;@ ~lib/allocator/buddy.ts:517:8
9991004
(if (result i32)

0 commit comments

Comments
 (0)