<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
<br><div><div>On Aug 22, 2011, at 5:29 PM, Eli Friedman wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><blockquote type="cite"><p style="margin: 0.0px 0.0px 0.0px 10.0px"><font face="Monaco" size="3" style="font: 12.0px Monaco">LLVM Atomics and Concurrency guide also states the following</font></p> <p style="margin: 0.0px 0.0px 0.0px 10.0px"><font face="Monaco" size="3" style="font: 12.0px Monaco">"Note that speculative loads are allowed; a load which is part of a</font></p> <p style="margin: 0.0px 0.0px 0.0px 10.0px"><font face="Monaco" size="3" style="font: 12.0px Monaco">race returns undef, but does not have undefined behavior"</font></p> <p style="margin: 0.0px 0.0px 0.0px 10.0px; font: 12.0px Monaco; min-height: 16.0px"><br></p> <p style="margin: 0.0px 0.0px 0.0px 10.0px"><font face="Monaco" size="3" style="font: 12.0px Monaco">If the speculative loads returns an undef and the returned value is</font></p> <p style="margin: 0.0px 0.0px 0.0px 10.0px"><font face="Monaco" size="3" style="font: 12.0px Monaco">used, then it results in an undefined behavior. Am I correct?</font></p> </blockquote><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Monaco; min-height: 16.0px"><br></p> <p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Monaco" size="3" style="font: 12.0px Monaco">It behaves like any other undef value... which do often lead to</font></p> <p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Monaco" size="3" style="font: 12.0px Monaco">undefined behavior.</font></p> </blockquote></div><br><div><br></div><div>Eli,</div><div> Java by necessity has to be well defined in spite of data-races (because, IIUC, detecting</div><div>data-races in just about anything and java-byte-codes in particular is an N-P-complete problem,</div><div>so cannot be part of the byte-code validation process, therefore any byte-code which does have</div><div>a data-race and does pass validation must still execute with defined behavior).</div><div><br></div><div>so, again IIUC, it appears that LLVM-IR could not be used for Java if we import C/C++'s</div><div>strict "data-race implies undefined" semantics into our IR.</div><div><br></div><div><br></div><div>sincerely,</div><div>Peter Lawrence.</div></body></html>