[Pharo-dev] Smalltalk Virtual Machine, StVM

phil at highoctane.be phil at highoctane.be
Wed May 14 07:52:50 EDT 2014

Java/JVM doesn't have become: which is something that helps a lot in
Smalltalk being Smalltalk.

Object>>become: otherObject
    "Primitive. Swap the object pointers of the receiver and the argument.
    All variables in the entire system that used to point to the
    receiver now point to the argument, and vice-versa.
    Fails if either object is a SmallInteger"

    (Array with: self)
            (Array with: otherObject)

You can't do that in Java/JVM it seems.

That is also what is used (well, there is another primitive (72) when one
changes all fo the code around in the Browser.




and Array>>elementsForwardIdentityTo:

elementsForwardIdentityTo: otherArray
    "This primitive performs a bulk mutation, causing all pointers to the
elements of this array to be replaced by pointers to the corresponding
elements of otherArray.  The identityHashes remain with the pointers rather
than with the objects so that the objects in this array should still be
properly indexed in any existing hashed structures after the mutation."
    <primitive: 72>
    self primitiveFailed

As become: and elementsForwardIdentityTo: are doing all of this in the VM,
which apparently the JVM doesn't do.

That's why a Smalltalk on the JVM will not "really" be a Smalltalk if this
characteristic isn't there. Yes, there will be bytecode, yes, there will be
syntax. But there will be no magic.


> How about running Java on the StVM so that Java can have the live
> environment and debugging capabilities like in full blown Smalltalk? How
> about doing the same for Python, Ruby, Lisp, ObjC, C#, etc?
> Thanks in advanced for all you thoughts.
> Aik-Siong Koh
> --
> View this message in context:
> http://forum.world.st/Smalltalk-Virtual-Machine-StVM-tp4758961.html
> Sent from the Pharo Smalltalk Developers mailing list archive at
> Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/attachments/20140514/3a8681d4/attachment-0002.html>

More information about the Pharo-dev mailing list