<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">On May 7, 2013, at 10:38 PM, Michael Spencer <<a href="mailto:bigcheesegs@gmail.com">bigcheesegs@gmail.com</a>> wrote:<br><div><blockquote type="cite"><div>On Tue, May 7, 2013 at 10:08 PM, Nick Kledzik<span class="Apple-converted-space"> </span><span dir="ltr"><<a href="mailto:kledzik@apple.com" target="_blank">kledzik@apple.com</a>></span><span class="Apple-converted-space"> </span>wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;">Shankar,<br><br>Do you mean add a method like:<br><br> virtual unsigned contentHash() const = 0;<br><br>or maybe:<br><br> virtual llvm::hash_code contentHash() const = 0<br><br>to lld::DefinedAtom? That seems good to me. We just need to figure out what should happen with atoms not intended to be merged. Should the method assert? In the case where we want there to be a hash available, is it computed lazily?<br><br>Regarding the NativeReader/NativeWriter if the resolver is using the hash, then it would make sense to add the hash to the file format so reading native format is faster.<br><span class=""><font color="#888888"><br>-Nick<br></font></span></blockquote><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br></div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">I'd rather we use a crypto hash so we don't have to compare content at all.</div></div></blockquote><br></div><div>The crypto hashes work well if the atom content is const data (e.g. c-string or other literals), since you just point the hash function at the range of bytes in the constant data. Where it gets messier is if you are trying to coalesce non-leaf functions or non-const data because it is not just the content bytes that need to be compared but also all the references must somehow be incorporated into the hash. For example, two functions have the exact same instruction bytes, but one calls foo and one calls bar.</div><div><br></div><div>-Nick</div><div><br></div></body></html>