You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: proposals/0379-opt-in-reflection-metadata.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,7 +33,7 @@ A developer has two ways right now - either
33
33
1. To just in case enable Reflection in full.
34
34
2. To try to guess which used APIs consume Reflection, and enable it only for modules that are users of such APIs.
35
35
36
-
Both of those options have flaws. The first one leads to exsessive contribution of reflection metadta to binary size and might affects the secrecy of generated code.
36
+
Both of those options have flaws. The first one leads to excessive contribution of reflection metadata to binary size and might affects the secrecy of generated code.
37
37
The second one isn't safe because many APIs are black boxes if the guess is wrong, an app might behave not as expected at runtime.
38
38
39
39
Furthermore, APIs can use Reflection Metadata differently. Some like `print`, `debugPrint`, and `dump` will still work with disabled reflection, but the output will be limited.
@@ -47,11 +47,11 @@ If for some reason a user module was compiled with metadata generation disabled,
47
47
between state and representation which will make such API less safe since it becomes a runtime issue rather than a compile-time one.
48
48
49
49
On the other hand, excessive Reflection metadata may be preserved in a binary even if not used, because there is currently no way to statically determine its usage.
50
-
There was an attempt to limit the amount of unused reflection metadata by improving its stripability by the Dead Code Elimination LLVM pass, but in many cases,
51
-
it’s still preserved in the binary because it’s referenced by Full Type Metadata which prevents Reflection Metadata from stripping.
50
+
There was an attempt to limit the amount of unused reflection metadata by improving the Dead Code Elimination LLVM pass, but in many cases
51
+
it’s still preserved in the binary because it’s referenced by Full Type Metadata. This prevents Reflection Metadata from being stripped.
52
52
This unnecessarily increases the binary size and may simplify reverse-engineering.
53
53
54
-
Introducing a static compilation check can help to solve both of mentioned issues by adding to the language a way to express the requirement to have Reflection metadata at runtime.
54
+
Introducing a static compilation check can help to solve both of mentioned issues by adding to the language a way to express the requirement to have Reflection metadata available at runtime.
55
55
56
56
57
57
## Proposed solution
@@ -163,7 +163,7 @@ consume(Bar())
163
163
Since Reflection metadata might be used by the debugger, we propose to always keep that metadata
164
164
if full emission of debugging information isenabled (with `-gdwarf-types` or `-g` flags).
165
165
However, such Reflection metadata won't be accessible through the nominal type descriptor
166
-
which will allow to avoid inconsistencies between APIs' outputs in Release and Debug modes.
166
+
which will avoid inconsistencies in API behavior between Release and Debug modes.
0 commit comments