Avoid trampolines where optional arguments are constant literals, see #102; Fix temporary local flags not being cleared; Fix inlined temporary locals not being free'd; Fix inlined flows not breaking after returns; Allow changetype of u32s, i.e. function pointers

This commit is contained in:
dcodeIO
2018-05-11 16:31:56 +02:00
parent ef9b43740d
commit e415377cda
35 changed files with 3424 additions and 4059 deletions

View File

@@ -1,8 +1,7 @@
(module
(type $ii (func (param i32) (result i32)))
(type $iv (func (param i32)))
(type $fi (func (param f32) (result i32)))
(type $Fi (func (param f64) (result i32)))
(type $Ii (func (param i64) (result i32)))
(type $v (func))
(import "env" "logi" (func $std/hash/logi (param i32)))
(memory $0 1)
@@ -11,55 +10,7 @@
(data (i32.const 24) "\03\00\00\00a\00b\00c")
(export "memory" (memory $0))
(start $start)
(func $~lib/internal/hash/hash<usize> (; 1 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
(i32.mul
(i32.xor
(i32.mul
(i32.xor
(i32.mul
(i32.xor
(i32.mul
(i32.xor
(i32.and
(tee_local $1
(get_local $0)
)
(i32.const 255)
)
(i32.const -2128831035)
)
(i32.const 16777619)
)
(i32.and
(i32.shr_u
(get_local $1)
(i32.const 8)
)
(i32.const 255)
)
)
(i32.const 16777619)
)
(i32.and
(i32.shr_u
(get_local $1)
(i32.const 16)
)
(i32.const 255)
)
)
(i32.const 16777619)
)
(i32.shr_u
(get_local $1)
(i32.const 24)
)
)
(i32.const 16777619)
)
)
(func $~lib/internal/hash/hash<String> (; 2 ;) (type $ii) (param $0 i32) (result i32)
(func $~lib/internal/hash/hashStr (; 1 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
(local $2 i32)
(local $3 i32)
@@ -107,8 +58,7 @@
)
(get_local $2)
)
(func $~lib/internal/hash/hash<f32> (; 3 ;) (type $fi) (param $0 f32) (result i32)
(local $1 i32)
(func $~lib/internal/hash/hash32 (; 2 ;) (type $ii) (param $0 i32) (result i32)
(i32.mul
(i32.xor
(i32.mul
@@ -118,11 +68,7 @@
(i32.mul
(i32.xor
(i32.and
(tee_local $1
(i32.reinterpret/f32
(get_local $0)
)
)
(get_local $0)
(i32.const 255)
)
(i32.const -2128831035)
@@ -131,7 +77,7 @@
)
(i32.and
(i32.shr_u
(get_local $1)
(get_local $0)
(i32.const 8)
)
(i32.const 255)
@@ -141,7 +87,7 @@
)
(i32.and
(i32.shr_u
(get_local $1)
(get_local $0)
(i32.const 16)
)
(i32.const 255)
@@ -150,16 +96,15 @@
(i32.const 16777619)
)
(i32.shr_u
(get_local $1)
(get_local $0)
(i32.const 24)
)
)
(i32.const 16777619)
)
)
(func $~lib/internal/hash/hash<f64> (; 4 ;) (type $Fi) (param $0 f64) (result i32)
(func $~lib/internal/hash/hash64 (; 3 ;) (type $Ii) (param $0 i64) (result i32)
(local $1 i32)
(local $2 i64)
(i32.mul
(i32.xor
(i32.mul
@@ -179,11 +124,7 @@
(i32.and
(tee_local $1
(i32.wrap/i64
(tee_local $2
(i64.reinterpret/f64
(get_local $0)
)
)
(get_local $0)
)
)
(i32.const 255)
@@ -223,7 +164,7 @@
(tee_local $1
(i32.wrap/i64
(i64.shr_u
(get_local $2)
(get_local $0)
(i64.const 32)
)
)
@@ -261,90 +202,90 @@
(i32.const 16777619)
)
)
(func $start (; 5 ;) (type $v)
(func $start (; 4 ;) (type $v)
(call $std/hash/logi
(call $~lib/internal/hash/hash<usize>
(call $~lib/internal/hash/hashStr
(i32.const 0)
)
)
(call $std/hash/logi
(call $~lib/internal/hash/hash<String>
(call $~lib/internal/hash/hashStr
(i32.const 4)
)
)
(call $std/hash/logi
(call $~lib/internal/hash/hash<String>
(call $~lib/internal/hash/hashStr
(i32.const 8)
)
)
(call $std/hash/logi
(call $~lib/internal/hash/hash<String>
(call $~lib/internal/hash/hashStr
(i32.const 16)
)
)
(call $std/hash/logi
(call $~lib/internal/hash/hash<String>
(call $~lib/internal/hash/hashStr
(i32.const 24)
)
)
(call $std/hash/logi
(call $~lib/internal/hash/hash<f32>
(f32.const 0)
(call $~lib/internal/hash/hash32
(i32.const 0)
)
)
(call $std/hash/logi
(call $~lib/internal/hash/hash<f32>
(f32.const 1)
(call $~lib/internal/hash/hash32
(i32.const 1065353216)
)
)
(call $std/hash/logi
(call $~lib/internal/hash/hash<f32>
(f32.const 1.100000023841858)
(call $~lib/internal/hash/hash32
(i32.const 1066192077)
)
)
(call $std/hash/logi
(call $~lib/internal/hash/hash<f32>
(f32.const 0)
(call $~lib/internal/hash/hash32
(i32.const 0)
)
)
(call $std/hash/logi
(call $~lib/internal/hash/hash<f32>
(f32.const inf)
(call $~lib/internal/hash/hash32
(i32.const 2139095040)
)
)
(call $std/hash/logi
(call $~lib/internal/hash/hash<f32>
(f32.const nan:0x400000)
(call $~lib/internal/hash/hash32
(i32.const 2143289344)
)
)
(call $std/hash/logi
(call $~lib/internal/hash/hash<f64>
(f64.const 0)
(call $~lib/internal/hash/hash64
(i64.const 0)
)
)
(call $std/hash/logi
(call $~lib/internal/hash/hash<f64>
(f64.const 1)
(call $~lib/internal/hash/hash64
(i64.const 4607182418800017408)
)
)
(call $std/hash/logi
(call $~lib/internal/hash/hash<f64>
(f64.const 1.1)
(call $~lib/internal/hash/hash64
(i64.const 4607632778762754458)
)
)
(call $std/hash/logi
(call $~lib/internal/hash/hash<f64>
(f64.const 0)
(call $~lib/internal/hash/hash64
(i64.const 0)
)
)
(call $std/hash/logi
(call $~lib/internal/hash/hash<f64>
(f64.const inf)
(call $~lib/internal/hash/hash64
(i64.const 9218868437227405312)
)
)
(call $std/hash/logi
(call $~lib/internal/hash/hash<f64>
(f64.const nan:0x8000000000000)
(call $~lib/internal/hash/hash64
(i64.const 9221120237041090560)
)
)
)