Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 WebAssembly: WASM means more powerful web apps. 류철 한국전자통신연구원 모바일서비스플랫폼연구팀.

Similar presentations


Presentation on theme: "1 WebAssembly: WASM means more powerful web apps. 류철 한국전자통신연구원 모바일서비스플랫폼연구팀."— Presentation transcript:

1 1 WebAssembly: WASM means more powerful web apps. 류철 한국전자통신연구원 모바일서비스플랫폼연구팀

2 2 ASM.JS consists of a strict subset of the JavaScript language.JavaScript Static typing is the key for the improved performance. Numerical computation would be improved by ASM.JS It eliminates dynamic type guards, boxed values, and garbage collection. 2x slow down factor C/C++ LLVM (Clang) Emscripten byte code asm.js code

3 3 size_t strlen(char *ptr) { char *curr = ptr; while (*curr != 0) { curr++; } return (curr − ptr); } function strlen(ptr) { // calculate length of C string ptr = ptr|0; var curr = 0; curr = ptr; while (MEM8[curr]|0 != 0) { curr = (curr + 1)|0; } return (curr − ptr)|0; }

4 4 Q. Why? ASM.JS is not enough? A binary format can be decoded much faster than JavaScript; 20x faster Avoiding the simultaneous ASM.JS constrains: AOT-compatibility and redundant optimization 4

5 5 LLVM(Low Level Virtual Machine) IR(Intermidiate Represetation) @.str = internal constant [14 x i8] c"hello, world\0A\00" declare i32 @printf(i8*,...) define i32 @main(i32 %argc, i8** %argv) nounwind { entry: %tmp1 = getelementptr [14 x i8]* @.str, i32 0, i32 0 %tmp2 = call i32 (i8*,...)* @printf( i8* %tmp1 ) nounwind ret i32 0 } PNaCl (Google Native Client) format already uses LLVM. But portability, stability, small, encoding, fast decoding, fast compiling, minimal nondeterminism are requirements for WASM. 5

6 6 6 Demoasm.jsbinary gzip asm.js gzip binary AngryBots19MiB6.3MiB4.1MiB3.0MiB PlatformerGame49MiB18MiB11MiB7.3MiB Demobinarytime to decode into asm.js AngryBots6.3MiB240ms PlatformerGame18MiB550ms

7 7 Binary format also considering mobile and IoT Incremental implementation Same functionality as ASM.JS A polyfill library to translates WASM code into JavaScript Languages other than C/C++ Compatabile with existing Web Platform Synchronous calls to and from JavaScript Same security policy Access Same Web API accessible to JavaScript 7

8 8 The same functionality as asm.js; Module: the distributable, loadable and executable unit of code AST: the behavior of WebAssembly code in a module The WebAssembly in binary format and text format WebAssembly is designed to be implemented b oth by web browsers and completely different execution environments. An effective and efficient polyfill to JavaScript. 8

9 9 Threads Fixed-width SIMD Zero-cost Exception Handling 9

10 10 Have a look on the section of Adoption of ASM. JS on Wikipedia.the section of Adoption of ASM. JS on Wikipedia Look at the Alon Zakai’s linkedin profile.the Alon Zakai’s linkedin profile. 10 Open GL/CLVulkan WASMWebVulkanWeb GL/CL JavaScript Web Browser

11 11 WebAssembly Community Group at W3C Not a standard track Specification maybe an input to a standard process Testsuite Prototyping Networking Supports from Google. Apple, Microsoft, Mozilla Mozilla and Google are leading the design phase at GitHub Luke Wagner from Mozilla Seth Tompson from Google 11

12 12 spec : Staging ground for artifacts related to an MVP spec spec design : WebAssembly Design Documents design v8-native-prototype : Prototype native decoder th at targets TurboFan v8-native-prototype sexpr-wasm-prototype : Translates from WebAss embly s-expressions to v8-native-prototype bytecode. sexpr-wasm-prototypes-expressionsv8-native-prototype polyfill-prototype-1 : Experimental WebAssembly p olyfill library and tools polyfill-prototype-1 testsuite : Mirror of the spec testsuite testsuite 12

13 13 wasm-to-llvm-prototype : s-expression → internal IR → LLVM IR wasm-to-llvm-prototype wasm-aot-prototype : AOT compiler and static runtime for WebAssembly wasm-aot-prototype ilwasm : CIL to WebAssembly compiler ilwasm : wasm-jit-prototype : VM using LLVM JIT; consumes S-expr syntax and polyfill-prototype-1 binaries wasm-jit-prototype semantics-prototype : s-expression parser, type checker, reference AST semantics semantics-prototype 13

14 14 1. WASM IR 2. Polyfill 3. Native support for various platforms 4. Other language supports 5. Non-browser platform support Long way to go! 14


Download ppt "1 WebAssembly: WASM means more powerful web apps. 류철 한국전자통신연구원 모바일서비스플랫폼연구팀."

Similar presentations


Ads by Google