[Vm-dev] Request for review of VMMaker-dtl.262.mcz
Stefan Marr
smalltalk at stefan-marr.de
Fri Jan 6 08:27:57 UTC 2012
Hi Dave:
Ok, I tell you that there might be an edge case in your code, and you are renaming the helper? ;)
On 05 Jan 2012, at 14:51, David T. Lewis wrote:
>> Item was changed:
>> ----- Method: Interpreter>>primitivePerformInSuperclass (in category 'control primitives') -----
>> primitivePerformInSuperclass
>> | lookupClass rcvr currentClass |
>> lookupClass := self stackTop.
>> + rcvr := self stackValue: 3.
>> - rcvr := self stackValue: argumentCount.
>> currentClass := self fetchClassOf: rcvr.
>> [currentClass ~= lookupClass]
>> whileTrue:
>> [currentClass := self superclassOf: currentClass.
>> currentClass = nilObj ifTrue: [^ self primitiveFail]].
>>
>> + argumentCount = 3
>> + ifTrue: ["normal primitive call with 3 arguments expected on the stack"
>> + self popStack.
>> + self primitivePerformAt: lookupClass.
>> + self successful ifFalse:
>> + [self push: lookupClass]]
This looks correct, that is just the old code I assume.
>> + ifFalse: ["mirror primitive call with extra argument specifying object to serve as receiver"
>> + | s1 s2 s3 s4 s5 |
>> + "save stack contents"
>> + s1 := self popStack. "lookupClass"
>> + s2 := self popStack. "args"
>> + s3 := self popStack. "selector"
>> + s4 := self popStack. "mirror receiver"
>> + s5 := self popStack. "actual receiver"
Could it be that if somebody like me, calls the primitive without understanding it, that there are less than 3 items on the stack? What would happen then?
You restore the stack on failure, but I guess the at least the stack pointer could be wrong after the restore.
Best regards
Stefan
--
Stefan Marr
Software Languages Lab
Vrije Universiteit Brussel
Pleinlaan 2 / B-1050 Brussels / Belgium
http://soft.vub.ac.be/~smarr
Phone: +32 2 629 2974
Fax: +32 2 629 3525
More information about the Vm-dev
mailing list