> From: sebb [mailto:seb...@gmail.com] > Subject: Re: bug in TC6 ContainerBase class?
> What method calls will force a reload? Why must the compiler > assume it has changed? Any other than Thread.sleep(). Again, we are discussing what happens in practice, not in theory. Since the javac compiler does not, in this case, have knowledge of the internal operations of the called methods, it must pessimistically assume that synchronization may occur and fields have been updated. (On the other hand, a JIT, with its runtime knowledge, could determine whether or not synchronization happens and optimize out the reload. But that would require either calls to very simplistic methods or a very deeply probing JIT.) For methods that javac does have knowledge of (e.g., Thread.sleep(), as defined by 17.9 of the language spec, or non-overridable ones in the class), the compiler does not have to be pessimistic. > Surely that is what volatile is for? Volatile insures that ordering is observed in lieu of explicit synchronization. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org