Are you over 18 and want to see adult content?
More Annotations
![A complete backup of royalcaribbean.co.uk](https://www.archivebay.com/archive2/656ce3e9-0cd3-46ba-9fc1-1deba2a1d093.png)
A complete backup of royalcaribbean.co.uk
Are you over 18 and want to see adult content?
![A complete backup of grocerycouponcart.com](https://www.archivebay.com/archive2/54a9e3aa-4a41-45e3-9283-18bee63c3c62.png)
A complete backup of grocerycouponcart.com
Are you over 18 and want to see adult content?
![A complete backup of murrayffilms.com](https://www.archivebay.com/archive2/4506ef86-d109-4dd9-8e9a-fae1b25774e3.png)
A complete backup of murrayffilms.com
Are you over 18 and want to see adult content?
![A complete backup of jeanmazuelos.com](https://www.archivebay.com/archive2/f32eb271-3fff-49d9-9cd0-41919d156fb8.png)
A complete backup of jeanmazuelos.com
Are you over 18 and want to see adult content?
Favourite Annotations
![Скачать бесплатно курсы, видеоуроки, мануалы, обучения](https://www.archivebay.com/archive/7ed18b04-c4b1-432f-bab0-3662020a591d.png)
Скачать бесплатно курсы, видеоуроки, мануалы, обучения
Are you over 18 and want to see adult content?
![Hahaprank.com - Prank Store with Gag Gifts Funny Gifts and Joke Gifts - Hahaprank.com, LLC](https://www.archivebay.com/archive/70a4f539-fe65-416c-8d60-258592ca3237.png)
Hahaprank.com - Prank Store with Gag Gifts Funny Gifts and Joke Gifts - Hahaprank.com, LLC
Are you over 18 and want to see adult content?
![Idéias Para O Ministério Infantil | Tia Stephanny Braga](https://www.archivebay.com/archive/ee3fc9a6-ed9c-4146-89bc-0d4fa2b28ecd.png)
Idéias Para O Ministério Infantil | Tia Stephanny Braga
Are you over 18 and want to see adult content?
Text
some
BUILDING CHROMIUM FOR WINDOWS ARM64 General Chromium on Windows build directions are very helpful, including telling you how to trigger the right components for Visual Studio setup. Follow all the directions! GN build configuration explains how to set configuration arguments like target_cpu, which you want to set to “ arm64 “. Tricky bits: I built with Visual Studio2019, but
JAVASCRIPT ENGINE INTERNALS: NAN-BOXING EXCEPTION HANDLING IN EMSCRIPTEN: HOW IT WORKS AND WHY IT One of my “fun” projects I’m poking at on the side is an x86-64 emulator for the web using WebAssembly (not yet online, nowhere near working). I’ve done partial spike implementations in C++ and Rust with a handful of interpreted opcodes and emulation of a couple Linux syscalls; this is just enough for a hand-written “Hello, world!”executable.
WASM RPC THOUGHTS
Wasm Instance Wasm code Wasm Instance Wasm Memory Wasm code When dynamic linking, instances can share a memory and send pointers directly to each others' functions.BRIONV
Before I was paid to work on code for a living, it was my hobby. My favorite project from when I was young, before The Internet came to the masses, was a support library for my other programs (little widgets, games, and utilities for myself): a loadable graphics driver system for VGA and SVGA cards, SURFACE PRO X THOUGHTS AFTER A FEW WEEKS BRAIN DUMP: X86 EMULATION IN WEBASSEMBLY This is a quick brain dump of my recent musings on feasibility of a WebAssembly-based in-browser emulator for x86 and x86-64 processors partially in the hopes of freeing up my brain for main project work.. My big side project for some time has been ogv.js, an in-browser video player framework which uses emscripten to cross-compile C libraries for the codecs into JavaScript or BRAIN DUMP: JAVASCRIPT SANDBOXING The two main ‘more restricted sandbox’ possibilities are to run an interpreter that handles loops safely and applies resource limits, or to run in a worker thread that doesn’t block the main UI and can be terminated after a timeout. but even that may be OGV.JS 1.4.0 RELEASED ogv.js 1.4.0 is now released, with a .zip build or via npm.Will try to push it to Wikimedia next week or so. Live demo available as always.. New A/V sync. Main improvement is much smoother performance on slower machines, mainly from changing the A/V sync method to prioritize audio smoothness, based on recommendations I’d received from video engineers at conferences that WINDOWS 10 ON ARM64 TESTING Windows 10 on ARM64 testing. I’ve been curious about ARM64 (aarch64) and whether it’s up to the task of a modern, modest laptop for a while finally picked up one of the second-generation Snapdragon 850-based Windows 10 “Always Connected PCs”, a Lenovo Yoga C630. It’s available in an 8gb RAM configuration which was enough to dosome
BUILDING CHROMIUM FOR WINDOWS ARM64 General Chromium on Windows build directions are very helpful, including telling you how to trigger the right components for Visual Studio setup. Follow all the directions! GN build configuration explains how to set configuration arguments like target_cpu, which you want to set to “ arm64 “. Tricky bits: I built with Visual Studio2019, but
JAVASCRIPT ENGINE INTERNALS: NAN-BOXING EXCEPTION HANDLING IN EMSCRIPTEN: HOW IT WORKS AND WHY IT One of my “fun” projects I’m poking at on the side is an x86-64 emulator for the web using WebAssembly (not yet online, nowhere near working). I’ve done partial spike implementations in C++ and Rust with a handful of interpreted opcodes and emulation of a couple Linux syscalls; this is just enough for a hand-written “Hello, world!”executable.
WASM RPC THOUGHTS
Wasm Instance Wasm code Wasm Instance Wasm Memory Wasm code When dynamic linking, instances can share a memory and send pointers directly to each others' functions.BRIONV
Before I was paid to work on code for a living, it was my hobby. My favorite project from when I was young, before The Internet came to the masses, was a support library for my other programs (little widgets, games, and utilities for myself): a loadable graphics driver system for VGA and SVGA cards, OGV.JS 1.4.0 RELEASED ogv.js 1.4.0 is now released, with a .zip build or via npm.Will try to push it to Wikimedia next week or so. Live demo available as always.. New A/V sync. Main improvement is much smoother performance on slower machines, mainly from changing the A/V sync method to prioritize audio smoothness, based on recommendations I’d received from video engineers at conferences that VIDEO DECODING IN THE JAVASCRIPT PLATFORM: “OGV.JS, HOW U ogv.js’s player logic is handwritten JavaScript, but the guts of the demuxer and decoders are cross-compiled from well-supported, battle-tested C libraries. Emscripten is a magical tool developed at Mozilla to help port large C/C++ codebases like games to the web platform. In short, it runs your C/C++ code through the well-known WINDOWS 10 ON ARM64 TESTING Windows 10 on ARM64 testing. I’ve been curious about ARM64 (aarch64) and whether it’s up to the task of a modern, modest laptop for a while finally picked up one of the second-generation Snapdragon 850-based Windows 10 “Always Connected PCs”, a Lenovo Yoga C630. It’s available in an 8gb RAM configuration which was enough to dosome
BUILDING CHROMIUM FOR WINDOWS ARM64 General Chromium on Windows build directions are very helpful, including telling you how to trigger the right components for Visual Studio setup. Follow all the directions! GN build configuration explains how to set configuration arguments like target_cpu, which you want to set to “ arm64 “. Tricky bits: I built with Visual Studio2019, but
RUST ERROR HANDLING WITH RESULT AND OPTION (WEBASSEMBLY In our last adventure we looked at C++ exceptions in WebAssembly with the emscripten compiler.Now we’re taking a look at the main error handling system for another DEFENDER OF THE REALM Getting a realm. There are a few possible ways we can manage to get ahold of a separate realm for our guest code: Un-sandboxed . Sandboxed . Web Worker thread. ‘vm’ module for Node.js. It should be possible to combine some of these techniques, such as using the future-native Realm inside a Worker inside a sandboxed iframe JAVASCRIPT ENGINE INTERNALS PART 3: GARBAGE COLLECTION JavaScript engine internals part 3: garbage collection. Another part of implementing a JavaScript-like engine to run inside a WebAssembly sandbox is memory management: JS requires garbage collection because objects may hold references to each other, creating cycles that simpler schemes like reference counting can’t break. IF YOU GET GROUNDED IN VIRTUAL REALITY, YOU GET GROUNDED If you get grounded in virtual reality, you get grounded in real life. I keep researching the new VR stuff and thinking “this could be fun, but it’s still too expensive and impractical”. Finally took a quick jaunt to the Portland Microsoft store this morning hoping for a demo of the HTC Vive VR headset to see how it feels in practice. DRAWING UNCOMPRESSED YUV FRAMES ON IOS WITH One of my little projects is OGVKit, a library for playing Ogg and WebM media on iOS, which at some point I want to integrate into the Wikipedia app to fix audio/video playback in articles.(We don’t use MP4/H.264 due to patent licensing concerns, but Apple doesn’t support these formats, so we have to jump through some hoops)BRIONV
Before I was paid to work on code for a living, it was my hobby. My favorite project from when I was young, before The Internet came to the masses, was a support library for my other programs (little widgets, games, and utilities for myself): a loadable graphics driver system for VGA and SVGA cards, SURFACE PRO X THOUGHTS AFTER A FEW WEEKS BRAIN DUMP: X86 EMULATION IN WEBASSEMBLY This is a quick brain dump of my recent musings on feasibility of a WebAssembly-based in-browser emulator for x86 and x86-64 processors partially in the hopes of freeing up my brain for main project work.. My big side project for some time has been ogv.js, an in-browser video player framework which uses emscripten to cross-compile C libraries for the codecs into JavaScript or BRAIN DUMP: JAVASCRIPT SANDBOXING The two main ‘more restricted sandbox’ possibilities are to run an interpreter that handles loops safely and applies resource limits, or to run in a worker thread that doesn’t block the main UI and can be terminated after a timeout. but even that may be OGV.JS 1.4.0 RELEASED ogv.js 1.4.0 is now released, with a .zip build or via npm.Will try to push it to Wikimedia next week or so. Live demo available as always.. New A/V sync. Main improvement is much smoother performance on slower machines, mainly from changing the A/V sync method to prioritize audio smoothness, based on recommendations I’d received from video engineers at conferences that WINDOWS 10 ON ARM64 TESTING Windows 10 on ARM64 testing. I’ve been curious about ARM64 (aarch64) and whether it’s up to the task of a modern, modest laptop for a while finally picked up one of the second-generation Snapdragon 850-based Windows 10 “Always Connected PCs”, a Lenovo Yoga C630. It’s available in an 8gb RAM configuration which was enough to dosome
BUILDING CHROMIUM FOR WINDOWS ARM64 General Chromium on Windows build directions are very helpful, including telling you how to trigger the right components for Visual Studio setup. Follow all the directions! GN build configuration explains how to set configuration arguments like target_cpu, which you want to set to “ arm64 “. Tricky bits: I built with Visual Studio2019, but
JAVASCRIPT ENGINE INTERNALS: NAN-BOXING EXCEPTION HANDLING IN EMSCRIPTEN: HOW IT WORKS AND WHY IT One of my “fun” projects I’m poking at on the side is an x86-64 emulator for the web using WebAssembly (not yet online, nowhere near working). I’ve done partial spike implementations in C++ and Rust with a handful of interpreted opcodes and emulation of a couple Linux syscalls; this is just enough for a hand-written “Hello, world!”executable.
WASM RPC THOUGHTS
Wasm Instance Wasm code Wasm Instance Wasm Memory Wasm code When dynamic linking, instances can share a memory and send pointers directly to each others' functions.BRIONV
Before I was paid to work on code for a living, it was my hobby. My favorite project from when I was young, before The Internet came to the masses, was a support library for my other programs (little widgets, games, and utilities for myself): a loadable graphics driver system for VGA and SVGA cards, SURFACE PRO X THOUGHTS AFTER A FEW WEEKS BRAIN DUMP: X86 EMULATION IN WEBASSEMBLY This is a quick brain dump of my recent musings on feasibility of a WebAssembly-based in-browser emulator for x86 and x86-64 processors partially in the hopes of freeing up my brain for main project work.. My big side project for some time has been ogv.js, an in-browser video player framework which uses emscripten to cross-compile C libraries for the codecs into JavaScript or BRAIN DUMP: JAVASCRIPT SANDBOXING The two main ‘more restricted sandbox’ possibilities are to run an interpreter that handles loops safely and applies resource limits, or to run in a worker thread that doesn’t block the main UI and can be terminated after a timeout. but even that may be OGV.JS 1.4.0 RELEASED ogv.js 1.4.0 is now released, with a .zip build or via npm.Will try to push it to Wikimedia next week or so. Live demo available as always.. New A/V sync. Main improvement is much smoother performance on slower machines, mainly from changing the A/V sync method to prioritize audio smoothness, based on recommendations I’d received from video engineers at conferences that WINDOWS 10 ON ARM64 TESTING Windows 10 on ARM64 testing. I’ve been curious about ARM64 (aarch64) and whether it’s up to the task of a modern, modest laptop for a while finally picked up one of the second-generation Snapdragon 850-based Windows 10 “Always Connected PCs”, a Lenovo Yoga C630. It’s available in an 8gb RAM configuration which was enough to dosome
BUILDING CHROMIUM FOR WINDOWS ARM64 General Chromium on Windows build directions are very helpful, including telling you how to trigger the right components for Visual Studio setup. Follow all the directions! GN build configuration explains how to set configuration arguments like target_cpu, which you want to set to “ arm64 “. Tricky bits: I built with Visual Studio2019, but
JAVASCRIPT ENGINE INTERNALS: NAN-BOXING EXCEPTION HANDLING IN EMSCRIPTEN: HOW IT WORKS AND WHY IT One of my “fun” projects I’m poking at on the side is an x86-64 emulator for the web using WebAssembly (not yet online, nowhere near working). I’ve done partial spike implementations in C++ and Rust with a handful of interpreted opcodes and emulation of a couple Linux syscalls; this is just enough for a hand-written “Hello, world!”executable.
WASM RPC THOUGHTS
Wasm Instance Wasm code Wasm Instance Wasm Memory Wasm code When dynamic linking, instances can share a memory and send pointers directly to each others' functions.BRIONV
Before I was paid to work on code for a living, it was my hobby. My favorite project from when I was young, before The Internet came to the masses, was a support library for my other programs (little widgets, games, and utilities for myself): a loadable graphics driver system for VGA and SVGA cards, OGV.JS 1.4.0 RELEASED ogv.js 1.4.0 is now released, with a .zip build or via npm.Will try to push it to Wikimedia next week or so. Live demo available as always.. New A/V sync. Main improvement is much smoother performance on slower machines, mainly from changing the A/V sync method to prioritize audio smoothness, based on recommendations I’d received from video engineers at conferences that VIDEO DECODING IN THE JAVASCRIPT PLATFORM: “OGV.JS, HOW U ogv.js’s player logic is handwritten JavaScript, but the guts of the demuxer and decoders are cross-compiled from well-supported, battle-tested C libraries. Emscripten is a magical tool developed at Mozilla to help port large C/C++ codebases like games to the web platform. In short, it runs your C/C++ code through the well-known WINDOWS 10 ON ARM64 TESTING Windows 10 on ARM64 testing. I’ve been curious about ARM64 (aarch64) and whether it’s up to the task of a modern, modest laptop for a while finally picked up one of the second-generation Snapdragon 850-based Windows 10 “Always Connected PCs”, a Lenovo Yoga C630. It’s available in an 8gb RAM configuration which was enough to dosome
BUILDING CHROMIUM FOR WINDOWS ARM64 General Chromium on Windows build directions are very helpful, including telling you how to trigger the right components for Visual Studio setup. Follow all the directions! GN build configuration explains how to set configuration arguments like target_cpu, which you want to set to “ arm64 “. Tricky bits: I built with Visual Studio2019, but
RUST ERROR HANDLING WITH RESULT AND OPTION (WEBASSEMBLY In our last adventure we looked at C++ exceptions in WebAssembly with the emscripten compiler.Now we’re taking a look at the main error handling system for another DEFENDER OF THE REALM Getting a realm. There are a few possible ways we can manage to get ahold of a separate realm for our guest code: Un-sandboxed . Sandboxed . Web Worker thread. ‘vm’ module for Node.js. It should be possible to combine some of these techniques, such as using the future-native Realm inside a Worker inside a sandboxed iframe JAVASCRIPT ENGINE INTERNALS PART 3: GARBAGE COLLECTION JavaScript engine internals part 3: garbage collection. Another part of implementing a JavaScript-like engine to run inside a WebAssembly sandbox is memory management: JS requires garbage collection because objects may hold references to each other, creating cycles that simpler schemes like reference counting can’t break. IF YOU GET GROUNDED IN VIRTUAL REALITY, YOU GET GROUNDED If you get grounded in virtual reality, you get grounded in real life. I keep researching the new VR stuff and thinking “this could be fun, but it’s still too expensive and impractical”. Finally took a quick jaunt to the Portland Microsoft store this morning hoping for a demo of the HTC Vive VR headset to see how it feels in practice. DRAWING UNCOMPRESSED YUV FRAMES ON IOS WITH One of my little projects is OGVKit, a library for playing Ogg and WebM media on iOS, which at some point I want to integrate into the Wikipedia app to fix audio/video playback in articles.(We don’t use MP4/H.264 due to patent licensing concerns, but Apple doesn’t support these formats, so we have to jump through some hoops)BRIONV
Before I was paid to work on code for a living, it was my hobby. My favorite project from when I was young, before The Internet came to the masses, was a support library for my other programs (little widgets, games, and utilities for myself): a loadable graphics driver system for VGA and SVGA cards, SURFACE PRO X THOUGHTS AFTER A FEW WEEKS BRAIN DUMP: X86 EMULATION IN WEBASSEMBLY This is a quick brain dump of my recent musings on feasibility of a WebAssembly-based in-browser emulator for x86 and x86-64 processors partially in the hopes of freeing up my brain for main project work.. My big side project for some time has been ogv.js, an in-browser video player framework which uses emscripten to cross-compile C libraries for the codecs into JavaScript or BRAIN DUMP: JAVASCRIPT SANDBOXING The two main ‘more restricted sandbox’ possibilities are to run an interpreter that handles loops safely and applies resource limits, or to run in a worker thread that doesn’t block the main UI and can be terminated after a timeout. but even that may be JAVASCRIPT ENGINE INTERNALS: NAN-BOXING WINDOWS 10 ON ARM64 TESTING Windows 10 on ARM64 testing. I’ve been curious about ARM64 (aarch64) and whether it’s up to the task of a modern, modest laptop for a while finally picked up one of the second-generation Snapdragon 850-based Windows 10 “Always Connected PCs”, a Lenovo Yoga C630. It’s available in an 8gb RAM configuration which was enough to dosome
BUILDING CHROMIUM FOR WINDOWS ARM64 General Chromium on Windows build directions are very helpful, including telling you how to trigger the right components for Visual Studio setup. Follow all the directions! GN build configuration explains how to set configuration arguments like target_cpu, which you want to set to “ arm64 “. Tricky bits: I built with Visual Studio2019, but
EXCEPTION HANDLING IN EMSCRIPTEN: HOW IT WORKS AND WHY IT One of my “fun” projects I’m poking at on the side is an x86-64 emulator for the web using WebAssembly (not yet online, nowhere near working). I’ve done partial spike implementations in C++ and Rust with a handful of interpreted opcodes and emulation of a couple Linux syscalls; this is just enough for a hand-written “Hello, world!”executable.
VIDEO DECODING IN THE JAVASCRIPT PLATFORM: “OGV.JS, HOW U ogv.js’s player logic is handwritten JavaScript, but the guts of the demuxer and decoders are cross-compiled from well-supported, battle-tested C libraries. Emscripten is a magical tool developed at Mozilla to help port large C/C++ codebases like games to the web platform. In short, it runs your C/C++ code through the well-knownWASM RPC THOUGHTS
Wasm Instance Wasm code Wasm Instance Wasm Memory Wasm code When dynamic linking, instances can share a memory and send pointers directly to each others' functions.BRIONV
Before I was paid to work on code for a living, it was my hobby. My favorite project from when I was young, before The Internet came to the masses, was a support library for my other programs (little widgets, games, and utilities for myself): a loadable graphics driver system for VGA and SVGA cards, SURFACE PRO X THOUGHTS AFTER A FEW WEEKS BRAIN DUMP: X86 EMULATION IN WEBASSEMBLY This is a quick brain dump of my recent musings on feasibility of a WebAssembly-based in-browser emulator for x86 and x86-64 processors partially in the hopes of freeing up my brain for main project work.. My big side project for some time has been ogv.js, an in-browser video player framework which uses emscripten to cross-compile C libraries for the codecs into JavaScript or BRAIN DUMP: JAVASCRIPT SANDBOXING The two main ‘more restricted sandbox’ possibilities are to run an interpreter that handles loops safely and applies resource limits, or to run in a worker thread that doesn’t block the main UI and can be terminated after a timeout. but even that may be JAVASCRIPT ENGINE INTERNALS: NAN-BOXING WINDOWS 10 ON ARM64 TESTING Windows 10 on ARM64 testing. I’ve been curious about ARM64 (aarch64) and whether it’s up to the task of a modern, modest laptop for a while finally picked up one of the second-generation Snapdragon 850-based Windows 10 “Always Connected PCs”, a Lenovo Yoga C630. It’s available in an 8gb RAM configuration which was enough to dosome
BUILDING CHROMIUM FOR WINDOWS ARM64 General Chromium on Windows build directions are very helpful, including telling you how to trigger the right components for Visual Studio setup. Follow all the directions! GN build configuration explains how to set configuration arguments like target_cpu, which you want to set to “ arm64 “. Tricky bits: I built with Visual Studio2019, but
EXCEPTION HANDLING IN EMSCRIPTEN: HOW IT WORKS AND WHY IT One of my “fun” projects I’m poking at on the side is an x86-64 emulator for the web using WebAssembly (not yet online, nowhere near working). I’ve done partial spike implementations in C++ and Rust with a handful of interpreted opcodes and emulation of a couple Linux syscalls; this is just enough for a hand-written “Hello, world!”executable.
VIDEO DECODING IN THE JAVASCRIPT PLATFORM: “OGV.JS, HOW U ogv.js’s player logic is handwritten JavaScript, but the guts of the demuxer and decoders are cross-compiled from well-supported, battle-tested C libraries. Emscripten is a magical tool developed at Mozilla to help port large C/C++ codebases like games to the web platform. In short, it runs your C/C++ code through the well-knownWASM RPC THOUGHTS
Wasm Instance Wasm code Wasm Instance Wasm Memory Wasm code When dynamic linking, instances can share a memory and send pointers directly to each others' functions.BRIONV
Before I was paid to work on code for a living, it was my hobby. My favorite project from when I was young, before The Internet came to the masses, was a support library for my other programs (little widgets, games, and utilities for myself): a loadable graphics driver system for VGA and SVGA cards, BUILDING CHROMIUM FOR WINDOWS ARM64 General Chromium on Windows build directions are very helpful, including telling you how to trigger the right components for Visual Studio setup. Follow all the directions! GN build configuration explains how to set configuration arguments like target_cpu, which you want to set to “ arm64 “. Tricky bits: I built with Visual Studio2019, but
WINDOWS 10 ON ARM64 TESTING Windows 10 on ARM64 testing. I’ve been curious about ARM64 (aarch64) and whether it’s up to the task of a modern, modest laptop for a while finally picked up one of the second-generation Snapdragon 850-based Windows 10 “Always Connected PCs”, a Lenovo Yoga C630. It’s available in an 8gb RAM configuration which was enough to dosome
RUST ERROR HANDLING WITH RESULT AND OPTION (WEBASSEMBLY In our last adventure we looked at C++ exceptions in WebAssembly with the emscripten compiler.Now we’re taking a look at the main error handling system for another VIDEO DECODING IN THE JAVASCRIPT PLATFORM: “OGV.JS, HOW U ogv.js’s player logic is handwritten JavaScript, but the guts of the demuxer and decoders are cross-compiled from well-supported, battle-tested C libraries. Emscripten is a magical tool developed at Mozilla to help port large C/C++ codebases like games to the web platform. In short, it runs your C/C++ code through the well-known DEFENDER OF THE REALM Getting a realm. There are a few possible ways we can manage to get ahold of a separate realm for our guest code: Un-sandboxed . Sandboxed . Web Worker thread. ‘vm’ module for Node.js. It should be possible to combine some of these techniques, such as using the future-native Realm inside a Worker inside a sandboxed iframe OGV.JS 1.4.0 RELEASED ogv.js 1.4.0 is now released, with a .zip build or via npm.Will try to push it to Wikimedia next week or so. Live demo available as always.. New A/V sync. Main improvement is much smoother performance on slower machines, mainly from changing the A/V sync method to prioritize audio smoothness, based on recommendations I’d received from video engineers at conferences that BRIONV – PAGE 13 – RETICULA, ELECTRONICA, & ODDITIES First impressions using the Nexus 7 tablet for a couple days I used to think the 7″ tablet space was a solution searching for a problem. Prior experience with the Kindle Fire and the Blackberry Playbook — both boxy, awkward slates — hadn’t impressed me. JAVASCRIPT ENGINE INTERNALS PART 3: GARBAGE COLLECTION JavaScript engine internals part 3: garbage collection. Another part of implementing a JavaScript-like engine to run inside a WebAssembly sandbox is memory management: JS requires garbage collection because objects may hold references to each other, creating cycles that simpler schemes like reference counting can’t break. EMSCRIPTEN VERSUS IE 11: ARITHMETIC OPTIMIZATION FOR OGV ogv.js is a web video & audio playback engine for supporting the free & open Ogg and WebM formats in browsers that don’t support them natively, such as Safari, Edge, and Internet Explorer. We use it at Wikipedia and Wikimedia Commons, where we don’t currently allow the more common MP4 family of file formats due to patent concerns.BRIONV
Before I was paid to work on code for a living, it was my hobby. My favorite project from when I was young, before The Internet came to the masses, was a support library for my other programs (little widgets, games, and utilities for myself): a loadable graphics driver system for VGA and SVGA cards, SURFACE PRO X THOUGHTS AFTER A FEW WEEKS BRAIN DUMP: X86 EMULATION IN WEBASSEMBLY This is a quick brain dump of my recent musings on feasibility of a WebAssembly-based in-browser emulator for x86 and x86-64 processors partially in the hopes of freeing up my brain for main project work.. My big side project for some time has been ogv.js, an in-browser video player framework which uses emscripten to cross-compile C libraries for the codecs into JavaScript or BRAIN DUMP: JAVASCRIPT SANDBOXING The two main ‘more restricted sandbox’ possibilities are to run an interpreter that handles loops safely and applies resource limits, or to run in a worker thread that doesn’t block the main UI and can be terminated after a timeout. but even that may be BRIONV – PAGE 10 – RETICULA, ELECTRONICA, & ODDITIES In addition to my in-browser ogv.js media player, I’ve got an OgvKit framework in progress for native iPhone and iPad apps, which I hope to integrate into Wikipedia’s new iOS app somewhere down the line. I took a little Independence Day holiday time and made a bunch of improvements from where I last left it a few months ago: JAVASCRIPT ENGINE INTERNALS: NAN-BOXING BUILDING CHROMIUM FOR WINDOWS ARM64 General Chromium on Windows build directions are very helpful, including telling you how to trigger the right components for Visual Studio setup. Follow all the directions! GN build configuration explains how to set configuration arguments like target_cpu, which you want to set to “ arm64 “. Tricky bits: I built with Visual Studio2019, but
WINDOWS 10 ON ARM64 TESTING Windows 10 on ARM64 testing. I’ve been curious about ARM64 (aarch64) and whether it’s up to the task of a modern, modest laptop for a while finally picked up one of the second-generation Snapdragon 850-based Windows 10 “Always Connected PCs”, a Lenovo Yoga C630. It’s available in an 8gb RAM configuration which was enough to dosome
DEFENDER OF THE REALM Getting a realm. There are a few possible ways we can manage to get ahold of a separate realm for our guest code: Un-sandboxed . Sandboxed . Web Worker thread. ‘vm’ module for Node.js. It should be possible to combine some of these techniques, such as using the future-native Realm inside a Worker inside a sandboxed iframe EXCEPTION HANDLING IN EMSCRIPTEN: HOW IT WORKS AND WHY IT One of my “fun” projects I’m poking at on the side is an x86-64 emulator for the web using WebAssembly (not yet online, nowhere near working). I’ve done partial spike implementations in C++ and Rust with a handful of interpreted opcodes and emulation of a couple Linux syscalls; this is just enough for a hand-written “Hello, world!”executable.
WASM RPC THOUGHTS
Wasm Instance Wasm code Wasm Instance Wasm Memory Wasm code When dynamic linking, instances can share a memory and send pointers directly to each others' functions. SURFACE PRO X THOUGHTS AFTER A FEW WEEKS BRAIN DUMP: X86 EMULATION IN WEBASSEMBLY This is a quick brain dump of my recent musings on feasibility of a WebAssembly-based in-browser emulator for x86 and x86-64 processors partially in the hopes of freeing up my brain for main project work.. My big side project for some time has been ogv.js, an in-browser video player framework which uses emscripten to cross-compile C libraries for the codecs into JavaScript or BRAIN DUMP: JAVASCRIPT SANDBOXING The two main ‘more restricted sandbox’ possibilities are to run an interpreter that handles loops safely and applies resource limits, or to run in a worker thread that doesn’t block the main UI and can be terminated after a timeout. but even that may be BRIONV – PAGE 10 – RETICULA, ELECTRONICA, & ODDITIES In addition to my in-browser ogv.js media player, I’ve got an OgvKit framework in progress for native iPhone and iPad apps, which I hope to integrate into Wikipedia’s new iOS app somewhere down the line. I took a little Independence Day holiday time and made a bunch of improvements from where I last left it a few months ago: JAVASCRIPT ENGINE INTERNALS: NAN-BOXING BUILDING CHROMIUM FOR WINDOWS ARM64 General Chromium on Windows build directions are very helpful, including telling you how to trigger the right components for Visual Studio setup. Follow all the directions! GN build configuration explains how to set configuration arguments like target_cpu, which you want to set to “ arm64 “. Tricky bits: I built with Visual Studio2019, but
WINDOWS 10 ON ARM64 TESTING Windows 10 on ARM64 testing. I’ve been curious about ARM64 (aarch64) and whether it’s up to the task of a modern, modest laptop for a while finally picked up one of the second-generation Snapdragon 850-based Windows 10 “Always Connected PCs”, a Lenovo Yoga C630. It’s available in an 8gb RAM configuration which was enough to dosome
DEFENDER OF THE REALM Getting a realm. There are a few possible ways we can manage to get ahold of a separate realm for our guest code: Un-sandboxed . Sandboxed . Web Worker thread. ‘vm’ module for Node.js. It should be possible to combine some of these techniques, such as using the future-native Realm inside a Worker inside a sandboxed iframe EXCEPTION HANDLING IN EMSCRIPTEN: HOW IT WORKS AND WHY IT One of my “fun” projects I’m poking at on the side is an x86-64 emulator for the web using WebAssembly (not yet online, nowhere near working). I’ve done partial spike implementations in C++ and Rust with a handful of interpreted opcodes and emulation of a couple Linux syscalls; this is just enough for a hand-written “Hello, world!”executable.
WASM RPC THOUGHTS
Wasm Instance Wasm code Wasm Instance Wasm Memory Wasm code When dynamic linking, instances can share a memory and send pointers directly to each others' functions. BRAIN DUMP: JAVASCRIPT SANDBOXING The two main ‘more restricted sandbox’ possibilities are to run an interpreter that handles loops safely and applies resource limits, or to run in a worker thread that doesn’t block the main UI and can be terminated after a timeout. but even that may be WINDOWS 10 ON ARM64 TESTING Windows 10 on ARM64 testing. I’ve been curious about ARM64 (aarch64) and whether it’s up to the task of a modern, modest laptop for a while finally picked up one of the second-generation Snapdragon 850-based Windows 10 “Always Connected PCs”, a Lenovo Yoga C630. It’s available in an 8gb RAM configuration which was enough to dosome
RUST ERROR HANDLING WITH RESULT AND OPTION (WEBASSEMBLY In our last adventure we looked at C++ exceptions in WebAssembly with the emscripten compiler.Now we’re taking a look at the main error handling system for another JAVASCRIPT ENGINE INTERNALS PART 3: GARBAGE COLLECTION JavaScript engine internals part 3: garbage collection. Another part of implementing a JavaScript-like engine to run inside a WebAssembly sandbox is memory management: JS requires garbage collection because objects may hold references to each other, creating cycles that simpler schemes like reference counting can’t break. PARALLELIZING PNG, PART 6: RUST SLICES AND LOOP Looking at interesting patterns and bottlenecks I discover working on a multithreaded PNG encoder in Rust. A common pattern in low-level code is passing around references to data buffers that are owned somewhere higher up the call chain. VIDEO DECODING IN THE JAVASCRIPT PLATFORM: “OGV.JS, HOW U ogv.js’s player logic is handwritten JavaScript, but the guts of the demuxer and decoders are cross-compiled from well-supported, battle-tested C libraries. Emscripten is a magical tool developed at Mozilla to help port large C/C++ codebases like games to the web platform. In short, it runs your C/C++ code through the well-known OGV.JS EXPERIMENTAL AV1 DECODING The upcoming ogv.js 1.6.0 release will be the first to include experimental AV1 support, using the dav1d decoder. Thanks to ePirat for the initial work in emscripten cross-compiling the dav1d codebase! Performance is not very great, but may improve a bit in future from optimizations and potentially a lot from new platform features that may come to WebAssembly in the future. EMSCRIPTEN VERSUS IE 11: ARITHMETIC OPTIMIZATION FOR OGV ogv.js is a web video & audio playback engine for supporting the free & open Ogg and WebM formats in browsers that don’t support them natively, such as Safari, Edge, and Internet Explorer. We use it at Wikipedia and Wikimedia Commons, where we don’t currently allow the more common MP4 family of file formats due to patent concerns.WASM RPC THOUGHTS
void canvas_set_size(int w, int h) {global_state.w = w; global_state.h = h;} Foreign functions attached as imports or table entries can be called with any signature, combining scalar values such as intBRIONV
Before I was paid to work on code for a living, it was my hobby. My favorite project from when I was young, before The Internet came to the masses, was a support library for my other programs (little widgets, games, and utilities for myself): a loadable graphics driver system for VGA and SVGA cards, SURFACE PRO X THOUGHTS AFTER A FEW WEEKS BRAIN DUMP: X86 EMULATION IN WEBASSEMBLY This is a quick brain dump of my recent musings on feasibility of a WebAssembly-based in-browser emulator for x86 and x86-64 processors partially in the hopes of freeing up my brain for main project work.. My big side project for some time has been ogv.js, an in-browser video player framework which uses emscripten to cross-compile C libraries for the codecs into JavaScript or BRAIN DUMP: JAVASCRIPT SANDBOXING The two main ‘more restricted sandbox’ possibilities are to run an interpreter that handles loops safely and applies resource limits, or to run in a worker thread that doesn’t block the main UI and can be terminated after a timeout. but even that may be BRIONV – PAGE 10 – RETICULA, ELECTRONICA, & ODDITIES In addition to my in-browser ogv.js media player, I’ve got an OgvKit framework in progress for native iPhone and iPad apps, which I hope to integrate into Wikipedia’s new iOS app somewhere down the line. I took a little Independence Day holiday time and made a bunch of improvements from where I last left it a few months ago: JAVASCRIPT ENGINE INTERNALS: NAN-BOXING BUILDING CHROMIUM FOR WINDOWS ARM64 General Chromium on Windows build directions are very helpful, including telling you how to trigger the right components for Visual Studio setup. Follow all the directions! GN build configuration explains how to set configuration arguments like target_cpu, which you want to set to “ arm64 “. Tricky bits: I built with Visual Studio2019, but
WINDOWS 10 ON ARM64 TESTING Windows 10 on ARM64 testing. I’ve been curious about ARM64 (aarch64) and whether it’s up to the task of a modern, modest laptop for a while finally picked up one of the second-generation Snapdragon 850-based Windows 10 “Always Connected PCs”, a Lenovo Yoga C630. It’s available in an 8gb RAM configuration which was enough to dosome
DEFENDER OF THE REALM Getting a realm. There are a few possible ways we can manage to get ahold of a separate realm for our guest code: Un-sandboxed . Sandboxed . Web Worker thread. ‘vm’ module for Node.js. It should be possible to combine some of these techniques, such as using the future-native Realm inside a Worker inside a sandboxed iframe EXCEPTION HANDLING IN EMSCRIPTEN: HOW IT WORKS AND WHY IT One of my “fun” projects I’m poking at on the side is an x86-64 emulator for the web using WebAssembly (not yet online, nowhere near working). I’ve done partial spike implementations in C++ and Rust with a handful of interpreted opcodes and emulation of a couple Linux syscalls; this is just enough for a hand-written “Hello, world!”executable.
WASM RPC THOUGHTS
Wasm Instance Wasm code Wasm Instance Wasm Memory Wasm code When dynamic linking, instances can share a memory and send pointers directly to each others' functions. SURFACE PRO X THOUGHTS AFTER A FEW WEEKS BRAIN DUMP: X86 EMULATION IN WEBASSEMBLY This is a quick brain dump of my recent musings on feasibility of a WebAssembly-based in-browser emulator for x86 and x86-64 processors partially in the hopes of freeing up my brain for main project work.. My big side project for some time has been ogv.js, an in-browser video player framework which uses emscripten to cross-compile C libraries for the codecs into JavaScript or BRAIN DUMP: JAVASCRIPT SANDBOXING The two main ‘more restricted sandbox’ possibilities are to run an interpreter that handles loops safely and applies resource limits, or to run in a worker thread that doesn’t block the main UI and can be terminated after a timeout. but even that may be BRIONV – PAGE 10 – RETICULA, ELECTRONICA, & ODDITIES In addition to my in-browser ogv.js media player, I’ve got an OgvKit framework in progress for native iPhone and iPad apps, which I hope to integrate into Wikipedia’s new iOS app somewhere down the line. I took a little Independence Day holiday time and made a bunch of improvements from where I last left it a few months ago: JAVASCRIPT ENGINE INTERNALS: NAN-BOXING BUILDING CHROMIUM FOR WINDOWS ARM64 General Chromium on Windows build directions are very helpful, including telling you how to trigger the right components for Visual Studio setup. Follow all the directions! GN build configuration explains how to set configuration arguments like target_cpu, which you want to set to “ arm64 “. Tricky bits: I built with Visual Studio2019, but
WINDOWS 10 ON ARM64 TESTING Windows 10 on ARM64 testing. I’ve been curious about ARM64 (aarch64) and whether it’s up to the task of a modern, modest laptop for a while finally picked up one of the second-generation Snapdragon 850-based Windows 10 “Always Connected PCs”, a Lenovo Yoga C630. It’s available in an 8gb RAM configuration which was enough to dosome
DEFENDER OF THE REALM Getting a realm. There are a few possible ways we can manage to get ahold of a separate realm for our guest code: Un-sandboxed . Sandboxed . Web Worker thread. ‘vm’ module for Node.js. It should be possible to combine some of these techniques, such as using the future-native Realm inside a Worker inside a sandboxed iframe EXCEPTION HANDLING IN EMSCRIPTEN: HOW IT WORKS AND WHY IT One of my “fun” projects I’m poking at on the side is an x86-64 emulator for the web using WebAssembly (not yet online, nowhere near working). I’ve done partial spike implementations in C++ and Rust with a handful of interpreted opcodes and emulation of a couple Linux syscalls; this is just enough for a hand-written “Hello, world!”executable.
WASM RPC THOUGHTS
Wasm Instance Wasm code Wasm Instance Wasm Memory Wasm code When dynamic linking, instances can share a memory and send pointers directly to each others' functions. BRAIN DUMP: JAVASCRIPT SANDBOXING The two main ‘more restricted sandbox’ possibilities are to run an interpreter that handles loops safely and applies resource limits, or to run in a worker thread that doesn’t block the main UI and can be terminated after a timeout. but even that may be WINDOWS 10 ON ARM64 TESTING Windows 10 on ARM64 testing. I’ve been curious about ARM64 (aarch64) and whether it’s up to the task of a modern, modest laptop for a while finally picked up one of the second-generation Snapdragon 850-based Windows 10 “Always Connected PCs”, a Lenovo Yoga C630. It’s available in an 8gb RAM configuration which was enough to dosome
RUST ERROR HANDLING WITH RESULT AND OPTION (WEBASSEMBLY In our last adventure we looked at C++ exceptions in WebAssembly with the emscripten compiler.Now we’re taking a look at the main error handling system for another JAVASCRIPT ENGINE INTERNALS PART 3: GARBAGE COLLECTION JavaScript engine internals part 3: garbage collection. Another part of implementing a JavaScript-like engine to run inside a WebAssembly sandbox is memory management: JS requires garbage collection because objects may hold references to each other, creating cycles that simpler schemes like reference counting can’t break. PARALLELIZING PNG, PART 6: RUST SLICES AND LOOP Looking at interesting patterns and bottlenecks I discover working on a multithreaded PNG encoder in Rust. A common pattern in low-level code is passing around references to data buffers that are owned somewhere higher up the call chain. VIDEO DECODING IN THE JAVASCRIPT PLATFORM: “OGV.JS, HOW U ogv.js’s player logic is handwritten JavaScript, but the guts of the demuxer and decoders are cross-compiled from well-supported, battle-tested C libraries. Emscripten is a magical tool developed at Mozilla to help port large C/C++ codebases like games to the web platform. In short, it runs your C/C++ code through the well-known OGV.JS EXPERIMENTAL AV1 DECODING The upcoming ogv.js 1.6.0 release will be the first to include experimental AV1 support, using the dav1d decoder. Thanks to ePirat for the initial work in emscripten cross-compiling the dav1d codebase! Performance is not very great, but may improve a bit in future from optimizations and potentially a lot from new platform features that may come to WebAssembly in the future. EMSCRIPTEN VERSUS IE 11: ARITHMETIC OPTIMIZATION FOR OGV ogv.js is a web video & audio playback engine for supporting the free & open Ogg and WebM formats in browsers that don’t support them natively, such as Safari, Edge, and Internet Explorer. We use it at Wikipedia and Wikimedia Commons, where we don’t currently allow the more common MP4 family of file formats due to patent concerns.WASM RPC THOUGHTS
void canvas_set_size(int w, int h) {global_state.w = w; global_state.h = h;} Foreign functions attached as imports or table entries can be called with any signature, combining scalar values such as intBRIONV
Before I was paid to work on code for a living, it was my hobby. My favorite project from when I was young, before The Internet came to the masses, was a support library for my other programs (little widgets, games, and utilities for myself): a loadable graphics driver system for VGA and SVGA cards, SURFACE PRO X THOUGHTS AFTER A FEW WEEKS BRAIN DUMP: X86 EMULATION IN WEBASSEMBLY This is a quick brain dump of my recent musings on feasibility of a WebAssembly-based in-browser emulator for x86 and x86-64 processors partially in the hopes of freeing up my brain for main project work.. My big side project for some time has been ogv.js, an in-browser video player framework which uses emscripten to cross-compile C libraries for the codecs into JavaScript or BRAIN DUMP: JAVASCRIPT SANDBOXING The two main ‘more restricted sandbox’ possibilities are to run an interpreter that handles loops safely and applies resource limits, or to run in a worker thread that doesn’t block the main UI and can be terminated after a timeout. but even that may be BRIONV – PAGE 10 – RETICULA, ELECTRONICA, & ODDITIES In addition to my in-browser ogv.js media player, I’ve got an OgvKit framework in progress for native iPhone and iPad apps, which I hope to integrate into Wikipedia’s new iOS app somewhere down the line. I took a little Independence Day holiday time and made a bunch of improvements from where I last left it a few months ago: JAVASCRIPT ENGINE INTERNALS: NAN-BOXING BUILDING CHROMIUM FOR WINDOWS ARM64 General Chromium on Windows build directions are very helpful, including telling you how to trigger the right components for Visual Studio setup. Follow all the directions! GN build configuration explains how to set configuration arguments like target_cpu, which you want to set to “ arm64 “. Tricky bits: I built with Visual Studio2019, but
WINDOWS 10 ON ARM64 TESTING Windows 10 on ARM64 testing. I’ve been curious about ARM64 (aarch64) and whether it’s up to the task of a modern, modest laptop for a while finally picked up one of the second-generation Snapdragon 850-based Windows 10 “Always Connected PCs”, a Lenovo Yoga C630. It’s available in an 8gb RAM configuration which was enough to dosome
DEFENDER OF THE REALM Getting a realm. There are a few possible ways we can manage to get ahold of a separate realm for our guest code: Un-sandboxed . Sandboxed . Web Worker thread. ‘vm’ module for Node.js. It should be possible to combine some of these techniques, such as using the future-native Realm inside a Worker inside a sandboxed iframe EXCEPTION HANDLING IN EMSCRIPTEN: HOW IT WORKS AND WHY IT One of my “fun” projects I’m poking at on the side is an x86-64 emulator for the web using WebAssembly (not yet online, nowhere near working). I’ve done partial spike implementations in C++ and Rust with a handful of interpreted opcodes and emulation of a couple Linux syscalls; this is just enough for a hand-written “Hello, world!”executable.
WASM RPC THOUGHTS
Wasm Instance Wasm code Wasm Instance Wasm Memory Wasm code When dynamic linking, instances can share a memory and send pointers directly to each others' functions. SURFACE PRO X THOUGHTS AFTER A FEW WEEKS BRAIN DUMP: X86 EMULATION IN WEBASSEMBLY This is a quick brain dump of my recent musings on feasibility of a WebAssembly-based in-browser emulator for x86 and x86-64 processors partially in the hopes of freeing up my brain for main project work.. My big side project for some time has been ogv.js, an in-browser video player framework which uses emscripten to cross-compile C libraries for the codecs into JavaScript or BRAIN DUMP: JAVASCRIPT SANDBOXING The two main ‘more restricted sandbox’ possibilities are to run an interpreter that handles loops safely and applies resource limits, or to run in a worker thread that doesn’t block the main UI and can be terminated after a timeout. but even that may be BRIONV – PAGE 10 – RETICULA, ELECTRONICA, & ODDITIES In addition to my in-browser ogv.js media player, I’ve got an OgvKit framework in progress for native iPhone and iPad apps, which I hope to integrate into Wikipedia’s new iOS app somewhere down the line. I took a little Independence Day holiday time and made a bunch of improvements from where I last left it a few months ago: JAVASCRIPT ENGINE INTERNALS: NAN-BOXING BUILDING CHROMIUM FOR WINDOWS ARM64 General Chromium on Windows build directions are very helpful, including telling you how to trigger the right components for Visual Studio setup. Follow all the directions! GN build configuration explains how to set configuration arguments like target_cpu, which you want to set to “ arm64 “. Tricky bits: I built with Visual Studio2019, but
WINDOWS 10 ON ARM64 TESTING Windows 10 on ARM64 testing. I’ve been curious about ARM64 (aarch64) and whether it’s up to the task of a modern, modest laptop for a while finally picked up one of the second-generation Snapdragon 850-based Windows 10 “Always Connected PCs”, a Lenovo Yoga C630. It’s available in an 8gb RAM configuration which was enough to dosome
DEFENDER OF THE REALM Getting a realm. There are a few possible ways we can manage to get ahold of a separate realm for our guest code: Un-sandboxed . Sandboxed . Web Worker thread. ‘vm’ module for Node.js. It should be possible to combine some of these techniques, such as using the future-native Realm inside a Worker inside a sandboxed iframe EXCEPTION HANDLING IN EMSCRIPTEN: HOW IT WORKS AND WHY IT One of my “fun” projects I’m poking at on the side is an x86-64 emulator for the web using WebAssembly (not yet online, nowhere near working). I’ve done partial spike implementations in C++ and Rust with a handful of interpreted opcodes and emulation of a couple Linux syscalls; this is just enough for a hand-written “Hello, world!”executable.
WASM RPC THOUGHTS
Wasm Instance Wasm code Wasm Instance Wasm Memory Wasm code When dynamic linking, instances can share a memory and send pointers directly to each others' functions. BRAIN DUMP: JAVASCRIPT SANDBOXING The two main ‘more restricted sandbox’ possibilities are to run an interpreter that handles loops safely and applies resource limits, or to run in a worker thread that doesn’t block the main UI and can be terminated after a timeout. but even that may be WINDOWS 10 ON ARM64 TESTING Windows 10 on ARM64 testing. I’ve been curious about ARM64 (aarch64) and whether it’s up to the task of a modern, modest laptop for a while finally picked up one of the second-generation Snapdragon 850-based Windows 10 “Always Connected PCs”, a Lenovo Yoga C630. It’s available in an 8gb RAM configuration which was enough to dosome
RUST ERROR HANDLING WITH RESULT AND OPTION (WEBASSEMBLY In our last adventure we looked at C++ exceptions in WebAssembly with the emscripten compiler.Now we’re taking a look at the main error handling system for another JAVASCRIPT ENGINE INTERNALS PART 3: GARBAGE COLLECTION JavaScript engine internals part 3: garbage collection. Another part of implementing a JavaScript-like engine to run inside a WebAssembly sandbox is memory management: JS requires garbage collection because objects may hold references to each other, creating cycles that simpler schemes like reference counting can’t break. PARALLELIZING PNG, PART 6: RUST SLICES AND LOOP Looking at interesting patterns and bottlenecks I discover working on a multithreaded PNG encoder in Rust. A common pattern in low-level code is passing around references to data buffers that are owned somewhere higher up the call chain. VIDEO DECODING IN THE JAVASCRIPT PLATFORM: “OGV.JS, HOW U ogv.js’s player logic is handwritten JavaScript, but the guts of the demuxer and decoders are cross-compiled from well-supported, battle-tested C libraries. Emscripten is a magical tool developed at Mozilla to help port large C/C++ codebases like games to the web platform. In short, it runs your C/C++ code through the well-known OGV.JS EXPERIMENTAL AV1 DECODING The upcoming ogv.js 1.6.0 release will be the first to include experimental AV1 support, using the dav1d decoder. Thanks to ePirat for the initial work in emscripten cross-compiling the dav1d codebase! Performance is not very great, but may improve a bit in future from optimizations and potentially a lot from new platform features that may come to WebAssembly in the future. EMSCRIPTEN VERSUS IE 11: ARITHMETIC OPTIMIZATION FOR OGV ogv.js is a web video & audio playback engine for supporting the free & open Ogg and WebM formats in browsers that don’t support them natively, such as Safari, Edge, and Internet Explorer. We use it at Wikipedia and Wikimedia Commons, where we don’t currently allow the more common MP4 family of file formats due to patent concerns.WASM RPC THOUGHTS
void canvas_set_size(int w, int h) {global_state.w = w; global_state.h = h;} Foreign functions attached as imports or table entries can be called with any signature, combining scalar values such as intBRIONV
Before I was paid to work on code for a living, it was my hobby. My favorite project from when I was young, before The Internet came to the masses, was a support library for my other programs (little widgets, games, and utilities for myself): a loadable graphics driver system for VGA and SVGA cards,Skip to content
BRIONV
reticula, electronica, & odditiesMenu and widgets
BLOGROLL
* MediaWiki
* mtpng
* ogv.js
* OGVKit
META
* Log in
* Entries feed
* Comments feed
* WordPress.org
SURFACE PRO X THOUGHTS AFTER A FEW WEEKS After a few weeks using the fancy new Windows 10 ARM64 tablet, the Surface Pro X, I’ve got a few thoughts. Mostly good so far, but it remains an early adopter device with a few rough edges (virtually — the physical edges are smooth and beautiful!) Note that my use cases are not everyone’s use cases, so some people will have even more luck, or even less luck, getting things working. :) Your mileage canand will vary.
HARDWARE
It’s just gorgeous. Too gorgeous. It’s all black-on-black labeled with black type. Mostly this is fine, but I find it hard to find the USB-C ports on the left side when I’ve got it propped up on itsstand. :)
Seriously though, my biggest hardware complaint is that the bezels are too small for its size when holding as a tablet in the hands — I keep hitting the corners with my fat hands and opening the start menu or closing an app. I’m still not 100% sold on the idea of tablets-with-keyboards at this size (13″ diagonal or so). But for watching stuff, the screen is *fantastic*. The 3:2 aspect ratio is also much better for anything that’s not video, while still not feeling like I’ve wasted much space on a 16:9 letterbox. The keyboard attachment is pretty good. Get it. GET IT. I got the one that also has the cradle for the pen, which I never use but felt like I had to try out. If I did more art I would probably use it. PERFORMANCE AND EMULATION The CPU is really good. It’s got a huge speed boost over the Snapdragon 835 and 850 in older ARM64 Windows machines, and feels very snappy in native apps like Firefox or the new Edge. With 4 high-power CPU cores and 4 low-power cores, it handles multithreaded workloads fairly well unless they get confused by the scheduler… I’ve sometimes seen things have background threads get pushed to the low-power cores where they take a long time to run. (In Task Manager, you can see the first 4 cores are the low-power cores, the next 4 are high-power.) x86 Windows software is supported via emulation, both for store apps and regular win32 apps you find anywhere. But not everything works. I’ve generally had good luck with tools and applications – Visual Studio, VS Code, Chrome, Git for Windows, Krita, Inkscape all run. But about 1/2 of the Steam games I tried failed to run, maybe more. And software that’s x64-only won’t run at all, as there’s no emulator support for 64-bit code. Emulated code in my unscientific testing runs 2-3 times slower than native code on sustained loops, but you can expect loading-time stuff to be slower because things have to get traced/compiled on the first run through or when code is modified in memory. Nonetheless, 2-3 times slower than really-fast is still not-bad, and for UI-heavy or i/o-heavy applications it’s not too significant. I’ve had no real complaints using the x86 VS Code front-end, but more complaints with, say, compiling things in Visual Studio. :)WEB USE CASE
Most of what I use a computer for these days is in a web browser environment, so “using the web” is big. Firefox has an optmized, native ARM64 build. Works great. ’nuff said. Oh also Edge preview builds in the Dev and Canary channel are ARM64 native and run great, if you like that sort of thing. Chrome, however, has not released a native build and will run in x86 emulation. If you need Chrome specifically it *will install and run* but it will be slow. Do not grab custom Chromium builds unless you’re using them only for testing, as they will not be secure orget updated!
DEVELOPER USE CASE
I’m a software developer, so in addition to “everything that goes in a web browser” I need to use tools to work on a combination ofstuff, mostly:
* PHP and client-side JavaScript code (MediaWiki, a few other bits) * weird science C / JavaScript / emscripten / WebAssembly stuff (ogv.js, which plugs into MediaWiki’s video player extension) * research work in Rust (mtpng threaded PNG compressor)LAMP STUFF
I’m used to working in either a macOS or Linux environment, with Unix-like command line tools and usually a separate GUI text editor like Visual Studio Code, and never had good experiences trying to run the MediaWiki LAMP-stack tools on a Windows environment in years past. Even with Vagrant managing a VM, it had proved more fragile on Windows for me than on Mac or Linux. WSL (Windows Subsystem for Linux) has changed that. I can run a Debian or Ubuntu system with less overhead and better integration to the host system than running in a traditional VM like VirtualBox or Hyper-V. On the Surface Pro X, you get the aarch64 distribution of Ubuntu or Debian (or whatever other supporting distro you choose to install) so it runs full speed, with no emulation overhead. I’ve been using a MediaWiki git checkout in an Ubuntu setup, using the standard PHP/Apache/MySQL/whatevers and manually running git & composer updates. The main downside to using WSL here is that services don’t get started automatically because it doesn’t run the traditional init process, but “service mysql start” etc works as expected and gets you working. For editing, I use Visual Studio Code. This is not yet available as an ARM64 optimized build (the x86 frontend runs in emulation), but does in 1.41 now include ARM64 support for WSL integration — which means you can run the PHP linter on your code running inside the Linux environment while your editor frontend is a native Windows GUI app. No wacky X11 hacks required.EMSCRIPTEN STUFF
The emscripten compiler for WebAssembly stuff works great, but doesn’t ship ARM or ARM64 builds for any platform yet in the emsdktool.
You can build manually from source for now, and hopefully I can get builds working from the emsdk installer too (though you still would have to run the build yourself). The main annoyance I had was that Ubuntu LTS currently ships an old node.js, which I had to supplement with a newer build to get my environment the way I wanted it for my scripts. :) This was prettystraightforward.
RUST STUFF
Rust includes support for building code for Windows ARM64 — it has to to support things like Firefox! — but the compiler & tools distribution comes as x86. I’m sure this will eventually get worked out, but for now if you install Rust on Windows you’ll get the x86 build and may have to manually add the aarch64 target. But it does work — I can compile and run my mtpng project for Windows 10 ARM64on the device.
Within a WSL environment, you can install Rust for Linux aarch64 and it “just works” as you’d expect, as well.FINAL NOTES
All in all, pretty happy with it. I might have preferred a Surface Laptop X with similar specs but a built-in keyboard, but at a desk or other …. “surface” … it works fine for typey things likeprogramming.
Certainly I prefer the keyboard to the keyboard on my 2018 MacBookPro. ;)
Posted on December 19, 2019Author
brion Categories Uncategorized OVERFLOWING STACKS IN WEBASSEMBLY, WHOOPS! Native C-like programming environments tend to divide memory intoseveral regions:
* static data contains predefined constants loaded from the binary, and space for global variables (“data”) * your actual code has to go in memory too! (“text”) * space for dynamic memory allocation (“heap”), which may grow “up” as more memory is needed * space for temporary data and return addresses for function calls (“stack”), which may grow “down” as more memory is needed Usually this is laid out with the stack high in the address space and the heap lower in the address space, if I recall correctly? Allocating more heap is done when you need it via malloc, and the stack can either grow or warn of an overflow by using the CPU’s memory manager to detect use of data pages incremented beyond the edge of the stack. In emscripten’s WebAssembly porting environment, things are similar but a little different: * code doesn’t live in linear memory, so functions don’t havememory addresses
* because code return addresses and small local variables also live separately, only arrays/structs and vars with address taken must be onstack.
* usable memory is continguous; you can’t have a sparse address space where stack and heap can both grow. As a result, the stack is fixed size and there’s some fragility, but the stack uses less space usually. Currently the memory layout is to start with static data, follow with the stack, and then the heap. The stack grows “down”, meaning when you reach the end of the stack you end up in static data territory and can overwrite global variables. This leads to weird, hard to detecterrors.
When making debug builds with assertions there are some “cookie” checks to ensure that some specific locations at the edge of the stack have not been overwritten at various times, but this doesn’t always catch things if you only overwrote the beginning of a buffer in static data and not the part that had the cookie. :) It also doesn’t seem to trigger on library workflows where you’re not running through the emscripten HTML5/SDL/WebGL runtime. There’s currently a PR open to reduce the default stack sizefrom 5 MiB
to 0.5 MiB, which reduces the amount of memory needed for small modules significantly, and we’re chatting a bit about detecting errors in the case that codebases have regressions… One thing that’s come up is the possibility of moving the stack to before static data, so you’d have: stack, static data, heap. This has two consequences: * any memory access beyond the stack end will wrap around 0 into unallocated memory at the top of the address space, causing an immediate trap — this is done by the memory manager for free, with no false positives or negatives * literal references to addresses in static data will be larger numbers, thus may take more bytes to encode in the binary (variable-length encoding is used in WebAssembly for constants) Probably the safety and debugging win would be a bigger benefit than the size savings, though potentially that could be a win for size-conscience optimizations when not debugging. Posted on December 13, 2019December 13, 2019Author
brion Categories Uncategorized RUST ERROR HANDLING WITH RESULT AND OPTION (WEBASSEMBLY ABI) In our last adventure we looked at C++ exceptions in WebAssembly with the emscripten compiler.
Now we’re taking a look at the main error handling system for another language targeting WebAssembly, RUST.
Rust has a “panic”/”unwind” system similar to C++ exceptions, but it’s generally recommended against catching panics. It also currently doesn’t work in WebAssembly output, where Rust doesn’t use emscripten’s tricks of calling out to JavaScript and is waiting for proper exception integration to arrive in Wasm. Instead, most user-level Rust code expresses fallible operations using the Result or Option enum types. An Option}
pub fn store_8(&mut self, addr: GuestPtr, val: u8) -> Result<(), Exception> { // First some address calculations which cannot fail. let index = addr_to_index(addr); let page = addr_to_page(addr); let mem = self.page_for_write(page)?; // The "?" operator checked for an Err(_) condition // and if so, propagated it to the caller. If it was // Ok(_) then we continue on with that value. mem.store_8(index, val);Ok(())
}
This looks reasonably clean in the source — you have some ?s sprinkled about but they indicate that a branch may occur, which is good to help reason about the performance. This makes things more predictable when you look at it — addition of a destructor in C++ might make a fast path suddenly slow with emscripten’s C++/JavaScript hybrid exceptions, while the worst that happens here is a visible flag check which is not so bad, right? Well, mostly. The beautiful, yet horrible thing about Rust is that automatic optimization lets you create these wonderful clean conceptual APIs that compile down to fast code. The horrible part is that you sometimes don’t know how or why it’s doing what, and there can still be surprises! The good news is that there’s never any JavaScript call-outs in your hot paths, unlike emscripten’s C++ exception catching. Yay! But the bad news is that in WebAssembly, returning a structure like a Resultthem.
For Optionthis.
PACKED ENUMS IN SINGLE WORDS I’ve also sometimes seen Result enums get packed into a single word, and I don’t yet understand the circumstances that this happens. On a WebAssembly build, I’ve had it happen with Resultinteger.
On native x86-64 builds on macOS, I see the word packing for both Resultregisters.
I know the internals of Rust layout and calling conventions are officially undocumented and can change, but it’d be nice to know roughly what some of them are. ;) FURTHER INFORMATION ON RUST LAYOUT AND ABI * enums – Unsafe code guidelines for Rust * rust/src/librustc_target/abi* …???
Posted on October 27, 2019Author
brion Categories Uncategorized EXCEPTION HANDLING IN EMSCRIPTEN: HOW IT WORKS AND WHY IT’S DISABLEDBY DEFAULT
One of my “fun” projects I’m poking at on the side is an X86-64 EMULATOR for the web using WebAssembly (not yet online, nowhere near working). I’ve done partial spike implementations in C++ and Rust with a handful of interpreted opcodes and emulation of a couple Linux syscalls; this is just enough for a hand-written “Hello, world!”executable. ;)
One of the key questions is how to handle exceptional conditions within the emulator, such as an illegal instruction, page fault, etc… There are multiple potentially fallible operations within the execution of a single opcode, so the method chosen to communicate those exceptions could make a big impact on performance. For C++, one method which LOOKS NICE in the source code and can be good on native platforms is to use C++’s normal exception facility. This turns out to be somewhat problematic in emscripten builds for WebAssembly, which is explained by looking at its implementation. In fact it’s considered enough of a performance problem that catching exceptions is disabled by default in emscripten — throwing will abort the program with no way to catch it except at the surrounding JavaScript host page level. To get exceptions to actually work, you must pass -s DISABLE_EXCEPTION_CATCHING=0 to the compiler.THROWING IS EASY
Let’s write ourselves a potentially-throwing function: static volatile int should_explode = 0;void kaboom() {
if (should_explode) {throw "kaboom";
}
}
Pretty exciting! The volatile int is just to make sure the optimizer doesn’t do anything clever for us, as real world functions don’t _always_ or _never_ throw, they _sometimes_ throw. At -O1 this compiles to WebAssembly something like this: (func $kaboom\28\29 (; 26 ;) (type $11)(local $0 i32)
(if
(i32.load
(i32.const 13152)
)
(block
(i32.store
(local.tee $0
(call $__cxa_allocate_exception(i32.const 4)
)
)
(i32.const 1024)
)
(call $__cxa_throw
(local.get $0)
(i32.const 12432)
(i32.const 0)
)
(unreachable)
)
)
)
The function $__cxa_throw calls into emscripten’s JavaScript-side runtime to throw a native JS exception. That’s right, WebAssembly doesn’t have a way to throw — or catch — an exception itself. Yet. They’re working on it, but it’s notdone yet.
CALLING BEST CASE
So now we want to call that function. In the best case scenario, there’s a function that doesn’t have any cleanup work to do after a potentially throwing call: no try/catch clauses, no destructors, no stack allocations to clean up. void dostuff_nocatch() { printf("Doing nocatch stuff\n");kaboom();
printf("Possibly unreachable stuff\n");}
This compiles to nice, simple, fast code with a direct call to kaboom: (func $dostuff_nocatch\28\29 (; 32 ;) (type $11)(drop
(call $puts
(i32.const 1106)
)
)
(call $kaboom\28\29)(drop
(call $puts
(i32.const 1126)
)
)
)
If kaboom throws, the JavaScript + WebAssembly runtime unwinds the native call stack up through dostuff_nocatch until whatever surrounding code (if any) catches it. The second printf/puts call never gets made, as expected. CATCHING GETS CLEVER But if you have variables with destructors, as with the RAII pattern, or a try/catch block, things get weird fast. void dostuff_catch() {try {
printf("Doing ex stuff\n");kaboom();
} catch (const char *e) { printf("Caught stuff\n");}
}
compiles to the much longer: (func $dostuff_catch\28\29 (; 27 ;) (type $11)(local $0 i32)
(drop
(call $puts
(i32.const 1078)
)
)
(i32.store
(i32.const 14204)
(i32.const 0)
)
(call $invoke_v
(i32.const 1)
)
(local.set $0
(i32.load
(i32.const 14204)
)
)
(i32.store
(i32.const 14204)
(i32.const 0)
)
(block $label$1
(if
(i32.eq
(local.get $0)
(i32.const 1)
)
(block
(local.set $0
(call $__cxa_find_matching_catch_3(i32.const 12432)
)
)
(br_if $label$1
(i32.ne
(call $getTempRet0) (call $llvm_eh_typeid_for(i32.const 12432)
)
)
)
(drop
(call $__cxa_begin_catch(local.get $0)
)
)
(drop
(call $puts
(i32.const 1093)
)
)
(call $__cxa_end_catch))
)
(return)
)
(call $__resumeException(local.get $0)
)
(unreachable)
)
A few things to note. Here the direct call to kaboom is replaced with a call to the indirected invoke_v function:(call $invoke_v
(i32.const 1)
)
which is implemented in the JS runtime to wrap a try/catch around thecall:
function invoke_v(index) { var sp = stackSave();try {
dynCall_v(index);
} catch(e) {
stackRestore(sp);
if (e !== e+0 && e !== 'longjmp') throw e;_setThrew(1, 0);
}
}
Note this saves the stack position (in Wasm linear memory, for stack-allocated data — separate from the native/JS/Wasm call stack) and restores it, which allows functions that allocate stack data to participate in the faster call mode by not having to clean up their own stack pointer modifications. If an exception is caught, a global flag is set which is checked and re-cleared after the call: ;; Load the threw flag into a local variable(local.set $0
(i32.load
(i32.const 14204)
)
)
;; Clear the threw flag for the next call(i32.store
(i32.const 14204)
(i32.const 0)
)
;; Branch based on the stored state(block $label$1
(if
(i32.eq
(local.get $0)
(i32.const 1)
)
....
)
)
If the flag wasn’t set after all, then the function continues on its merry way. If it was set, then it does its cleanup and either eats the exception (for catch) or re-throws it (for automatic cleanup likedestructors).
SUMMARY AND SURPRISES So there’s several things that’ll slow down your code using C++ exception catching in emscripten, even if you never throw in the hotpaths:
* when catching, potentially throwing calls are indirected throughJavaScript
* destructors create implicit catch blocks, so you may be catchingmore than you think
There’s also some surprises: * in C++, every extern “C” function is potentially throwing! * “noexcept” functions that call potentially throwing functions add implicit catch blocks in order to call abort(), so they can guarantee that they do not throw exceptions themselves So don’t just add “noexcept” to code willy-nilly or it may getworse.
It would be faster to use my own state flag and check it after every call (which could be hidden behind a template or a macro or something, probably, at least in part), since this would avoid calling out through JavaScript and indirecting all the calls. Next I’ll look at another way in the Rust version, using ResultAuthor
brion Categories Uncategorized BUILDING CHROMIUM FOR WINDOWS ARM64 I heard a couple months back that someone had confirmed that you can build Chromium (open-source version of Chrome browser) for Windows ARM64… Since there’s still no general release, figured I’d give it a shot to test things in. You have to build on Windows x64 (it won’t build on-device, it’d be too slow and may require running some x64 binaries from the tooling which wouldn’t work) and then copy the output over to an ARM64device.
Some resources:
* General Chromium on Windows build directions are very helpful, including telling you how to trigger the right components for Visual Studio setup. Follow all the directions! * GN build configurationexplains
how to set configuration arguments like TARGET_CPU, which you want toset to “ARM64“.
Tricky bits:
* I built with Visual Studio 2019, but something in the build setup seems to want Visual Studio 2017’s C runtime library? Or something? Anyway I had to change a couple references in BUILD/VS_TOOLCHAIN.PY from ‘Microsoft.VC141.CRT’ to ‘Microsoft.VC142.CRT’ and *.DebugCRT because I could not get it to look in the directory where the VC141 files were. * If you don’t turn on USE_JUMBO_BUILD it will take a vveerryy lloonngg time. If you do, though, it will use more memory. Beware. * I had a lot of problems with the provided python instance not picking up imports from the depot_tools package, even after removing my other Python instances. Had to set PYTHONPATH=C:\SRC\DEPOT_TOOLS My gn args for the build were: # Required or else it defaults to x64 target_cpu = "arm64" # To get a release-quality build for benchmarkingis_debug = false
is_component_build = false # Coalesce multiple files and skip the Native Client stuff which won't be used in testing use_jumbo_build = true enable_nacl = false I copied the resulting output directory over to the ARM64 machine in the morning; cd into the out dir and just run “chrome” and bam itworks!
After enabling SIMD in chrome://flags, I tested ogv.js’s WebAssembly version of the dav1d AV1 decoder, with excellent results. Matching my earlier experiments with the Linux version under WSL (where I couldn’t get playback working due to missing audio and slow X11 drawing, but decoding benchmarks worked) I see decode times about 2x as fast as Firefox (which only uses a baseline compiler on ARM64, so isn’t as well optimized). Enabling SIMD roughly doubles the throughput… and enabling threading roughly doubles it again. As a result, I can get 720p24 AV1 video decoding and playing in WebAssembly fairly stably, with a few dropped frames here and there:That’s not bad!
Very very much hoping that WebAssembly threading and SIMD will come to Safari, where we use ogv.js to play Ogg/WebM/VP9 (and in future AV1) video clips for Wikipedia. The recent model iPad and iPhone ARM64 chips are already amazing, and both desktops and mobiles will benefit from the performance improvements. Also very much looking forward to Chrome and Edge coming to native ARM64 Windows. And looking forward to Firefox’s next-gen code generation engine, cranelift, improving their situation on thesechips…. :)
Posted on August 15, 2019Author
brion Categories Uncategorized WINDOWS 10 ON ARM64 TESTING I’ve been curious about ARM64 (aarch64) and whether it’s up to the task of a modern, modest laptop for a while… finally picked up one of the second-generation Snapdragon 850-based Windows 10 “Always Connected PCs”, a Lenovo Yoga C630. It’s available in an 8gb RAM configuration which was enough to do some light development on, so I couldn’t help myself… First thoughts on the machine: it’s not sure whether it’s a low-end or high-end product. Some aspects of it feel cheap, but nothing feels or works badly. The touchpad is decent enough, the keyboard is ok, and the 13″ 1080p screen is nicely colorful but feels a bit off. Some solid color areas look like it’s dithering visibly, which I’ve seen on cheaper LCDs. Speakers are definitely tinny. Fingerprint reader works ok for sign-in if you like that sortof thing.
First thoughts on the OS: it’s “just Windows 10”. :D Setup experience is like any other Win10 machine. It does start in “S mode” which limits you to store apps and built-ins… but you can switch that off in Settings at no cost. This, I must point out, is where things fundamentally diverge from Microsoft’s previous Windows on ARM attempt, the Windows 8-era Windows RT. RT could not turn off the store restriction or the MS-signed restriction for Win32 apps, so you could only run Office (Win32) and whatever was in the Store (not much in those days). In addition to being able to now run native ARM or ARM64 binaries — like Firefox! — from outside the store, you can now run 32-bit x86 binaries. Since most Windows software still ships 32-bit x86, this gives you a wide compatibility range. I installed Git for Windows, the Rust compiler, Visual Studio, all kinds of developer crud! And, for extra fun the Windows Subsystem for Linux (version 1) is available, able to run aarch64 Linux binaries. I was able to build some of my test projects as well as real-world things like emscripten with Clang/LLVM under Ubuntu-in-WSL, running natively. I was also able to enable the Windows Insider program to get the latest beta builds; ARM64 almost feels like a native part of theWindows ecosystem.
Well, sorta. :D
There are pain points. Emulated programs run a bit slower. Native binaries are rare. Building with Visual Studio is awkward because there’s no native ARM build tools, just cross tools you must run under emulation. If you wanted to do virtual machines in development, you’re stuck because there’s no Hyper-V on ARM64 (yet?). But there are big pluses: battery life seems long, there’s built-in LTE which “just works” once set up, and the Linux environment should be adequate for a manual MediaWiki dev setup. Performance of the CPU is surprisingly decent, though single-threaded throughput is slower than the A11 in my iPhone X. It also throttles pretty aggressively, shutting down some of the “big” powerful cores after a few seconds of sustained usage and diverting more threads to the “little” low-power cores. This makes things like an LLVM compile a lot slower than they’d be running full-tilt in a server or workstation environment. For a fanless laptop that’s good thermal management, but beware. All in all I think I’m going to enjoy fiddling with this machine, and will find it useful for travel thanks to its light weight, LTE, and USB-C charging. But I can’t help think it’d be twice as cool if it ran stock Fedora or Ubuntu as the main OS. ;) (I have no idea if that’s theoretically possible if you disable secure boot. I’ll leave it as an exercise to someone!) Posted on June 16, 2019Author
brion Categories UncategorizedWASM RPC THOUGHTS
I spent far too much time lately going down a rabbit hole thinking about how to do a safe, reasonably efficient, reasonably sane API for cross-WebAssembly-module function calls and data transfer… this would allow a Wasm or JS “app” to interact with Wasm “plugins” with certain guarantees about the plugin’s ability to access host memory and functions. Ended up putting together a fake “slide deck” to explain it to myself, which y’all are welcome to enjoy below. :) I’ll keep this going in the background while I’m catching up on other stuff, then get it back up and running with my plugin researchlater.
Wasm-RPC-thoughts
Download
Posted on May 10, 2019Author brion
Categories Uncategorized SIMD IN WEBASSEMBLY – TALES FROM THE BLEEDING EDGE While benchmarking the AV1 and VP9 video decoders in ogv.js,
I bemoaned the lack of SIMD vector operations in WebAssembly. Native builds of these decoders lean heavily on SIMD (AVX and SSE for x86, Neon for ARM, etc) to perform operations on 8 or 16 pixels at once… Turns out there has been movement on the WebAssembly SIMD proposalafter all!
Chrome’s V8 engine has implemented it (warning: somewhat buggy still), and the upstream LLVM Wasm code generator will generate code for it using clang’s vector operations and some intrinsic functions.EMSCRIPTEN SETUP
The first step in your SIMD journey is to set up your emscripten development environment for the upstream compiler backend. Installemsdk via git
— or
update it if you’ve got an old copy. Be sure to update the tags as well: ./emsdk update-tags If you’re on Linux you can download a binary installation, but there’s a bug in emsdk that will cause it not to update. (UPDATE: this was fixed a few days ago, so make sure to update your emsdk!) ./emsdk install latest-upstream ./emsdk activate latest-upstream On Mac or Windows, or to install the latest upstream source on purpose, you can have it build the various tools from source. There’s not a convenient “sdk” catch-all tag for this that I can see, so you may need to call out all the bits: ./emsdk install emscripten-incoming-64bit ./emsdk activate emscripten-incoming-64bit ./emsdk install upstream-clang-master-64bit ./emsdk activate upstream-clang-master-64bit ./emsdk install binaryen-master-64bit ./emsdk activate binaryen-master-64bit First build may take a couple hours or so, depending on your machine. Re-running the install steps will update the git checkouts and re-build, which doesn’t take as long as a fresh build usually but can still take some time. UPSTREAM BACKEND DIFFERENCES Be warned that with the upstream backend, emscripten cannot build asm.js, only WebAssembly. If you’re making mixed JS & WebAssembly builds this may complicate your build process, because you have toswitch back.
You can switch back to the current fastcomp backend at any time by swapping your sdk state back: ./emsdk install latest ./emsdk activate latest Note that every time you switch, the cached libc will get rebuilt on your next emcc invocation. Currently there are some code-gen issues where the upstream backend produces more local variables and such than the older fastcomp backend, which can cause a slight slowdown in code of a few % (and for me, a bigger slowdown in Safari which does particularly well with the old compiler’s output). This is being actively worked on, and is expected to improve significantly soon.STARTING CHROME
Now you’ve got a compiler; you’ll also need a browser to run your code in. Chrome’s V8 includes support behind an experimental runtime flag; currently it’s not exposed to the user interface so you must pass it on the command line. I recommend using Chrome Canary on Mac or Windows, or a nightly Chromium build on Linux, to make sure you’ve got any fixes that may have come in recently. On Mac, one can start it like so: /Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary --js-flags="--experimental-wasm-simd" If you forget the command-line flag or get it wrong, the module compilation won’t validate the SIMD instructions and will throw an exception, so you can’t run by mistake. (This is also apparently how you’re meant to test for SIMD support presence, AFAIK… compile a module and see if it works?) Beware there are a few serious bugs in the V8 implementation, which may trip you up. In particular watch out for broken splat which can produce non-deterministic errors. For this reason I recommend disabling autovectorization for now, since you have no control of workarounds on the clang end. Non-constant bit shifts also fail to validate, requiring a scalar workaround.VECTOR OPS IN CLANG
If you’re not working in C/C++ but are implementing your own Wasm compiler or hand-writing Wasm source, skip this section! ;) You’ll want to checkout the SIMD proposal documentation for a list of available instructions. First, forget anything you may have heard about emscripten including MMX compatibility headers (xmmintrin.h etc). They’ve been recently removed as they’re broken and misleading. There’s also emscripten/vector.h but it seems obsolete as well with some references to functions that don’t exist that were from the old SIMD.js implementation, and I recommend avoiding it for now. The good news is, a bunch of vector stuff “just works” using standard clang syntax,
and there’s a few intrinsic functions for particular operations like the bitselect instruction and vector shuffling. First, take some plain ol’ code and compile it with SIMD enabled: emcc -o foo.html -O3 -s SIMD=1 -fno-vectorize foo.c It’s important for now to disable autovectorization since it tends to break on the V8 splat bug for me. In the future, you’ll want to leave it on to squeeze out the occasional performance increase without manual intervention. If you’re not using headers which predefine standard vector types for you, you can create some convenient aliases like so (these are just the types I’ve used so far): typedef int16_t int16x8 __attribute((vector_size(16))); typedef uint8_t uint8x16 __attribute((vector_size(16))); typedef uint16_t uint16x8 __attribute((vector_size(16))); typedef uint32_t uint32x4 __attribute((vector_size(16))); typedef uint64_t uint64x2 __attribute((vector_size(16))); The expected float and signed/unsigned integer interpretations for 128 bits are available, and you can freely cast between them to reinterpret bit sizes. To work around bugs in the “splat” operation that expands a scalar to a vector, I made inline helper functions for myself: static volatile int junk = 0; static inline int16x8 splat_const(const int16_t val) { // Use this only on constants due to the v8 splat bug!return (int16x8){
val, val, val, val, val, val, val, val};
}
static inline int16x8 splat_vec(const int16_t val) { // Try to work around issues with broken splat in V8 // by forcing the input to be something that won't be reused. const int guarded = val + junk;return (int16x8){
guarded, guarded, guarded, guarded, guarded, guarded, guarded, guarded};
}
Once the bug is fixed, it’ll be safe to remove the ‘junk’ and ‘guarded’ bits and use a single splat helper function. Though I’m sure there’s got to be a visibly clearer way to do a splat than manually writing out all the lanes and having the compiler coalesce them into a single splat operation? o_O The bitselect operation is also frequently necessary, especially since convenient operations like min, max, and abs aren’t available on integer vectors. You might or might not be able to do this some cleaner way without the builtin, but this seems to work: static inline int16x8 select_vec(const int16x8 cond,const int16x8 a,
const int16x8 b) { return (int16x8)__builtin_wasm_bitselect(a, b, cond);}
Note the order of parameters on the bitselect instruction and the builtin has the condition last — I found this maddening so my helper function has the condition first where my code likes it. You can now make your own vector abs function: static inline int16x8 abs_vec(const int16x8 v) { return select_vec(v < splat_const(0), -v, v);}
Note the < and – operators “just work” on the vectors,
we only needed helper functions for the bitselect and the splat. And I’m still not confident I need those two? You’ll also likely need the vector shuffle operation,
which there’s a standard builtin for. For instance here I’m deinterleaving 16-bit pixels into 8-bit pixels and the extra highbytes:
static inline uint8x16 merge_pixels(const int16x8 work) { return (uint8x16)__builtin_shufflevector((uint8x16)work, (uint8x16)work, 0, 2, 4, 6, 8, 10, 12, 14, // the 8 pixels we worked on 1, 3, 5, 7, 9, 11, 13, 15 // zeroes we don't need);
}
CHECKING COMPILER OUTPUT To figure out what’s going on it helps a lot to disassemble the WebAssembly output to confirm what instructions are actually emitted — especially if you’re hoping to report a bug. Refer to the SIMDproposal
for details of instructions and types used. If you compile with -g your .wasm output will include function names, which make it much easier to read the disassembly! Use wasm-dis like so: wasm-dis foo.wasm > foo.wat Load up the .wat in your code editor of choice (there are syntax highlighting plugins available for VS Code and I think Atom etc) and search for your function in the mountain of stuff. Note in particular that bit-shift operations currently can produce big sequences of lane-shuffling and scalar bit-shifts. This is due to the LLVM compiler working around a V8 bug with bit-shifts, and will befixed soon I hope.
If you wish, you can modify the Wasm source in the .wat file and re-assemble it to test subtle changes — use wasm-as for this.REPORTING BUGS
You probably will encounter bugs — this is very bleeding-edge stuff! The folks working on it want your feedback if you’re working in this area, so please make the most of it by providing reproducible test cases for any bugs you encounter that aren’t chalked down to the existing splat argument corruption and non-constant shift bugs. And beware that until the splat bug is fixed, non-deterministic problems are really easy to pop up. The various trackers:* emscripten
* https://github.com/emscripten-core/emscripten/issues * emscripten-specific issues (if in doubt, start here and provide a compilable test case)* LLVM/clang
* https://bugs.llvm.org/ * compiler-specific issues* Chrome/V8:
* https://bugs.chromium.org/p/v8/issues/list * runtime issues (if you’re sure the codegen is right)* spec feedback:
* https://github.com/WebAssembly/simd/issues * If you have actionable feedback on the spec proposal Posted on March 3, 2019March 3, 2019Author
brion Categories Uncategorized OGV.JS 1.6.0 RELEASED WITH EXPERIMENTAL AV1 DECODING After some additional fixes and experiments I’ve tagged ogv.js 1.6.0and released it .
As usual you can use ‘ogv’ package on npm or fetch the zip manually. This includes various fixes, including for some weird bugs!, and performance improvements on lower-end machines. Internals have been partially refactored to aid future maintenance, and experimental AV1 decoding has been added using VideoLAN’s dav1d decoder.DAV1D AND SIMD
The dav1d AV1 decoder is now working pretty solidly, but slowly. I found that my test files were encoded at too high a quality and dialed them back to my actual target bitrate and find that performance improves as a consequence, so hey! Not bad. ;) I’ve worked around a minor compiler issue in emscripten’s old “fastcomp” asm.js->wasm backend where an inner loop didn’t get unrolled, which improves decode performance by a couple percent. Upstream prefers to let the unroll be implicit, so I’m keeping this patch in a local fork for now. I’ve also been reached out to by some folks working on the WebAssembly SIMD proposal, which should allow speeding up some of the slow filtering operations with optimized vector code! The only browser implementation of the proposal (which remains a bit controversial) is currently Chrome, with an experimental command-line flag, and the updated vectorization code is in the new WebAssembly compiler backend that’s integrated with upstream LLVM. So I spent some time getting up and running on the new LLVM backend for emscripten, found a few issues: * emsdk doesn’t update the LLVM download properly so you can get stuck on an old version and be very confused — this is being fixedshortly!
* currently it’s hard to use a single sdk installation for both modes at once, and asm.js compilation requires the old backend. So I’ve temporarily disabled the asm.js builds on my simd2 work branch. * multithreaded builds are broken atm (at least modularized, which only just got fixed on the main compiler so might need fixes for llvmbackend)
* use of atomics intrinsics in a non-multithreaded build results in a validation error, whereas it had been silently turned into something safe in the old backend. I had to patch dav1d with a “fake atomics” option to #define them away. * Non-SIMD builds were coming out with data corruption, which I tracked down to an optimizer bug which had just been fixed upstream the day before I reported it. ;) * I haven’t gotten as far as working with any of the SIMD intrinsics, because I’m getting a memory access out of bounds issue when engaging the autovectorizer. I narrowed down a test case with the first error and have reported it; not sure yet whether the problem is in the compiler or in Chrome/V8. In theory autovectorization is likely to not do much, but significant gains could be made using intrinsics… but only so much, as the operations available are limited and it’s hard to tell what will beefficient or not.
INTERMITTENT FILE BREAKAGES Very rarely, some files would just BREAK at a certain position in the file for reasons I couldn’t explain. I had one turn up during AV1 testing where a particular video packet that contained two frame OBUs had one OBU header appear ok and the second obviously corrupted. I tracked the corruption back from the codec to the demuxer to the demuxer’s input buffer to my StreamFile abstraction used for loading data from a seekable URL. Turned out that the offending packet straddled a boundary between HTTP requests — between the second and third megabytes of the file, each requested as a separate Range-based XMLHttpRequest, downloaded as binary strings so the data can be accessed during progress events. But according to the network panel, the second and third megabytes looked fine…. but the *following* request turned up as 512 KiB. …What? Dumping the binary strings of the second and third megabytes, I immediately realized what was wrong: Enjoy some tasty binary strings! The first requests were as expected showing 8-bit characters (ASCII and control chars etc). The request with the broken packet was showing CJK characters indicating the string had probably been misinterpretedas UTF-16
It didn’t take much longer to confirm that the first two bytes of the broken request were 0xFE 0xFF, a UTF-16 Byte Order Mark. This apparently overrides the “overrideMimeType” method’s x-user-defined charset, and there’s no way to override it back. Hypothetically you could probably detect the case and swap bytes back but I think it’s not actually worth it to do full streaming downloads within chunks for the player — it’s better to buffer ahead so you can play reliably. For now I’ve switched it to use ArrayBuffer XHRs instead of binary strings, which avoids the encoding problem but means data can’t be accessed until each chunk has finished downloading. Posted on February 26, 2019Author
brion Categories Uncategorized OGV.JS EXPERIMENTAL AV1 DECODING The upcoming ogv.js 1.6.0 release will be the first to include experimental AV1 support, using the dav1d decoder. Thanks to ePirat for the initial work in emscripten cross-compiling the dav1d codebase! Performance is not very great, but may improve a bit in future from optimizations and potentially a lot from new platform features that may come to WebAssembly in the future. In particular on Internet Explorer which lacks WebAssembly, performance is very poor but does work at very low resolutions on reasonably fast machines. On my 2015 MacBook Pro (3.1 GHz 5th-gen Core i7), I can get somewhere between 360p and 480p on the “Caminandes – Llamigos”
demo in Safari, while the current VP9 codec gives me 720p. Safari has a great WebAssembly engine, giving 720p for VP9 or a solid 360p for AV1. 480p AV1 would be achievable with threading. In IE 11, high-motion scenes in AV1 top up the CPU at only 120p, while VP9 gets away with 240p or so. IE 11 runs several resolution steps lower, limited by its slow JavaScript engine. It will never get faster, we can only hope it will be gradually replaced. Multithreaded WebAssembly builds are also included, thanks to emscripten fixing support for modularized threaded programs in 1.38.27. These however do not work in Safari because it has not yet added back SharedArrayBuffer support after it was removed as part of Spectre mitigations. You can test the threaded builds in Chrome and Firefox with suitable flags enabled (“Wasm threading” for Chrome and “shared memory” for Firefox). VP9 scales well to 2 or 4 threads depending on the resolution, and AV1 scales to 2-ish threads. Will continue to tune and work on this for the future day when Safari supports threading. Another area where WebAssembly doesn’t perform well is the lack of SIMD instructions — in many places there are tight loops of arithmetic that can be parallelized with vector computation, and native builds of the decoders make extensive use of SIMD. There is some experimental support in some browsers and emscripten but I’m not sure how well they talk to each other or how finalized the standard is so I haven’t tried it. (It’s conceivable that browser engines could auto-vectorize tight loops in WebAssembly but they would probably be limited to 32-bit arithmetic at best, which wouldn’t parallelize as much as things that can work with 16-bit or 8-bit wide lanes.) Posted on February 17, 2019February 17, 2019Author
brion Categories UncategorizedPOSTS NAVIGATION
Page 1 Page 2 … Page 42Next page
Proudly powered by WordPressDetails
Copyright © 2024 ArchiveBay.com. All rights reserved. Terms of Use | Privacy Policy | DMCA | 2021 | Feedback | Advertising | RSS 2.0