Christoph Thiede uploaded a new version of Kernel to project The Trunk: http://source.squeak.org/trunk/Kernel-jar.1538.mcz
==================== Summary ====================
Name: Kernel-jar.1538 Author: jar Time: 27 November 2023, 12:00:15.196233 am UUID: d37b82ee-c73e-ed4b-be1c-478b708c5d9c Ancestors: Kernel-jar.1537
fix stepOver bug when debugging e.g. [[self halt. ^ 1] on: BlockCannotReturn do: [:ex | ex resume] ] fork (step over halt and then stepover ^1 you get a nonsensical error as a result of decoding nil as an instruction)
the root cause is in the #return:from: method: it only checks whether aSender is dead but ignores the possibility that aSender sender may be nil or dead
This changeset requires its ancestor Kernel-jar.1537
(Please remove Kernel-jar.1535 from the Inbox)
=============== Diff against Kernel-jar.1537 ===============
Item was changed: Error subclass: #BlockCannotReturn + instanceVariableNames: 'pc result deadHome finalContext' - instanceVariableNames: 'pc result deadHome' classVariableNames: '' poolDictionaries: '' category: 'Kernel-Exceptions'!
!BlockCannotReturn commentStamp: '<historical>' prior: 0! This class is private to the EHS implementation. Its use allows for ensured execution to survive code such as:
[self doThis. ^nil] ensure: [self doThat]
Signaling or handling this exception is not recommended.!
Item was added: + ----- Method: BlockCannotReturn>>finalContext (in category 'accessing') ----- + finalContext + + ^ finalContext!
Item was added: + ----- Method: BlockCannotReturn>>finalContext: (in category 'accessing') ----- + finalContext: context + + finalContext := context!
Item was changed: ----- Method: Context>>cannotReturn:to: (in category 'private') ----- cannotReturn: result to: homeContext "The receiver tried to return result to homeContext that cannot be returned from. + Capture the return context/pc in a BlockCannotReturn. Nil the pc to prevent repeat - Capture the return pc in a BlockCannotReturn. Nil the pc to prevent repeat attempts and/or invalid continuation. Answer the result of raising the exception."
+ | exception previousPc | - | exception | exception := BlockCannotReturn new. + previousPc := pc ifNotNil: [self previousPc]. exception result: result; deadHome: homeContext; + finalContext: self; + pc: previousPc. - pc: self previousPc. pc := nil. ^exception signal!
Item was changed: ----- Method: Context>>return:from: (in category 'instruction decoding') ----- return: value from: aSender "For simulation. Roll back self to aSender and return value from it. Execute any unwind blocks on the way. ASSUMES aSender is a sender of self"
| newTop | - aSender isDead ifTrue: - [^self send: #cannotReturn: to: self with: {value}]. newTop := aSender sender. + (aSender isDead or: [newTop isNil or: [newTop isDead]]) ifTrue: + [^self pc: nil; send: #cannotReturn: to: self with: {value}]. (self findNextUnwindContextUpTo: newTop) ifNotNil: "Send #aboutToReturn:through: with nil as the second argument to avoid this bug: Cannot #stepOver '^2' in example '[^2] ensure: []'. See http://lists.squeakfoundation.org/pipermail/squeak-dev/2022-June/220975.html" [^self send: #aboutToReturn:through: to: self with: {value. nil}]. self releaseTo: newTop. newTop ifNotNil: [newTop push: value]. ^newTop!
packages@lists.squeakfoundation.org