Process local variable and debugging

Anthony Hannan ajh18 at cornell.edu
Mon Feb 11 22:08:08 UTC 2002


Tim Rowledge <tim at sumeru.stanford.edu> wrote:
> I was thinking of working around the problem by making it more of the
> form
> 	thisContext process

This is exactly what I use in the BC version.  An ActiveFrame (ie.
MethodContext) has a pointer to its stack which has a pointer to its
process so it is quick.  'thisContext process' works in the debugger or
when a process is being simulated, etc.  I also keep track of which
process is simulating another process so suspend/resume will
suspend/resume the simulator, and so two process won't try to step
through the same process at the same time (locking).

I also implemented #process on ContextPart in the standard image so I
can simulate BC.  Its implementation is:

process
	"Return my process"

	self = thisContext sender ifTrue: [^ Processor activeProcess].
	^ self findProcess

I did not bother to implement findProcess though, which would require
searching all processes for the one that is pointing to self via its
sender chain.

Cheers,
Anthony

PS. Can anyone think of a better class name than ActiveFrame, which
replaces MethodContext/BlockContext.  An ActiveFrame refers to an
activation record (frame) on the process stack, and is only created on
thisContext.  The frame's method can be a regular method or a block
method; BlockClosures have their own methods.



More information about the Squeak-dev mailing list