Re: [Sablevm-developer] adventures in not understanding the java stack
Brought to you by:
egagnon
From: Chris P. <chr...@ma...> - 2004-01-20 01:17:36
|
>> 6) Can you think of anything to do with class initialization, object >> finalization, or native method calls that would cause problems with >> what I'm describing? As in, problems that I won't detect safely? >> I'm asking about non-speculative parent threads, with or without >> children, executing these sections, possibly forking children. >> Speculative instructions are themselves safe with respect to global >> memory, exception handling, GC, native methods, and code preparation. > > > Let's be nasty... What if the parent thread creates a Thread instance and > calls Thread.start()? I guess this implies a native call and is thus > covered > in your approach, right? > > I guess you have to worry about native methods. A native method should > probably invalidate speculative children. > > That's all that comes to my mind. I don't think the Thread.start() example is a problem. If a speculative thread tries to start a new thread, it will hit a native method call and abort. If a non-speculative thread without spmt children tries to start a new thread, it can do so. Then we have two non-speculative threads, each of which can start speculative children of their own. If a non-speculative thread with spmt children tries to start a new thread, then if that thread violates some dependences the children will be aborted. In any case, the call to the method that started the thread should return normally, and thus reach the join point before the abortion occurs. Basically ... I am worried about having: FORK (jump over invoke and execute past join speculatively) INVOKE (executed non-speculatively in parallel) JOIN and the INVOKE not returning to the JOIN point (e.g. by throwing an exception) or the initial "speculative" stack at the JOIN being incorrect (e.g. because of GC). Additionally, if the INVOKE can somehow affect the data specific to the speculative thread (not global data), that would be something I need to know about. Note that I am not currently planning for speculative threads to run in their own Java Thread, but rather be clones of the non-speculative parent (and thus be invisible to other non-speculative threads and their children), running in a pthread that I manage explicitly. (it's not necessary to get sidetracked into the multithreading details at this point). Anyway, let me know if a problem in my reasoning occurs to you at some point (Clark too!), and meanwhile I'm just going to go ahead and implement this, based off of your previous answers and the latest description I gave. Thanks again, Chris |