Improve reallocateUnsafe and properly free unmanaged objects (#368)

This commit is contained in:
Max Graey
2018-12-09 00:54:45 +02:00
committed by Daniel Wirtz
parent 3ed83ef3ae
commit 8e61e0ead8
9 changed files with 1278 additions and 1354 deletions

View File

@ -3339,7 +3339,6 @@
(func $~lib/internal/arraybuffer/reallocateUnsafe (; 36 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
(local $3 i32)
(local $4 i32)
get_local $1
get_local $0
i32.load
@ -3373,37 +3372,29 @@
get_local $0
get_local $1
i32.store
get_local $0
i32.const 8
i32.add
get_local $2
i32.add
get_local $1
get_local $2
i32.sub
call $~lib/internal/memory/memset
else
get_local $1
call $~lib/internal/arraybuffer/allocateUnsafe
tee_local $3
i32.const 8
i32.add
tee_local $4
get_local $0
i32.const 8
i32.add
get_local $2
call $~lib/internal/memory/memmove
get_local $2
get_local $4
i32.add
get_local $1
get_local $2
i32.sub
call $~lib/internal/memory/memset
get_local $3
return
set_local $0
end
get_local $0
i32.const 8
i32.add
get_local $2
i32.add
get_local $1
get_local $2
i32.sub
call $~lib/internal/memory/memset
else
get_local $1
get_local $2
@ -3415,7 +3406,7 @@
if
i32.const 0
i32.const 1008
i32.const 64
i32.const 62
i32.const 4
call $~lib/env/abort
unreachable