Skip to content

Commit

Permalink
StackInterpreter>>#lookupMethodInClass: be robust when sending cannot…
Browse files Browse the repository at this point in the history
…Interpret:
  • Loading branch information
privat committed Jul 4, 2023
1 parent d5ed189 commit 4ddc6fb
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions smalltalksrc/VMMaker/StackInterpreter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -8933,7 +8933,7 @@ StackInterpreter >> lookupMethodFor: selector InDictionary: dictionary [

{ #category : #'message sending' }
StackInterpreter >> lookupMethodInClass: class [
| currentClass dictionary found |
| currentClass superClass dictionary found |
<inline: false>
self assert: (self addressCouldBeClassObj: class).
self lookupBreakFor: class.
Expand All @@ -8942,11 +8942,14 @@ StackInterpreter >> lookupMethodInClass: class [
[dictionary := objectMemory followObjField: MethodDictionaryIndex ofObject: currentClass.
dictionary = objectMemory nilObject ifTrue:
["MethodDict pointer is nil (hopefully due a swapped out stub)
-- raise exception #cannotInterpret:."
-- send #cannotInterpret: from the superclass."
self createActualMessageTo: class.
messageSelector := objectMemory splObj: SelectorCannotInterpret.
self sendBreakpoint: messageSelector receiver: nil.
^self lookupMethodInClass: (self superclassOf: currentClass)].
superClass := self superclassOf: currentClass.
superClass = objectMemory nilObject ifTrue: [
self error: 'cannotInterpret: cannot be send without a superclass' ].
^self lookupMethodInClass: superClass ].
found := self lookupMethodInDictionary: dictionary.
found ifTrue: [^currentClass].
currentClass := self superclassOf: currentClass].
Expand Down

0 comments on commit 4ddc6fb

Please sign in to comment.