<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Sep 8, 2014 at 11:29 AM, Lang Hames <span dir="ltr"><<a href="mailto:lhames@gmail.com" target="_blank">lhames@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">That's one of the intents of the RuntimeDyldChecker framework: Tests for any any target can be executed and verified on any host. As you surmised the code is never actually run, just loaded and linked, then inspected according to the check expressions.</div></blockquote><div><br></div><div>Could you checkin a test case with a hardcoded target? (I'd suggest adding one with a hardcoded LE too - but that's probably not too important, everyone develops on LE, right?) Seems like it might be helpful to have both running when developing rather than checking in & waiting for a buildbot to cycle.<br><br>I'm not sure it's a pervasive habit, but usually if I see a buildbot failure that I could've tested locally, I'll add a portable test to demonstrate that.<br><br>- David</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><span class="HOEnZb"><font color="#888888"><div><br></div><div>- Lang.</div></font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Sep 8, 2014 at 11:23 AM, David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span>On Mon, Sep 8, 2014 at 10:56 AM, Lang Hames <span dir="ltr"><<a href="mailto:lhames@gmail.com" target="_blank">lhames@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I'm not sure I'd add a function for that, though you could use an "increment" variable to merge the loops if you like. I don't think it's really worth it though.<div><br></div><div>The commit message could have been clearer, but this is certainly testable: It's is an attempt to get the RuntimeDyld regression tests working on PPC.</div></div></blockquote><div><br></div></span><div>Can those tests be run on other platforms with a fixed triple? (the verify mode you added doesn't actually have to execute the code, right? So you can run PPC tests on any platform?)</div><div><div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><span><font color="#888888"><div><br></div><div>- Lang.</div></font></span></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Sep 7, 2014 at 9:10 PM, David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span>On Sat, Sep 6, 2014 at 7:05 PM, Lang Hames <span dir="ltr"><<a href="mailto:lhames@gmail.com" target="_blank">lhames@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: lhames<br>
Date: Sat Sep  6 21:05:26 2014<br>
New Revision: 217325<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=217325&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=217325&view=rev</a><br>
Log:<br>
[MCJIT] Fix a bug RuntimeDyldImpl's read/writeBytesUnaligned methods.<br>
<br>
The previous implementation was writing to the high-bytes of integers on BE<br>
targets (when run on LE hosts).<br></blockquote><div><br></div></span><div>Not testable? (curious what limitations of your new test infrastructure (or curiosities of this issue) make it not applicable to testing this bug)<br><br>& any nice way to factor the (admittedly minor) duplication in each of these codepaths? (could have a function that takes the increment (1 or -1), non-type template parameter if necessary, but it looks simple/inlinable?)</div><div><div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<a href="http://llvm.org/PR20640" target="_blank">http://llvm.org/PR20640</a><br>
<br>
<br>
Modified:<br>
    llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp<br>
<br>
Modified: llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp?rev=217325&r1=217324&r2=217325&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp?rev=217325&r1=217324&r2=217325&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp (original)<br>
+++ llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp Sat Sep  6 21:05:26 2014<br>
@@ -398,32 +398,30 @@ unsigned RuntimeDyldImpl::computeSection<br>
 uint64_t RuntimeDyldImpl::readBytesUnaligned(uint8_t *Src,<br>
                                              unsigned Size) const {<br>
   uint64_t Result = 0;<br>
-  uint8_t *Dst = reinterpret_cast<uint8_t*>(&Result);<br>
-<br>
-  if (IsTargetLittleEndian == sys::IsLittleEndianHost) {<br>
-    if (!sys::IsLittleEndianHost)<br>
-      Dst += sizeof(Result) - Size;<br>
-    memcpy(Dst, Src, Size);<br>
-  } else {<br>
-    Dst += Size - 1;<br>
-    for (unsigned i = 0; i < Size; ++i)<br>
-      *Dst-- = *Src++;<br>
-  }<br>
+  if (IsTargetLittleEndian) {<br>
+    Src += Size - 1;<br>
+    while (Size--)<br>
+      Result = (Result << 8) | *Src--;</blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+  } else<br>
+    while (Size--)<br>
+      Result = (Result << 8) | *Src++; </blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
   return Result;<br>
 }<br>
<br>
 void RuntimeDyldImpl::writeBytesUnaligned(uint64_t Value, uint8_t *Dst,<br>
                                           unsigned Size) const {<br>
-  uint8_t *Src = reinterpret_cast<uint8_t*>(&Value);<br>
-  if (IsTargetLittleEndian == sys::IsLittleEndianHost) {<br>
-    if (!sys::IsLittleEndianHost)<br>
-      Src += sizeof(Value) - Size;<br>
-    memcpy(Dst, Src, Size);<br>
+  if (IsTargetLittleEndian) {<br>
+    while (Size--) {<br>
+      *Dst++ = Value & 0xFF;<br>
+      Value >>= 8;<br>
+    }<br>
   } else {<br>
-    Src += Size - 1;<br>
-    for (unsigned i = 0; i < Size; ++i)<br>
-      *Dst++ = *Src--;<br>
+    Dst += Size - 1;<br>
+    while (Size--) {<br>
+      *Dst-- = Value & 0xFF;<br>
+      Value >>= 8;<br>
+    }<br>
   }<br>
 }<br>
<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div></div></div><br></div></div>
</blockquote></div><br></div>
</div></div></blockquote></div></div></div><br></div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div></div>