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

commits at source.squeak.org commits at source.squeak.org
Mon May 3 18:41:52 UTC 2021


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

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

Name: Kernel-nice.1399
Author: nice
Time: 3 May 2021, 8:41:29.262256 pm
UUID: 90c075cb-6d99-844c-8e53-e697592fe7a1
Ancestors: Kernel-jar.1398

Apply Jaromir fix for nested outed to resumeEvaluating:.

Let resumeUnchecked: rely on resumeEvaluating: in order to avoid code duplication.

Document the (tempAt: 2/tempAt: 2 put:) used in unwinding.

=============== Diff against Kernel-jar.1398 ===============

Item was changed:
  ----- Method: Context>>resumeEvaluating: (in category 'controlling') -----
  resumeEvaluating: aBlock
  	"Unwind thisContext to self and resume with value as result of last send. 
  	Execute unwind blocks when unwinding.
  	ASSUMES self is a sender of thisContext"
  
  	| ctxt unwindBlock |
  	self isDead ifTrue: [self cannotReturn: aBlock value to: self].
  	ctxt := thisContext.
  	[	ctxt := ctxt findNextUnwindContextUpTo: self.
  		ctxt isNil
  	] whileFalse: [
  		(ctxt tempAt: 2) ifNil:[
+ 			"(tempAt: 2) refers to complete temporary in ensure: and ifCurtailed:
+ 			or any other method marked with <primitive: 198>"
  			ctxt tempAt: 2 put: true.
  			unwindBlock := ctxt tempAt: 1.
  			thisContext terminateTo: ctxt.
  			unwindBlock value].
  	].
  	thisContext terminateTo: self.
  	^ aBlock value
  !

Item was changed:
  ----- Method: Exception>>resumeEvaluating: (in category 'handling') -----
  resumeEvaluating: aBlock
  	"Return result of evaluating aBlock as the value of #signal, unless this was called after an #outer message, then return resumptionValue as the value of #outer.
  	The block is only evaluated after unwinding the stack."
  
  	| ctxt |
  	outerContext ifNil: [
  		signalContext returnEvaluating: aBlock
  	] ifNotNil: [
  		ctxt := outerContext.
  		outerContext := ctxt tempAt: 1. "prevOuterContext in #outer"
+ 		handlerContext := ctxt tempAt: 2. "currHandlerContext in #outer"
  		ctxt returnEvaluating: aBlock
  	].
  !

Item was changed:
  ----- Method: Exception>>resumeUnchecked: (in category 'handling') -----
  resumeUnchecked: resumptionValue
  	"Return resumptionValue as the value of #signal, unless this was called after an #outer message, then return resumptionValue as the value of #outer."
  
+ 	^self resumeEvaluating: [resumptionValue]!
- 	| ctxt |
- 	outerContext ifNil: [
- 		signalContext return: resumptionValue
- 	] ifNotNil: [
- 		ctxt := outerContext.
- 		outerContext := ctxt tempAt: 1. "prevOuterContext in #outer"
- 		handlerContext := ctxt tempAt: 2. "currHandlerContext in #outer"
- 		ctxt return: resumptionValue
- 	].
- !



More information about the Squeak-dev mailing list