[Vm-dev] Class checks in the vm

Guillermo Polito guillermopolito at gmail.com
Tue Apr 17 15:33:33 UTC 2012


Hi!

I'm playing to bootstrap a Pharo image, trying to get a new environment
running into my 'host' image, and after that, dump those new objects into a
new image file.

Now, to do that, I'm creating new classes for String, Character...  Which
are well known by the vm specialObjectsArray.  And trying to initialize my
new image classes, which creates new character objects, and new string
objects which is causing me some troubles :P.

Now, my question is about this check in vmmaker (and some others that look
similar):

Interpreter>>#asciiOfCharacter: characterObj  "Returns an integer object"
    <inline: false>
    *self assertClassOf: characterObj is: (self splObj: ClassCharacter).*
    successFlag
        ifTrue: [^ self fetchPointer: CharacterValueIndex ofObject:
characterObj]
        ifFalse: [^ ConstZero]  "in case some code needs an int"


- Can't we put a more intelligent assersion like checking if the object
responds true to #isCharacter?
- And removing the static check from the vm and adding the dynamic and nice
#isCharacter check into the image?

Thanks!
Guille
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20120417/fe38d9f5/attachment.htm


More information about the Vm-dev mailing list