mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-21 18:51:43 +00:00
Improve reallocateUnsafe and properly free unmanaged objects (#368)
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user