<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 <<a href="mailto:swift-dev@swift.org" class="">swift-dev@swift.org</a>> 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 <<a href="mailto:jgroff@apple.com" class="">jgroff@apple.com</a>> 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 meaning</font></div><div class=""><font face="Courier New" class="">----- -------</font></div><div class=""><font face="Courier New" class="">63 not refcounted</font></div><div class=""><font face="Courier New" class="">47…62 strong refcount</font></div><div class=""><font face="Courier New" class="">03…46 metadata pointer</font></div><div class=""><font face="Courier New" class="">02 (reserved)</font></div><div class=""><font face="Courier New" class="">01 deallocating</font></div><div class=""><font face="Courier New" class="">00 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. </div><div><br class=""></div><div><br class=""></div><div>-- </div><div>Greg Parker <a href="mailto:gparker@apple.com" class="">gparker@apple.com</a> Runtime Wrangler</div><div><br class=""></div><div><br class=""></div></body></html>