Hi guys. I would really appreciate if someone could explain me the following. I have this class:<br><br>Object subclass: #FooClass<br> instanceVariableNames: 'var1 var2 var3 var4 var5'<br> classVariableNames: ''<br>
poolDictionaries: ''<br> category: 'Prueba'<br><br>With this method:<br><br>FooClass >> foo<br> Transcript show: var5 asString.<br><br>And then I have this class:<br><br>Object subclass: #AnotherClass<br>
instanceVariableNames: 'age'<br> classVariableNames: ''<br> poolDictionaries: ''<br> category: 'Prueba'<br><br><br>Now, I run this test:<br><br> | inst |<br> inst := AnotherClass new.<br>
inst age: 42.<br> (FooClass >> #foo) valueWithReceiver: inst arguments: #() <br> <br><br>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.<br>
<br>I took a look to <br><br>StackInterpreter >> pushReceiverVariable: fieldIndex<br><br> self internalPush: (objectMemory fetchPointer: fieldIndex ofObject: self receiver).<br><br>But I guess that should crash.<br>
<br>Thanks for any tip,<br><br clear="all"><br>-- <br>Mariano<br><a href="http://marianopeck.wordpress.com" target="_blank">http://marianopeck.wordpress.com</a><br><br>