Commit Graph

10 Commits

Author SHA1 Message Date
Ivan Smetanin
dd7d173c97 [stdlib] [reflection] Excise iostream from reflection 2019-10-14 20:28:20 +03:00
Slava Pestov
55cd329cb3 Reflection: Remove logic for the parent metadata source 2017-09-25 15:45:17 -07:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
practicalswift
797b80765f [gardening] Use the correct base URL (https://swift.org) in references to the Swift website
Remove all references to the old non-TLS enabled base URL (http://swift.org)
2016-11-20 17:36:03 +01:00
Slava Pestov
a72773a9b4 Reflection: Use \n instead of std::endl 2016-04-28 22:56:16 -07:00
Slava Pestov
2a44b33dc2 Reflection: Use _ instead of - as word separator in metadata source s-expression output
For consistency with TypeRefs, and AST dumping.

Most Lisps use -, but we're C++ programmers here.
2016-04-28 22:56:15 -07:00
David Farler
6a51ae84b2 Add Self- and SelfWitnessTable metadata sources to capture descriptors
These can show up in partial applications of functions with the
witness_method calling convention.
2016-04-22 19:09:06 -07:00
David Farler
09d0cfee8d Hang closure capture descriptors from their heap metadata
Now we can discern the types of values in heap boxes at runtime!
Closure reference captures are a common way of creating reference
cycles, so this provides some basic infrastructure for detecting those
someday.

A closure capture descriptor has the following:

- The number of captures.
- The number of sources of metadata reachable from the closure.
  This is important for substituting generics at runtime since we
  can't know precisely what will get captured until we observe a
  closure.
- The number of types in the NecessaryBindings structure.
  This is a holding tank in a closure for sources of metadata that
  can't be gotten from the captured values themselves.
- The metadata source map, a list of pairs, for each
  source of metadata for every generic argument needed to perform
  substitution at runtime.
  Key: The typeref for the generic parameter visible from the closure
  in the Swift source.
  Value: The metadata source, which describes how to crawl the heap from
  the closure to get to the metadata for that generic argument.
- A list of typerefs for the captured values themselves.

Follow-up: IRGen tests for various capture scenarios, which will include
MetadataSource encoding tests.

rdar://problem/24989531
2016-04-22 19:09:06 -07:00
David Farler
8d736a1cf6 MetadataSource Improvements: Builder; Parent, Impossible kinds
Create a builder divorced from the ReflectionContext so that
MetadataSources can be created in other contexts, such as emitting
private heap metadata during IRGen, where we'll have to record the
layout of captures and how to get metadata for generic arguments in
order to construct typerefs of the captures, etc.

Add Parent, Metadata capture, and Impossible metadata sources.
2016-04-22 19:09:06 -07:00
David Farler
ffdc91a038 Add MetadataSource classes
The compiler is generally free to not include pointers to metadata in
heap boxes, which are used for closure captures, if it knows you can get
to metadata through some other path. These MetadataSource classes will
describe a sequence of steps to get to metadata at runtime.

In the short term, this will be useful for describing the layout of
function/closure capture contexts, which can vary depending on what is
captured.
2016-04-15 13:52:07 -07:00