Skip to content

Commit

Permalink
Merge #2391
Browse files Browse the repository at this point in the history
2391: Fix Singlepass issue #2347 r=syrusakbary a=chenyukang

# Description
Fix Singlepass compiler issue: #2347 

I'm not sure whether the unit test case added to a suitable file. 
Any better suggestion?
@syrusakbary 

Edit by @Hywan: Close #2347, close #2159.


Co-authored-by: yukang <moorekang@gmail.com>
Co-authored-by: Yukang <moorekang@gmail.com>
  • Loading branch information
bors[bot] and chenyukang committed Jun 15, 2021
2 parents c879e2a + b99542b commit e6c8fcd
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ Looking for changes that affect our C API? See the [C API Changelog](lib/c-api/C
- [#2157](https://github.com/wasmerio/wasmer/pull/2157) Simplify the code behind `WasmPtr`

### Fixed
- [#2391](https://github.com/wasmerio/wasmer/pull/2391) Fix Singlepass emit bug, [#2347](https://github.com/wasmerio/wasmer/issues/2347) and [#2159](https://github.com/wasmerio/wasmer/issues/2159)
- [#2327](https://github.com/wasmerio/wasmer/pull/2327) Fix memory leak preventing internal instance memory from being freed when a WasmerEnv contained an exported extern (e.g. Memory, etc.).
- [#2247](https://github.com/wasmerio/wasmer/pull/2247) Internal WasiFS logic updated to be closer to what WASI libc does when finding a preopened fd for a path.
- [#2241](https://github.com/wasmerio/wasmer/pull/2241) Fix Undefined Behavior in setting memory in emscripten `EmEnv`.
Expand Down
2 changes: 1 addition & 1 deletion lib/compiler-singlepass/src/codegen_x64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,9 +330,9 @@ impl<'a> FuncGen<'a> {
let tmp1 = self.machine.acquire_temp_xmm().unwrap();
let tmp2 = self.machine.acquire_temp_xmm().unwrap();
let tmp3 = self.machine.acquire_temp_xmm().unwrap();
let tmpg1 = self.machine.acquire_temp_gpr().unwrap();

self.emit_relaxed_binop(Assembler::emit_mov, sz, input, Location::XMM(tmp1));
let tmpg1 = self.machine.acquire_temp_gpr().unwrap();

match sz {
Size::S32 => {
Expand Down
10 changes: 10 additions & 0 deletions tests/wast/wasmer/nan-canonicalization-issue-2159.wast
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
;; https://github.com/wasmerio/wasmer/issues/2159
(module
(func (export "_start") (result f64)
f64.const 0x0p+0 (;=0;)
f64.const 0x0p+0 (;=0;)
f64.const 0x0p+0 (;=0;)
f64.div
f64.copysign
)
)
14 changes: 14 additions & 0 deletions tests/wast/wasmer/nan-canonicalization-issue-2347.wast
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
;; https://github.com/wasmerio/wasmer/issues/2347
(module
(type (;0;) (func (param f64) (result i32)))
(func (;0;) (type 0) (param f64) (result i32)
unreachable)
(func (;1;) (type 0) (param f64) (result i32)
i32.const -16579585
f64.convert_i32_s
f64.ceil
f64.ceil
local.get 0
f64.copysign
unreachable))

0 comments on commit e6c8fcd

Please sign in to comment.