<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Apr 13, 2020, at 9:14 AM, Paul Sandoz <<a href="mailto:paul.sandoz@oracle.com" class="">paul.sandoz@oracle.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="Singleton" style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div class=""><blockquote type="cite" class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;"><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div class=""><blockquote type="cite" class=""><div class=""><blockquote type="cite" cite="mid:D7CFC082-C7F7-44DA-BCED-D733378ACDB8@oracle.com" class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><div class="">Indeed. And in an even simpler case, two different views of the same direct buffer could produce unexpected results with a relative bulk put from one into the other.</div><br class=""></blockquote><span class="" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;">Yes, it's a good point.</span></div></blockquote><div class=""><br class=""></div><div class="">I verified it with a small test.</div><br class=""></div></div></div></blockquote><div style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br class=""></div><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">Is that due to the buffer implementation (in some cases not using the Unsafe mem-copy) rather than mapping two sources at different virtual memory addresses?</span></div><div class=""><br class=""></div><div class="">If so it may be possible to fix it.</div></div></div></blockquote></div><br class=""><div class="">The test used two float views, one little endian and one big endian, of the same direct ByteBuffer and did a relative put (ByteBuffer.put(ByteBuffer)) from one into the other. This devolves into the loopy default code more or less as</div><div class=""><pre class="">while (src.hasRemaining())
         dst.put(src.get()); </pre><div class="">Since the two are views there is no IAE although both refer to the same storage. As there is currently no way to check whether these refer eventually to the same storage I don’t think there’s a way to get to using Unsafe.</div></div><div class=""><br class=""></div><div class="">Brian</div><div class=""><br class=""></div></body></html>