tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Caldarale, Charles R" <>
Subject RE: RV-Predict bugs
Date Tue, 15 Sep 2015 19:42:11 GMT
> From: Mark Thomas [] 
> Subject: Re: RV-Predict bugs

> Putting it into my own words to check my understanding:

> - The two reads in T2 may be re-ordered because, in T2, there is nothing
>   that requires a happens-before relationship between the two reads

Depends on what was really meant by the ??? notation.  If it were another reference to st_200,
then the example ignores the potential write to st_200.

> - If T2 was executing in isolation the order of the reads wouldn't
>   matter

Correct, assuming there is no write in T2's control flow.

> - However, T1 is writing.

> So if the writes

I'll assume you meant "reads" there.

> in T2 are re-ordered and the write from T1 takes place between them the T2 
> read for the line 'st_200 == null' could return a non-null value for st_200 
> (the value after the write from T1) while the read for the line 'return 
> st_200;' could return null (the value from before the write in T1).

No - that would violate program order (intra-thread semantics).  The compiler cannot legally
move the read for "return st_200" to a point before the potential write to st_200.  The CPU
can speculatively read for the return value, but must discard such speculation if a write
were to occur (or use store forwarding to update the read).
 - Chuck

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:
For additional commands, e-mail:

View raw message