[squeak-dev] Using V8 for other languages

Eliot Miranda eliot.miranda at gmail.com
Fri Sep 5 22:23:52 UTC 2008


On Fri, Sep 5, 2008 at 1:30 PM, Stephen Pair <stephen at pairhome.net> wrote:

> On Fri, Sep 5, 2008 at 3:17 PM, David Griswold <
> david.griswold.256 at gmail.com> wrote:
>
>>
>> Yes, it's becoming clear that V8 doesn't do anything that radically new or
>> magical, and that it was specifically designed for JavaScript, not as any
>> kind of universal dynamic language VM.  I'm especially disappointed at
>> Eliot's observation that it doesn't have a bytecode intermediate form,
>> although they may do mixed-mode execution by first interpreting the AST.
>>
>
> Why is that a bad thing?  I actually thought that was one of the most
> interesting aspects.  Bytecodes can provide you a concise portable format,
> but you could also do that by compressing or otherwise condensing source
> code (which I guess one way of condensing is to map to bytecode).  I'm not
> saying bytecodes wouldn't be desirable, but there's something appealing (to
> me) about a direct translation from source to machine code and I'm curious
> what other advantages bytecodes might have.
>
> Also, in a really pure OO VM and language, what would the bytecode set
> reduce to?  Three instructions?  push, pop and send?
>

push arg/temp
pop-store temp
push literal
push self
pop
dup
return top
block return top
send
send super/outer et al
push inst var       (still need this even though it is only used in
accessors)
pop-store inst var (ditto)

plus some form of closure support, e.g.
create blockpush new array
push non-local temp
pop-store non-local temp

which is not much fewer than there are now.  Don't confuse encoding with
semantics.  My Squeak compiler (heavily derivative of the current Squeak
compiler) currently has 34 opcodes distributed over 253 bytecodes.  Of
these, 7 are for optimizations other than inlining blocks, so reduce to 27.
 That's essentially twice as many as the list above which you get by
dropping direct access to literals.

The number of opcodes for a pure OO language is around 15, slightly more
than 3 :)



> - Stephen
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20080905/b964bac8/attachment.htm


More information about the Squeak-dev mailing list