-
Notifications
You must be signed in to change notification settings - Fork 80
Open
Description
I am looking at the method onObjectMemory:cogit:options:
and this implementation does not look right to me.
onObjectMemory: anObjectMemory cogit: aCogit options: optionsDictionaryOrArray
| simulatorClass |
^self == CogVMSimulator
ifTrue:
[simulatorClass := SmalltalkImage current endianness == #big
ifTrue: [self notYetImplemented]
ifFalse: [CogVMSimulatorLSB].
simulatorClass
initializeWithOptions: optionsDictionaryOrArray
objectMemoryClass: (anObjectMemory ifNotNil: [anObjectMemory class]).
simulatorClass
onObjectMemory: (anObjectMemory ifNil:
[self objectMemoryClass simulatorClass new])
cogit: aCogit
options: optionsDictionaryOrArray]
ifFalse:
[| sim |
sim := self basicNew.
sim objectMemory: anObjectMemory.
sim cogit: aCogit.
sim initialize.
sim]
- Should it be
self class == CogVMSimulator
instead ofself == CogVMSimulator
? Currently, it seems that onlyifFalse
branch will be evaluated. - The only subclass of
CogVMSimulator
isCogVMSimulatorLSB
at the moment. Why don't we implement the same method inCogVMSimulatorLSB
and avoid this class check? - Why don't we use similar logic in the
ifFalse
branch? - I checked all the senders of this method (and senders of these senders, etc.) and it seems that
anObjectMemory
is alwaysnil
. Is it expected? - By sending
onObjectMemory:cogit:options:
tosimulatorClass
, aren't we just calling this same method again (and hence potentially causing infinite recursion, if we actually evaluate theifTrue
branch)?
Metadata
Metadata
Assignees
Labels
No labels