Ah, the compiler now optimizes away the unused literal array: (JS compiledMethodAt: #doesNotUnderstand:) literals ==> #(#primitiveFailed)
whereas the old Squeak compiler leaves it in: (JS compiledMethodAt: #doesNotUnderstand:) literals ==> #((JavaScriptPlugin primitiveDoUnderstand 0 0) primitiveFailed) The VM looks at the first literal to find the primitive. But I found a way to fool the compiler, which also makes the JS bridge work in current Squeak.
Conceptually it doesn’t, all drawing operates on a Canvas (an abstract class). However, the concrete class has always been FormCanvas, which does expose the underlying bitmap. There is code that makes use of that. But it shouldn’t be too hard to clean that up. E.g., there is also a PostScriptCanvas that can be used to generate a vector rendering. But it never has been used interactively, it’s just for printing. But making a JSCanvas subclass would be a reasonable course of action. Older versions of Morphic are quite zippy compared to more recent ones (e.g. the Scratch image uses an old Morphic).
As I said, it really depends on your goals :) My initial goal for SqueakJS was just to explore how far we can get in making existing Squeak images work. Which is why I only now added the JS bridge, because if you use it, that code won’t run anywhere else (not until we implement the JavaScriptPlugin for other VMs anyway, which is certainly possible by embedding v8/node, but not trivial, and then your code might still assume being run in a browser).
Sounds cool!
Well, on startup SqueakJS still has to create a JavaScript object for each Smalltalk object, which takes more than a second for large images). I wonder … we could actually store the ready-made objects in IndexedDB … which would give us extremely fast image loading and saving. Now there’s an idea!
Not sure if you have seen it, but the Makefile in the run/ directory combines VM and generated plugins into a single file (squeak-all.js, 1.1 MB). It minifies to 0.4MB and gzipping that results in just 0.1 MB :)
Indeed! This is pretty much why SqueakJS exists at all - as an experiment to build something using the Web as a universal runtime environment. If you take that experiment and make it do something useful, awesome! Btw, for discussion not directly related to the VM, but how to build a system on top of it, we might rather want to move off vm-dev and continue on squeak-dev. CC’ed. - Bert - smime.p7s (5K) Download Attachment |
Free forum by Nabble | Edit this page |