Comments (6)
Moreover I can not compile the wasm:
wasm.wat:10:6: error: unexpected token "get_global", expected an instr.
(get_global $high)
^^^^^^^^^^
wasm.wat:14:6: error: unexpected token "set_local", expected an instr.
(set_local $result
^^^^^^^^^
wasm.wat:17:12: error: unexpected token i64.extend_u/i32.
(i64.extend_u/i32
^^^^^^^^^^^^^^^^
wasm.wat:18:14: error: unexpected token get_local.
(get_local $xl)
^^^^^^^^^
from long.js.
@dcodeIO Any news ?
from long.js.
It block https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1063508
from long.js.
The .wasm was built from the .wat file using WABT, at a time when local_get
/ global_get
were still named get_local
/ get_global
. Some basic instruction names changed since, but it should trivially build when updated.
The test/goog files come from Google's closure library.
from long.js.
@dcodeIO If you could give me the exact command or step used for recompiling it will be really helful. I fail
from long.js.
commit 121318aa4e9e8fe7f5c4bf82271abfa4d0f9f9b7
Author: Bastien Roucariès <[email protected]>
Date: Fri Feb 16 20:15:57 2024 +0000
Convert to modern wasm
forwarded: https://github.com/dcodeIO/long.js/issues/129
diff --git a/wasm.wat b/wasm.wat
index 983fcdf..d1bfeb4 100644
--- a/wasm.wat
+++ b/wasm.wat
@@ -7,206 +7,206 @@
(export "get_high" (func $get_high))
(global $high (mut i32) (i32.const 0))
(func $get_high (result i32)
- (get_global $high)
+ (global.get $high)
)
(func $mul (param $xl i32) (param $xh i32) (param $yl i32) (param $yh i32) (result i32)
(local $result i64)
- (set_local $result
+ (local.set $result
(i64.mul
(i64.or
- (i64.extend_u/i32
- (get_local $xl)
+ (i64.extend_i32_u
+ (local.get $xl)
)
(i64.shl
- (i64.extend_u/i32
- (get_local $xh)
+ (i64.extend_i32_u
+ (local.get $xh)
)
(i64.const 32)
)
)
(i64.or
- (i64.extend_u/i32
- (get_local $yl)
+ (i64.extend_i32_u
+ (local.get $yl)
)
(i64.shl
- (i64.extend_u/i32
- (get_local $yh)
+ (i64.extend_i32_u
+ (local.get $yh)
)
(i64.const 32)
)
)
)
)
- (set_global $high
- (i32.wrap/i64
+ (global.set $high
+ (i32.wrap_i64
(i64.shr_s
- (get_local $result)
+ (local.get $result)
(i64.const 32)
)
)
)
- (i32.wrap/i64
- (get_local $result)
+ (i32.wrap_i64
+ (local.get $result)
)
)
(func $div_s (param $xl i32) (param $xh i32) (param $yl i32) (param $yh i32) (result i32)
(local $result i64)
- (set_local $result
+ (local.set $result
(i64.div_s
(i64.or
- (i64.extend_u/i32
- (get_local $xl)
+ (i64.extend_i32_u
+ (local.get $xl)
)
(i64.shl
- (i64.extend_u/i32
- (get_local $xh)
+ (i64.extend_i32_u
+ (local.get $xh)
)
(i64.const 32)
)
)
(i64.or
- (i64.extend_u/i32
- (get_local $yl)
+ (i64.extend_i32_u
+ (local.get $yl)
)
(i64.shl
- (i64.extend_u/i32
- (get_local $yh)
+ (i64.extend_i32_u
+ (local.get $yh)
)
(i64.const 32)
)
)
)
)
- (set_global $high
- (i32.wrap/i64
+ (global.set $high
+ (i32.wrap_i64
(i64.shr_s
- (get_local $result)
+ (local.get $result)
(i64.const 32)
)
)
)
- (i32.wrap/i64
- (get_local $result)
+ (i32.wrap_i64
+ (local.get $result)
)
)
(func $div_u (param $xl i32) (param $xh i32) (param $yl i32) (param $yh i32) (result i32)
(local $result i64)
- (set_local $result
+ (local.set $result
(i64.div_u
(i64.or
- (i64.extend_u/i32
- (get_local $xl)
+ (i64.extend_i32_u
+ (local.get $xl)
)
(i64.shl
- (i64.extend_u/i32
- (get_local $xh)
+ (i64.extend_i32_u
+ (local.get $xh)
)
(i64.const 32)
)
)
(i64.or
- (i64.extend_u/i32
- (get_local $yl)
+ (i64.extend_i32_u
+ (local.get $yl)
)
(i64.shl
- (i64.extend_u/i32
- (get_local $yh)
+ (i64.extend_i32_u
+ (local.get $yh)
)
(i64.const 32)
)
)
)
)
- (set_global $high
- (i32.wrap/i64
+ (global.set $high
+ (i32.wrap_i64
(i64.shr_s
- (get_local $result)
+ (local.get $result)
(i64.const 32)
)
)
)
- (i32.wrap/i64
- (get_local $result)
+ (i32.wrap_i64
+ (local.get $result)
)
)
(func $rem_s (param $xl i32) (param $xh i32) (param $yl i32) (param $yh i32) (result i32)
(local $result i64)
- (set_local $result
+ (local.set $result
(i64.rem_s
(i64.or
- (i64.extend_u/i32
- (get_local $xl)
+ (i64.extend_i32_u
+ (local.get $xl)
)
(i64.shl
- (i64.extend_u/i32
- (get_local $xh)
+ (i64.extend_i32_u
+ (local.get $xh)
)
(i64.const 32)
)
)
(i64.or
- (i64.extend_u/i32
- (get_local $yl)
+ (i64.extend_i32_u
+ (local.get $yl)
)
(i64.shl
- (i64.extend_u/i32
- (get_local $yh)
+ (i64.extend_i32_u
+ (local.get $yh)
)
(i64.const 32)
)
)
)
)
- (set_global $high
- (i32.wrap/i64
+ (global.set $high
+ (i32.wrap_i64
(i64.shr_s
- (get_local $result)
+ (local.get $result)
(i64.const 32)
)
)
)
- (i32.wrap/i64
- (get_local $result)
+ (i32.wrap_i64
+ (local.get $result)
)
)
(func $rem_u (param $xl i32) (param $xh i32) (param $yl i32) (param $yh i32) (result i32)
(local $result i64)
- (set_local $result
+ (local.set $result
(i64.rem_u
(i64.or
- (i64.extend_u/i32
- (get_local $xl)
+ (i64.extend_i32_u
+ (local.get $xl)
)
(i64.shl
- (i64.extend_u/i32
- (get_local $xh)
+ (i64.extend_i32_u
+ (local.get $xh)
)
(i64.const 32)
)
)
(i64.or
- (i64.extend_u/i32
- (get_local $yl)
+ (i64.extend_i32_u
+ (local.get $yl)
)
(i64.shl
- (i64.extend_u/i32
- (get_local $yh)
+ (i64.extend_i32_u
+ (local.get $yh)
)
(i64.const 32)
)
)
)
)
- (set_global $high
- (i32.wrap/i64
+ (global.set $high
+ (i32.wrap_i64
(i64.shr_s
- (get_local $result)
+ (local.get $result)
(i64.const 32)
)
)
)
- (i32.wrap/i64
- (get_local $result)
+ (i32.wrap_i64
+ (local.get $result)
)
)
)
from long.js.
Related Issues (20)
- Migrate to ESM HOT 1
- Using symbol for isLong HOT 2
- Add default value of unsigned in Long.fromInt to docs
- How to return a uint64? HOT 4
- isPositive returns true for zero
- Is the heigh argument in Long constructor required? HOT 2
- Switch to ESM breaks 3rd party libraries HOT 8
- [BUG] this.isZero is not function
- WASM check causes Node 16.1+ crash on ARMv6 HOT 3
- Unable import in TypeScript since v5+ HOT 8
- Add copyright line to licence
- protobuf fromNumber encoding error HOT 2
- Cannot import package using ES modules HOT 1
- Please available on module commonjs
- fromString with a string that isn't an integer behaves weird
- TypeScript errors with moduleResolution nodenext HOT 16
- "./package.json" is not defined by "exports" warning in React Native HOT 2
- Issue when running build on a NodeJS app HOT 4
- Patch
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from long.js.