Commit Graph

8 Commits

Author SHA1 Message Date
Mishal Shah
23c3b15f5f Support Xcode 13 beta
* Updating availability versions
* Remove all remaining overlays in stdlib/public/Darwin/*:
   - ObjectiveC
   - Dispatch
   - CoreFoundation
   - CoreGraphics
   - Foundation
2021-06-07 12:04:31 -07:00
Joe Groff
f0e5e1911d IRGen: Access concrete type metadata by mangled name.
When we generate code that asks for complete metadata for a fully concrete specific type that
doesn't have trivial metadata access, like `(Int, String)` or `[String: [Any]]`,
generate a cache variable that points to a mangled name, and use a common accessor function
that turns that cache variable into a pointer to the instantiated metadata. This saves a bunch
of code size, and should have minimal runtime impact, since the demangling of any string only
has to happen once.

This mostly just works, though it exposed a couple of issues:

- Mangling a type ref including objc protocols didn't cause the objc protocol record to get
  instantiated. Fixed as part of this patch.
- The runtime type demangler doesn't correctly handle retroactive conformances. If there are
  multiple retroactive conformances in a process at runtime, then even though the mangled string
  refers to a specific conformance, the runtime still just picks one without listening to the
  mangler. This is left to fix later, rdar://problem/53828345.

There is some more follow-up work that we can do to further improve the gains:

- We could improve the runtime-provided entry points, adding versions that don't require size
  to be cached, and which can handle arbitrary metadata requests. This would allow for mangled
  names to also be used for incomplete metadata accesses and improve code size of some generic
  type accessors. However, we'd only be able to take advantage of the new entry points in
  OSes that ship a new runtime.
- We could choose to always symbolic reference all type references, which would generally reduce
  the size of mangled strings, as well as make runtime demangling more efficient, since it wouldn't
  need to hit the runtime caches. This would however require that we be able to handle symbolic
  references across files in the MetadataReader in order to avoid regressing remote mirror
  functionality.
2019-08-02 14:28:53 -07:00
Slava Pestov
82f8d3f2e9 RemoteAST: Try to fix a use-after-free in swift-remoteast-test
Fixes <rdar://problem/48067187>.

We keep a global context alive now, but we have to destroy it before
Swift's ASTContext is torn down.
2019-02-21 16:39:58 -05:00
Slava Pestov
1b37407227 Fix MetadataReader handling of @objc protocols in existentials 2018-11-02 00:47:11 -04:00
John McCall
3d9ac50e2c Teach MetadataReader how to skip artificial subclasses,
and improve RemoteAST to provide corresponding APIs.
2017-02-16 15:41:50 -05:00
John McCall
a8e9ad3d0d Gate the swift-remoteast-test tests on the target matching the host.
swift-remoteast-test uses the JIT to execute code in its own process.
Even if we theoretically taught the interpreter to perform some sort
of remote interpretation, that would not be sufficient to make
swift-remoteast-test work.  Therefore I've introduced a new lit
feature check specifically for swift-remoteast-test, but set it by
default to be equivalent to swift_interpreter.
2016-11-08 11:38:23 -08:00
Dmitri Gribenko
d175b3b66d Migrate FileCheck to %FileCheck in tests 2016-08-10 23:52:02 -07:00
John McCall
92cf4a6d39 Teach MetadataReader how to handle ObjCClassWrapper metadata. 2016-04-26 13:04:02 -07:00