Comments (7)
Is it possible for JS objects to cross the FFI boundary?
No, in asm.js code there are just ints and doubles basically. No JS objects at all. That's how it is possible to avoid all possible causes of bailouts. So likely for a compiler that generates JS objects like yours, asm.js isn't directly relevant, except perhaps for library code.
(This doesn't mean C# can't use asm.js though, an AOT might generate C or LLVM IR and be compiled to asm.js.)
from validator.
I was assuming it could operate at the function level where as long as a function only interacts with ints and floats and things that live in typed arrays, it can "use asm". It sounds like the entire application has to "use asm", then?
EDIT: I don't understand how JS objects crossing the FFI causes bailouts. I can understand how interacting with JS objects would cause bailouts. Why can't they have the semantics of void *? Is it because the GC rooting can cause bailouts?
from validator.
You can do "use asm" in a function scope, but lots of little asms won't be a good idea probably, the ffi path is not fast.
JS objects crossing ffi don't cause bailouts. JS objects in general cause bailouts. If you don't know at every point that no variable is a JS object, then you need to check a lot more stuff and possibly deoptimize. asm code avoids that.
from validator.
Btw, all of this is still a work in progress, don't take anything i said as a final answer. But what I said is true of the prototype implementation so far.
from validator.
In the example you have this. It would be good to explain why the sign must be forced etc.
log(x|0); // call into FFI -- must force the sign
log(y); // call into FFI -- already know it's a double
from validator.
The assumption in asm.js variables is that they are 32-bit values, neither signed nor unsigned. This makes it very easy to optimize them. But it also means that when the sign matters - like when calling an ffi - you must specify the sign.
Put another way, inside asm.js, variables have no sign, operations determine the sign (again, to make it easy to optimize). When going outside of asm.js, you need to specify the sign because a concrete value is being sent into JS, not just 32 bits of uncertain interpretation.
from validator.
I think FFIs are fully specified now (it is well-defined exactly what you can pass to them and get from them).
from validator.
Related Issues (20)
- Request: Fast integer overflow checks HOT 1
- is this repository maintained? HOT 4
- Accept comma-separated function table declarations HOT 2
- Command line utility? HOT 1
- Validator accepts code that it shouldn't HOT 4
- congrats HOT 1
- Allow constants in case blocks
- undefined cannot "flow freely" but can "escape"
- Spec allows standard library functions to be exported HOT 1
- Heap indexing expressions should be subtypes of intish
- Fround annotations break hoisting semantics HOT 1
- If doesn't work? HOT 4
- Mentioned on The Changelog "#189: JSON API with Yehuda Katz"
- Assignment operators are not validated HOT 1
- Foreign function invocations do not validate HOT 1
- Consider allowing x|=0 as a valid Parameter Type Annotation
- Byte Addressing for TypedArray views of heaps - why, and what does it accomplish? HOT 4
- anything with fround doesn't validate
- Warning Chrome : Invalid asm.js: Unexpected token
- Grammar incorrect in document
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from validator.