Skip to content
This repository has been archived by the owner on Feb 28, 2018. It is now read-only.

Standard libs like Math and polyfills (charCodeAt, fromCharCode, etc) #14

Open
MaxGraey opened this issue Mar 24, 2017 · 8 comments
Open

Comments

@MaxGraey
Copy link
Contributor

MaxGraey commented Mar 24, 2017

According to this: https://github.com/WebAssembly/design/blob/master/FAQ.md we need manually implement all sets of js enviroment. This is big job. I could help with this

UPD
I see some stdlib already implement with direct binding to Wasm opcodes.

@MaxGraey MaxGraey changed the title Standard libs Math and polyfills (charCodeAt, fromCharCode, etc) Standard libы like Math and polyfills (charCodeAt, fromCharCode, etc) Mar 24, 2017
@MaxGraey MaxGraey changed the title Standard libы like Math and polyfills (charCodeAt, fromCharCode, etc) Standard libs like Math and polyfills (charCodeAt, fromCharCode, etc) Mar 24, 2017
@MaxGraey
Copy link
Contributor Author

MaxGraey commented Mar 25, 2017

How you bind Math library to Wasm right now? It seems just import from js according this: https://github.com/01alchemist/TurboScript/blob/master/tests/math-wasm.html.

One more thing. In declared set of WasmOpcodes are missing f32_fma and f64_fma commands: https://github.com/01alchemist/TurboScript/blob/master/src/wasm/opcode.ts

Sorry, this post MVP feature. Not implement yet.

@nidin
Copy link
Contributor

nidin commented Mar 25, 2017

Right now importing from JavaScript built-in. I need to implement method overload to use same functions for different signatures like in JavaScript. It's a big task to implement all built-ins manually. We need to wait for WASM 2 Specification to be finalized before implementing this manually. For now, for compatibility we can import slow Math library from JS and gradually add fast implementations in WASM.

@MaxGraey
Copy link
Contributor Author

That's right we definitely need fma command for IEEE-754 (2008) compatible sin, cos, log and etc, but min, max, sqrt, rounding and abs we already has direct equivalents in wasm, so we can use them now

@nidin
Copy link
Contributor

nidin commented Mar 25, 2017

Sure we can implement direct equalents right away. right now built-in classes and functions are located inside library folder.

@nidin nidin added this to the v1.0.0 milestone Mar 28, 2017
@nidin nidin added the ready label Apr 7, 2017
@winksaville
Copy link
Contributor

Be sure there are no associated costs for modules that don't use these features.

@nidin
Copy link
Contributor

nidin commented Apr 12, 2017 via email

@MaxGraey
Copy link
Contributor Author

@nidin Is it possible use wasm's sqrt, clz, ctz, popcount, copysign and etc now?

@nidin
Copy link
Contributor

nidin commented Apr 12, 2017 via email

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants