Hi guys. I would really appreciate if someone could explain me the following. I have this class:

Object subclass: #FooClass
    instanceVariableNames: 'var1 var2 var3 var4 var5'
    classVariableNames: ''
    poolDictionaries: ''
    category: 'Prueba'

With this method:

FooClass >> foo
    Transcript show: var5 asString.

And then I have this class:

Object subclass: #AnotherClass
    instanceVariableNames: 'age'
    classVariableNames: ''
    poolDictionaries: ''
    category: 'Prueba'


Now, I run this test:

    | inst |
    inst := AnotherClass new.
    inst age: 42.
    (FooClass >> #foo) valueWithReceiver: inst arguments: #()
   

So...I am evaluating the CompiledMethod installed on #foo on "inst". The compiledMethod has a bytecode (04) for accessing the var5. But "inst" only have one instVar. So....shouldn't that be a crash? because the VM is accessing outside the object... so, the test doesn't crash and in fact, it prints "1". I don't know what number means.

I took a look to

StackInterpreter >> pushReceiverVariable: fieldIndex

    self internalPush: (objectMemory fetchPointer: fieldIndex ofObject: self receiver).

But I guess that should crash.

Thanks for any tip,


--
Mariano
http://marianopeck.wordpress.com