[M3devel] ThreadBase/RunThread

Jay K jay.krell at cornell.edu
Mon Nov 9 00:05:27 CET 2009


ThreadBase/RunThread -- something seems a little off to me here.

 

 

I merged the functions.

Stuff is supposed to work asif there is arbitrary inlining.

 At least until/unless we get a pragma to mark a function as not inlinable or a direct language feature analogous to "volatile" to preserve locals -- currently inserting try does it but that's an implementation detail I think.

 

 

However, I wonder, in taking the address of "xx", isn't ThreadBase a bit..gambling?

You know, the traced references might be before or after xx in the stack, so xx might not cover it.

 

 

The code is safe because the only traced reference is "self" which also is reachable via slots.

 

 

In particular I'm trying to link Activation<=>T and introduce allThreadsTraced analogous to allThreads -- a global list of all threads, covering their traced part.

That way AssignSlots/FreeSlots and the slots lock would go away.

Removing locks seems like a good thing in general.

Overall space consumption wouldn't be much different, I'd trade an array of pointers, one pointer per thread, for two pointers embedded in each thread plus a global pointer. But the ability to fetch Self() faster or RunThread to block on less or no locking would be good -- not that Self() is used much anymore.

 

 

I keep seeing strange failures and I wonder if taking away the slots reference leaves me with insufficient reference.

Or maybe I'm breaking it some other way.

 

I tried building up allThreadsTraced earlier, while stackbase isn't settable, and have code watch for stackbase = NIL but still no luck.

 

 

I'll try more later...

 

 

 - Jay
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20091108/39f90696/attachment-0001.html>


More information about the M3devel mailing list