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

commits at source.squeak.org commits at source.squeak.org
Sat Jan 8 15:20:39 UTC 2022


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

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

Name: Kernel-jar.1444
Author: jar
Time: 8 January 2022, 4:20:34.376439 pm
UUID: c7e8b3b8-f965-aa47-85a3-d7dd7548dcc2
Ancestors: Kernel-jar.1443

Improved and simplified #isTerminated; currently the process is considered terminated if it is at the last instruction of its bottom context, i.e. when there's clearly no more code to be executed (except the last return).

However, there are more situations where the code is effectively finished, e.g. when a process suspends itself and the only code left is a chain of returns to the last instruction of the bottom context, i.e. the process has again nothing reasonable left to do.

This version of isTerminated could be useful e.g. if #suspend wasn't calling the primitive directly but called a helper method which would call the primitive.

In any case this version of isTerminated is more general and keeps the definition of terminated process clean and readable.

Please review and comment if you have concerns. Thanks!

=============== Diff against Kernel-jar.1443 ===============

Item was added:
+ ----- Method: Context>>isDone (in category 'query') -----
+ isDone
+ 	"Answer true if the receiver has no unexecuted code left (except returns)."
+ 
+ 	self isDead ifTrue: [^true].
+ 	self isBottomContext ifTrue: [^self atEnd].
+ 	(self atEnd or: [self method selector = #suspend]) ifTrue: [^self sender isDone].
+ 	^false!

Item was changed:
  ----- Method: Process>>isTerminated (in category 'testing') -----
  isTerminated
+ 	"Answer if the receiver is terminated. A healthy process is considered terminated 
+ 	 if the suspendedContext has no unexecuted code left (except returns)."
- 	"Answer if the receiver is terminated. A process is considered terminated
- 	if the suspendedContext is the bottomContext and the pc is at the endPC"
  
  	self isActiveProcess ifTrue: [^ false].
+ 	^suspendedContext isNil or: [suspendedContext isDone]!
- 	^suspendedContext isNil or: [
- 		suspendedContext isBottomContext and: [
- 			suspendedContext isDead or: [suspendedContext atEnd]]]!



More information about the Squeak-dev mailing list