> From: Yilong Li [mailto:yilong...@runtimeverification.com] 
> Subject: Re: RV-Predict bugs

> Well, it is the problem (at least part of it) because JLS says "Informally,
> a read *r* is allowed to see the result of a write *w* if there is no
> *happens-before* ordering to prevent that read." In this case, there is no
> HB ordering preventing event 3 to read the initial null value put by JVM.

True, but as Mark previously pointed out, no one cares.  All that happens in 
that case is the object is redundantly created and then garbage collected 
later; no damage.

> But consider the following hashcode example:
> public int hashCode() {
>       if (hashCode == 0) {
>           hashCode = computeHashCode(); // no object creation involved
>       }
>       return hashCode;
> }

> There is no object initialization/publication involved at all but the
> problem still exists: this method could return 0 even if the if-statement
> sees a non-zero value.

No, it can't (unless computeHashCode() returns a zero, which presumably it 
won't).  This is all action within a single thread, and as such must obey 
intra-thread semantics (i.e., statements are executed in control flow order).
 
 - 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

Reply via email to