From dd2bdd0383aae1d1e2d76fce6a5442f6cbeecf43 Mon Sep 17 00:00:00 2001 From: dcode Date: Thu, 18 Apr 2019 20:44:22 +0200 Subject: [PATCH] load/store Block --- std/assembly/rt/tlsf.ts | 12 +++++------ tests/runtime/optimized.wat | 2 +- tests/runtime/untouched.wasm | Bin 4786 -> 4786 bytes tests/runtime/untouched.wat | 40 +++++++++++++++++------------------ 4 files changed, 26 insertions(+), 28 deletions(-) diff --git a/std/assembly/rt/tlsf.ts b/std/assembly/rt/tlsf.ts index 6fecf19d..8915ded0 100644 --- a/std/assembly/rt/tlsf.ts +++ b/std/assembly/rt/tlsf.ts @@ -165,20 +165,18 @@ import { AL_BITS, AL_SIZE, AL_MASK, DEBUG, CommonBlock } from "./common"; /** Gets the head of the free list for the specified combination of first and second level. */ // @ts-ignore: decorator @inline function GETHEAD(root: Root, fl: usize, sl: u32): Block | null { - return changetype( - load( - changetype(root) + (((fl << SL_BITS) + sl) << alignof()), - HL_START - ) + return load( + changetype(root) + (((fl << SL_BITS) + sl) << alignof()), + HL_START ); } /** Sets the head of the free list for the specified combination of first and second level. */ // @ts-ignore: decorator @inline function SETHEAD(root: Root, fl: usize, sl: u32, head: Block | null): void { - store( + store( changetype(root) + (((fl << SL_BITS) + sl) << alignof()), - changetype(head), + head, HL_START ); } diff --git a/tests/runtime/optimized.wat b/tests/runtime/optimized.wat index 2c4599d2..2a9ad398 100644 --- a/tests/runtime/optimized.wat +++ b/tests/runtime/optimized.wat @@ -517,7 +517,7 @@ if i32.const 0 i32.const 24 - i32.const 450 + i32.const 448 i32.const 29 call $~lib/builtins/abort unreachable diff --git a/tests/runtime/untouched.wasm b/tests/runtime/untouched.wasm index 0272a2a4a29134aac07d16b540b731aed1442682..b20dc4e80dd26e6b321803ee9e77799b86bb20d2 100644 GIT binary patch delta 159 zcmV;Q0AT;JC9);3Q~?2%lT`sN0hg150agK|liC622+aXO4G;hT3zI+r6amkZ-U74% z$G*LG+U%1YiM#lY<1(0fLiO1ug-M zlZ6E|0hqJ81(E>)z>`e}lL69`;RkU6-;+}a!U64*774=v-jmu19s%I9`3c+s0qwKa N3oQWwld}X3t_7b#G}-_F delta 159 zcmV;Q0AT;JC9);3Q~?2(lT`sN0hyD70agK~liC622+sjQ4G;hT3zI+r6amqb-U74% z=97~Ha~$;nK@AW901F@iK@e&n2x=e%MnwcbK>$G*LH3g(1YiM%lY<1(0fduQ1ug-O zlZ6E|0h+VA1(E>)!jnx0lL6F|;RkU6;geGc!U6A-774=v;FH=39s%OB`3c+s0q?Wc N3oQWwm9qp5t_7;uH39$t diff --git a/tests/runtime/untouched.wat b/tests/runtime/untouched.wat index 0ca5d74d..ea4746fd 100644 --- a/tests/runtime/untouched.wat +++ b/tests/runtime/untouched.wat @@ -63,7 +63,7 @@ if i32.const 0 i32.const 24 - i32.const 279 + i32.const 277 i32.const 13 call $~lib/builtins/abort unreachable @@ -88,7 +88,7 @@ if i32.const 0 i32.const 24 - i32.const 281 + i32.const 279 i32.const 13 call $~lib/builtins/abort unreachable @@ -140,7 +140,7 @@ if i32.const 0 i32.const 24 - i32.const 294 + i32.const 292 i32.const 13 call $~lib/builtins/abort unreachable @@ -278,7 +278,7 @@ if i32.const 0 i32.const 24 - i32.const 207 + i32.const 205 i32.const 13 call $~lib/builtins/abort unreachable @@ -293,7 +293,7 @@ if i32.const 0 i32.const 24 - i32.const 209 + i32.const 207 i32.const 13 call $~lib/builtins/abort unreachable @@ -392,7 +392,7 @@ if i32.const 0 i32.const 24 - i32.const 230 + i32.const 228 i32.const 15 call $~lib/builtins/abort unreachable @@ -455,7 +455,7 @@ if i32.const 0 i32.const 24 - i32.const 245 + i32.const 243 i32.const 13 call $~lib/builtins/abort unreachable @@ -471,7 +471,7 @@ if i32.const 0 i32.const 24 - i32.const 246 + i32.const 244 i32.const 13 call $~lib/builtins/abort unreachable @@ -528,7 +528,7 @@ if i32.const 0 i32.const 24 - i32.const 262 + i32.const 260 i32.const 13 call $~lib/builtins/abort unreachable @@ -651,7 +651,7 @@ if i32.const 0 i32.const 24 - i32.const 388 + i32.const 386 i32.const 4 call $~lib/builtins/abort unreachable @@ -676,7 +676,7 @@ if i32.const 0 i32.const 24 - i32.const 398 + i32.const 396 i32.const 15 call $~lib/builtins/abort unreachable @@ -707,7 +707,7 @@ if i32.const 0 i32.const 24 - i32.const 410 + i32.const 408 i32.const 4 call $~lib/builtins/abort unreachable @@ -940,7 +940,7 @@ if i32.const 0 i32.const 24 - i32.const 450 + i32.const 448 i32.const 29 call $~lib/builtins/abort unreachable @@ -1034,7 +1034,7 @@ if i32.const 0 i32.const 24 - i32.const 340 + i32.const 338 i32.const 13 call $~lib/builtins/abort unreachable @@ -1099,7 +1099,7 @@ if i32.const 0 i32.const 24 - i32.const 353 + i32.const 351 i32.const 17 call $~lib/builtins/abort unreachable @@ -1217,7 +1217,7 @@ if i32.const 0 i32.const 24 - i32.const 367 + i32.const 365 i32.const 13 call $~lib/builtins/abort unreachable @@ -1328,7 +1328,7 @@ if i32.const 0 i32.const 24 - i32.const 480 + i32.const 478 i32.const 15 call $~lib/builtins/abort unreachable @@ -1346,7 +1346,7 @@ if i32.const 0 i32.const 24 - i32.const 482 + i32.const 480 i32.const 13 call $~lib/builtins/abort unreachable @@ -1622,7 +1622,7 @@ if i32.const 0 i32.const 24 - i32.const 495 + i32.const 493 i32.const 13 call $~lib/builtins/abort unreachable @@ -1789,7 +1789,7 @@ if i32.const 0 i32.const 24 - i32.const 533 + i32.const 531 i32.const 2 call $~lib/builtins/abort unreachable