[squeak-dev] The Trunk: Kernel-nice.1384.mcz

commits at source.squeak.org commits at source.squeak.org
Sun Apr 11 17:33:26 UTC 2021


Nicolas Cellier uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-nice.1384.mcz

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

Name: Kernel-nice.1384
Author: nice
Time: 11 April 2021, 7:33:23.487481 pm
UUID: ecb5db19-59bc-45f0-85d3-d9296a936a68
Ancestors: Kernel-mt.1383

Another attempt at fixing #testHandlerFromAction. Unlike previous attempts, this one preserves the expectations of #testHandlerReentrancy.

The solution is to de-activate the handlers as we backtrack the stack, but to reactivate them before performing final exception handling actions (like resuming, resignalling or performing defaultAction). Indeed, those handlers must be able to handle a secondary exception raised in the course of this action.

=============== Diff against Kernel-mt.1383 ===============

Item was changed:
  ----- Method: Context>>handleSignal: (in category 'private-exceptions') -----
  handleSignal: exception
  	"Sent to handler (on:do:) contexts only.  If my exception class (first arg) handles exception
  	 and the handler is active then execute my handle block (second arg), otherwise forward
  	 this message to the next handler context.  If none left, execute exception's defaultAction
  	 (see nil>>handleSignal:)."
  
  	| handlerActive val |
  	"If the context has been returned from the handlerActive temp var may not be accessible."
  	handlerActive := stackp >= 3 and: [(self tempAt: 3) == true].
  	(((self tempAt: 1) handles: exception) and: [handlerActive]) ifFalse:
+ 		[stackp >= 3 ifTrue: [self tempAt: 3 put: false]. 
+ 		^self nextHandlerContext handleSignal: exception].
- 		[^self nextHandlerContext handleSignal: exception].
  
  	exception privHandlerContext: self contextTag.
  	self tempAt: 3 put: false.  "disable self while executing handle block"
  	val := [(self tempAt: 2) cull: exception]
+ 			ifCurtailed: [self tempAt: 3 put: true].
- 			ensure: [self tempAt: 3 put: true].
  	self return: val  "return from self if not otherwise directed in handle block"
  !

Item was added:
+ ----- Method: Context>>reactivateHandlers (in category 'private-exceptions') -----
+ reactivateHandlers
+ 	"Private - sent to exception handler context only (on:do:).
+ 	Reactivate all the handlers into the chain"
+ 	
+ 	self tempAt: 3 put: true. "this is temporary handlerActive in #on:do:"
+ 	self nextHandlerContext reactivateHandlers!

Item was added:
+ ----- Method: Exception>>reactivateHandlers (in category 'priv handling') -----
+ reactivateHandlers
+ 	"reactivate all the exception handlers in the context chain"
+ 	self canSearchForSignalerContext
+ 		ifTrue: [signalContext nextHandlerContext reactivateHandlers]!

Item was changed:
  ----- Method: Exception>>resignalAs: (in category 'handling') -----
  resignalAs: replacementException
  	"Signal an alternative exception in place of the receiver."
  
+ 	self reactivateHandlers.
  	self resumeUnchecked: replacementException signal!

Item was changed:
  ----- Method: UndefinedObject>>handleSignal: (in category 'bottom context') -----
  handleSignal: exception
+ 	"When no more handler (on:do:) context left in sender chain this gets called.  Return from signal with default action.
+ 	Before doing that, reactivate the handlers so that they can catch eventual secondary exceptions raised by defaultAction."
- 	"When no more handler (on:do:) context left in sender chain this gets called.  Return from signal with default action."
  
+ 	^ exception reactivateHandlers; resumeUnchecked: exception defaultAction!
- 	^ exception resumeUnchecked: exception defaultAction!

Item was added:
+ ----- Method: UndefinedObject>>reactivateHandlers (in category 'bottom context') -----
+ reactivateHandlers
+ 	"nothing to do for bottom context"
+ 	
+ 	^ self!



More information about the Squeak-dev mailing list