<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jan 15, 2016, at 4:21 PM, Greg Parker via swift-dev &lt;<a href="mailto:swift-dev@swift.org" class="">swift-dev@swift.org</a>&gt; wrote:</div><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Jan 15, 2016, at 10:58 AM, Joe Groff &lt;<a href="mailto:jgroff@apple.com" class="">jgroff@apple.com</a>&gt; wrote:</div></blockquote><blockquote type="cite" class=""><br class=""></blockquote><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">we could use a layout similar to this to pack the remaining information into 8 bytes:</div><div class=""><br class=""></div><div class=""><div class=""><font face="Courier New" class="">bits &nbsp;&nbsp;meaning</font></div><div class=""><font face="Courier New" class="">----- &nbsp;-------</font></div><div class=""><font face="Courier New" class="">63 &nbsp; &nbsp;&nbsp;not refcounted</font></div><div class=""><font face="Courier New" class="">47…62 &nbsp;strong refcount</font></div><div class=""><font face="Courier New" class="">03…46 &nbsp;metadata pointer</font></div><div class=""><font face="Courier New" class="">02 &nbsp; &nbsp; (reserved)</font></div><div class=""><font face="Courier New" class="">01 &nbsp; &nbsp; deallocating</font></div><div class=""><font face="Courier New" class="">00 &nbsp; &nbsp; pinned</font></div></div></div></div></blockquote><div class=""><br class=""></div><div class="">Note that the memory analysis folks really want a few bits reserved with a constant value. That improves their reliability when distinguishing real objects from non-object memory that happens to have an isa-like field in front. ObjC currently gives them 6 bits on all architectures.</div></div></div></div></blockquote><br class=""></div><div>To clarify: Analysis tools like `heap` and `leaks` need to distinguish real objects from other heap allocations. The false positive rate is tolerable if the isa field is a raw pointer. (As long as some other code like libobjc itself deliberately disguises some of its own data structures that would otherwise look like false positives.)</div><div><br class=""></div><div>Non-pointer isa greatly increases the false positive rate. There is too much non-object data that happens to match some real class pointer when only the class bits can be examined. Adding some constant non-zero bits brings it back down again.&nbsp;</div><div><br class=""></div><div><br class=""></div><div>--&nbsp;</div><div>Greg Parker &nbsp; &nbsp; <a href="mailto:gparker@apple.com" class="">gparker@apple.com</a> &nbsp; &nbsp; Runtime Wrangler</div><div><br class=""></div><div><br class=""></div></body></html>