Commits

Jordan Rose committed f028cd2b6ac
Call +load on all classes to register them with the Objective-C runtime. When an Objective-C class is first used, the runtime will "realize" it, i.e. create the rw-data and set a couple flags. With pure Swift classes, though, it's possible to create an instance and then send a message to it without ever sending a message to the class, in which case the runtime will try to realize the /instance/ and mess everything up. This patch "fixes" that by sending the +load message to all Swift classes, to make sure they get realized before being used. This is a very unfortunate cost in startup time but will be necessary for id-compatibility. I will admit that I'm not sure why this is necessary for compiled classes. I would have expected the object file to contain the necessary information for the runtime to realize the classes in it by default. But perhaps classes aren't realized until their first class message even in statically- compiled code. <rdar://problem/13154445> Swift SVN r3951