[squeak-dev] The Inbox: Kernel-jar.1413.mcz

commits at source.squeak.org commits at source.squeak.org
Sun May 30 18:18:11 UTC 2021


A new version of Kernel was added to project The Inbox:
http://source.squeak.org/inbox/Kernel-jar.1413.mcz

==================== Summary ====================

Name: Kernel-jar.1413
Author: jar
Time: 30 May 2021, 8:18:06.050183 pm
UUID: 0d967c44-059c-f140-bbe1-ccff3f237457
Ancestors: Kernel-nice.1402

fix a bug in #return:from: preventing the debugger to correctly step over a non-local return in a protected block like this:
 
	[^2] ensure: [Transcript cr; show: 'done'].

Stepping over ^2 or the subsequent #return:through or #resume:through: erroneously raised a BlockCannotReturn error. The error is described in detail in  Kernel-nice.1407 and discussed in http://forum.world.st/stepping-over-non-local-return-in-a-protected-block-td5128777.html

=============== Diff against Kernel-nice.1402 ===============

Item was changed:
  ----- Method: Context>>resume:through: (in category 'controlling') -----
  resume: value through: firstUnwindCtxt
  	"Unwind thisContext to self and resume with value as result of last send.
  	 Execute any unwind blocks while unwinding.
  	 ASSUMES self is a sender of thisContext."
  
  	| ctxt unwindBlock |
  	self isDead ifTrue: [self cannotReturn: value to: self].
+ 	ctxt := firstUnwindCtxt ifNil: [thisContext findNextUnwindContextUpTo: self].
- 	ctxt := firstUnwindCtxt.
  	[ctxt isNil] whileFalse:
  		[(ctxt tempAt: 2) ifNil:
  			[ctxt tempAt: 2 put: true.
  			 unwindBlock := ctxt tempAt: 1.
  			 thisContext terminateTo: ctxt.
  			 unwindBlock value].
  		 ctxt := ctxt findNextUnwindContextUpTo: self].
  	thisContext terminateTo: self.
  	^value
  !

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.
  	(self findNextUnwindContextUpTo: newTop) ifNotNil:
+ 		[^self send: #aboutToReturn:through: to: self with: {value. nil}].
- 		[:unwindProtectCtxt|
- 		 ^self send: #aboutToReturn:through: to: self with: {value. unwindProtectCtxt}].
  	self releaseTo: newTop.
  	newTop ifNotNil: [newTop push: value].
  	^newTop!



More information about the Squeak-dev mailing list