2 ms·
I am very interested in better ways to transform Java into asmjs, but I think we'll need typed objects and/or some way to deal with garbage collection. The latt
by cromwellian 12y ago
I am very interested in better ways to transform Java into asmjs, but I think we'll need typed objects and/or some way to deal with garbage collection. The latter is a particular problem, well, if we take the route we did with j2objc, we can just punt and require manual annotations to break reference cycles, implementing our own ref-counting/ARC scheme on top of typed arrays, but it would be nice if someone asmjs and GC could play nicely together, without implementing the Boehm collector. :)
- kevingadd 12y agoWell, I have a relatively firm plan to work on getting asm.js v2 + typed objects finalized and produce a proof-of-concept compiler targeting them, so hopefully I can help push them along! It'd be great to understand GWT's needs here.
- cromwellian 12y agoI didn't notice that the Typed Object spec supports "new" heap allocation, if this'll work with asmjs, than awesome. GWT's needs are primarily two fold: 1) recognize Java types that can be promoted to struct-types. GWT already knows how to do this as it has passes to convert all methods of a class to monomorphic/static dispatch, meaning the prototype only has to contain field values. Thus if a Java type has no polymorphic methods, and all fields are either primitives, or references to other 'struct' types, then the compiler can emit typed objects. 2) Since Java is a GC'ed language, GWT currently isn't in the business of implementing a memory management scheme. We rely on Javascript to do this. The current problem with strict asmjs output is we'd need to allocate typed arrays and our own memory management scheme. There's not much appetite for that right now, but I suppose it could change in the future.