eliot.miranda at gmail.com
Fri Oct 10 07:30:27 UTC 2014
On Fri, Oct 10, 2014 at 12:27 AM, Bert Freudenberg <bert at freudenbergs.de>
> repository? The code is currently in the SqueakJS repo (*), but I could
> additionally keep a copy on source.squeak.org.
> This is (unsurprisingly) somewhat of a kludge. I had to work around
> pointer arithmetic (because unlike Smalltalk's VM simulator I cannot
> will laugh in your face. It doesn't even have integers. Double-precision
> float is all you need). Bit shifts are interesting, too, because shifting
> by 32 does not result in 0 as you might expect. And division gives you a
> float, and mod is off by 1 with the wrong sign etc.
> And then there's cCode:inSmalltalk:. Fun one. I ended up having a
> translation table with a JS snippet for every C snippet. And a bit of magic
> sprinkled on top. Don't judge, it serves its purpose, namely generating the
> plugins that do not depend on libraries or other external code. And that's
> actually not that few, 17 total:
> But it works, and is almost as efficient as my hand-written code. I was
> able to get rid of 1200 lines of my own BitBlt code that almost worked, and
> use the actual BitBlt implementation with all its nooks and crannies. And
> having a LargeIntegersPlugin makes a real difference in performance. And
> ZipPlugin too. Etc.
> The generated code even looks quite nice, modulo excessive parens.
> However, the JS code generator remains ugly, and is less than general. I
> wonder if some of the C-isms should be replaced with more general patterns.
> The memory access functions are a step in the right direction I think.
> Although I think they always should use a base (oop+baseHeaderSize would be
> my preference) and offset. This would make it rather simple to map to JS,
> and with today's optimizing C compilers and modern CPUs, does it really
> make a difference to write ptr++ instead of ptr[i++]?
> Anyway, I'm not really complaining, Slang was intended as just being C
> with, so it's no wonder people use it like that. The type declarations help
> immensely in figuring out what's going on automatically most of the time,
> and I kludged the rest. Without modifying a single line in the original
> plugins, so far. Of course, if the plugin code changes I may have to adjust
> the code generator.
> Err, that turned out longer and more rambling than I intended. I really
> just wanted to know if I should copy it to the main VMMaker repo?
Of course you should.
> - Bert -
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Vm-dev