Commits

David Farler committed 10c44e1a3ac
Always, no, never... forget to check your references for weak semantics, that is! 94a9c512b92f0a4751fdeebc4c2839875bb75a13 made some changes to loading weak references by adding some information in the lower bits with respect to locking. These bits need to be masked out when performing a load, such as when we want to get the metadata pointer for a class instance. This normally works fine when going through the normal weak loading functions in the runtime. When the runtime function swift_ClassMirror_subscript gets the offset of one of its stored properties, it immediately packages it into the the ad-hoc existential container, known as just `Mirror` in the runtime. However, the weak reference isn't aligned! It has bit 1 set. We weren't loading the weak reference here as we would during normal SILGen, such as with a weak_load instruction. Simulate that here and make the reference strong before putting it into the Mirror container, which also clears those lower bits. rdar://problem/27475034 There are still a couple of other cases to handle, namely the unowned(safe) and unowned(unsafe) reference kinds. There may be other places where an unaligned pointer is problematic in the runtime, which we should audit for correctness. rdar://problem/27809991