<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On Jun 21, 2013, at 8:16 AM, jahanian <<a href="mailto:fjahanian@apple.com">fjahanian@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="letter-spacing: 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;">With multiple identical selectors in global pool now, how do you guarantee to lookup<span class="Apple-converted-space"> </span><br>the one or the other you are looking for? Or maybe the logic is already in there.<br></div></blockquote><div dir="auto"><br></div>Sema::LookupMethodInGlobalPool() already has the logic to check whether the set of methods found is consistent; if it is, it just returns the first one (which is fine for this case). We’re going to be exercising that logic more with this change, but it’s been tested fairly well already because distinct modules would still introduce methods with the same selector and signature even before this change.</div><div dir="auto"><br></div><div dir="auto"><span class="Apple-tab-span" style="white-space:pre"> </span>- Doug</div><div dir="auto"><br><blockquote type="cite"><div style="letter-spacing: 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;">- Fariborz<br><br>On Jun 20, 2013, at 5:20 PM, Douglas Gregor <<a href="mailto:dgregor@apple.com">dgregor@apple.com</a>> wrote:<br><br><blockquote type="cite">Author: dgregor<br>Date: Thu Jun 20 19:20:25 2013<br>New Revision: 184504<br><br>URL: <a href="http://llvm.org/viewvc/llvm-project?rev=184504&view=rev">http://llvm.org/viewvc/llvm-project?rev=184504&view=rev</a><br>Log:<br>When building a module, keep *all* declared methods in the global method pool.<br><br>As an optimization, we only kept declared methods with distinct<br>signatures in the global method pool, to keep the method lists<br>small. Under modules, however, one could have two different methods<br>with the same signature that occur in different (sub)modules. If only<br>the later submodule is important, message sends to 'id' with that<br>selector would fail because the first method (the only one that got<br>into the method pool) was hidden. When building a module, keep *all*<br>of the declared methods.<br><br>I did a quick check of both module build time and uses of modules, and<br>found no performance regression despite this causing us to keep more<br>methods in the global method pool. Fixes <<a href="rdar://problem/14148896">rdar://problem/14148896</a>>.<br><br>Modified:<br> cfe/trunk/lib/Sema/SemaDeclObjC.cpp<br> cfe/trunk/test/Modules/Inputs/MethodPoolBSub.h<br> cfe/trunk/test/Modules/Inputs/module.map<br> cfe/trunk/test/Modules/method_pool.m<br><br>Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=184504&r1=184503&r2=184504&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=184504&r1=184503&r2=184504&view=diff</a><br>==============================================================================<br>--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)<br>+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Thu Jun 20 19:20:25 2013<br>@@ -2130,6 +2130,10 @@ void Sema::addMethodToGlobalList(ObjCMet<br> // signature.<br> ObjCMethodList *Previous = List;<br> for (; List; Previous = List, List = List->getNext()) {<br>+ // If we are building a module, keep all of the methods.<br>+ if (getLangOpts().Modules && !getLangOpts().CurrentModule.empty())<br>+ continue;<br>+<br> if (!MatchTwoMethodDeclarations(Method, List->Method))<br> continue;<br><br><br>Modified: cfe/trunk/test/Modules/Inputs/MethodPoolBSub.h<br>URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/MethodPoolBSub.h?rev=184504&r1=184503&r2=184504&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/MethodPoolBSub.h?rev=184504&r1=184503&r2=184504&view=diff</a><br>==============================================================================<br>--- cfe/trunk/test/Modules/Inputs/MethodPoolBSub.h (original)<br>+++ cfe/trunk/test/Modules/Inputs/MethodPoolBSub.h Thu Jun 20 19:20:25 2013<br>@@ -1,4 +1,5 @@<br>@interface B (Sub)<br>- (char *)method3;<br>- (char*)method4;<br>+- (id)method6;<br>@end<br><br>Modified: cfe/trunk/test/Modules/Inputs/module.map<br>URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/module.map?rev=184504&r1=184503&r2=184504&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/module.map?rev=184504&r1=184503&r2=184504&view=diff</a><br>==============================================================================<br>--- cfe/trunk/test/Modules/Inputs/module.map (original)<br>+++ cfe/trunk/test/Modules/Inputs/module.map Thu Jun 20 19:20:25 2013<br>@@ -131,6 +131,10 @@ module MethodPoolA {<br>module MethodPoolB {<br> header "MethodPoolB.h"<br><br>+ explicit module Sub2 {<br>+ header "MethodPoolBSub2.h"<br>+ }<br>+<br> explicit module Sub {<br> header "MethodPoolBSub.h"<br> }<br><br>Modified: cfe/trunk/test/Modules/method_pool.m<br>URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/method_pool.m?rev=184504&r1=184503&r2=184504&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/method_pool.m?rev=184504&r1=184503&r2=184504&view=diff</a><br>==============================================================================<br>--- cfe/trunk/test/Modules/method_pool.m (original)<br>+++ cfe/trunk/test/Modules/method_pool.m Thu Jun 20 19:20:25 2013<br>@@ -47,6 +47,10 @@ void testMethod3Again(id object) {<br> char *str = [object method3]; // okay: only found in MethodPoolB.Sub<br>}<br><br>+void testMethod6(id object) {<br>+ [object method6];<br>+}<br>+<br>@import MethodPoolA.Sub;<br><br>void testMethod3AgainAgain(id object) {<br><br><br>_______________________________________________<br>cfe-commits mailing list<br><a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</blockquote></div></blockquote></div><br></body></html>