Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add custom logic for reflection-emit to RemoveFeaturesStep. #590

Merged
merged 2 commits into from
May 29, 2019

Conversation

baulig
Copy link

@baulig baulig commented May 29, 2019

When --exclude-feature sre is provided, then we rewrite the System.RuntimeType.MakeTypeBuilderInstantiation to throw.

When `--exclude-feature sre` is provided, then we rewrite the
`System.RuntimeType.MakeTypeBuilderInstantiation` to throw.
@baulig baulig requested review from lewing and marek-safar May 29, 2019 15:40
baulig pushed a commit to baulig/mono that referenced this pull request May 29, 2019
…eType`.

Move call to `TypeBuilderInstantiation.MakeGenericType` into a new
`System.RuntimeType.MakeTypeBuilderInstantiation` method to allow the
linker to remove it.

Requires linker PR dotnet/linker#590.
@akoeplinger akoeplinger merged commit a59f4b3 into dotnet:master May 29, 2019
@baulig baulig deleted the work-sre branch May 29, 2019 21:30
marek-safar pushed a commit to mono/mono that referenced this pull request May 30, 2019
…eType`. (#14698)

* [corlib]: Move sre dependency into their own method in `System.RuntimeType`.

Move call to `TypeBuilderInstantiation.MakeGenericType` into a new
`System.RuntimeType.MakeTypeBuilderInstantiation` method to allow the
linker to remove it.

Requires linker PR dotnet/linker#590.

* Bump linker.

* Bump cecil as well.

* Fix the build.

* Really fix the build.

* Bump API snapshot submodule

* [csproj] Update project files
baulig pushed a commit to baulig/linker that referenced this pull request May 30, 2019
* Add custom logic for reflection-emit to RemoveFeaturesStep.

When `--exclude-feature sre` is provided, then we rewrite the
`System.RuntimeType.MakeTypeBuilderInstantiation` to throw.

* Address cosmetic feedback.
@baulig baulig mentioned this pull request Jun 5, 2019
baulig pushed a commit to baulig/linker that referenced this pull request Jun 5, 2019
This requires mono/corefx#298 and
mono/mono#14825.

We are using the same techinique as previously employed in
dotnet#590 to dynamically remove
the `System.Reflection.Emit` code.

Since the linker does not currently support dead code elimination, it cannot
break down any conditionals inside method bodies.  One trick that we use to
work around this is to move those conditional pieces into separate methods;
then we can give the linker a list of those methods and tell it to replace
their bodies with exceptions.

After this has been done in the BCL, we need to explicitly tell the linker
to turn those method bodies into stubs when `--exclude-feature globalization`.

Ideally, we would want to use `MethodAction.ConvertToStub` instead of `ConvertToThrow`
here, but we'd have to extend the code rewriter first to support methods with
arbitrary return types and parameters.
marek-safar pushed a commit that referenced this pull request Jun 6, 2019
This requires mono/corefx#298 and
mono/mono#14825.

We are using the same techinique as previously employed in
#590 to dynamically remove
the `System.Reflection.Emit` code.

Since the linker does not currently support dead code elimination, it cannot
break down any conditionals inside method bodies.  One trick that we use to
work around this is to move those conditional pieces into separate methods;
then we can give the linker a list of those methods and tell it to replace
their bodies with exceptions.

After this has been done in the BCL, we need to explicitly tell the linker
to turn those method bodies into stubs when `--exclude-feature globalization`.

Ideally, we would want to use `MethodAction.ConvertToStub` instead of `ConvertToThrow`
here, but we'd have to extend the code rewriter first to support methods with
arbitrary return types and parameters.
baulig pushed a commit to baulig/linker that referenced this pull request Jun 6, 2019
* Add custom logic for reflection-emit to RemoveFeaturesStep.

When `--exclude-feature sre` is provided, then we rewrite the
`System.RuntimeType.MakeTypeBuilderInstantiation` to throw.

* Address cosmetic feedback.

(cherry picked from commit a59f4b3)
baulig pushed a commit to baulig/linker that referenced this pull request Jun 6, 2019
This requires mono/corefx#298 and
mono/mono#14825.

We are using the same techinique as previously employed in
dotnet#590 to dynamically remove
the `System.Reflection.Emit` code.

Since the linker does not currently support dead code elimination, it cannot
break down any conditionals inside method bodies.  One trick that we use to
work around this is to move those conditional pieces into separate methods;
then we can give the linker a list of those methods and tell it to replace
their bodies with exceptions.

After this has been done in the BCL, we need to explicitly tell the linker
to turn those method bodies into stubs when `--exclude-feature globalization`.

Ideally, we would want to use `MethodAction.ConvertToStub` instead of `ConvertToThrow`
here, but we'd have to extend the code rewriter first to support methods with
arbitrary return types and parameters.

(cherry picked from commit 3eca6ad)
tkapin pushed a commit to tkapin/runtime that referenced this pull request Jan 31, 2023
…inker#590)

* Add custom logic for reflection-emit to RemoveFeaturesStep.

When `--exclude-feature sre` is provided, then we rewrite the
`System.RuntimeType.MakeTypeBuilderInstantiation` to throw.

* Address cosmetic feedback.


Commit migrated from dotnet/linker@a59f4b3
tkapin pushed a commit to tkapin/runtime that referenced this pull request Jan 31, 2023
This requires mono/corefx#298 and
mono/mono#14825.

We are using the same techinique as previously employed in
dotnet/linker#590 to dynamically remove
the `System.Reflection.Emit` code.

Since the linker does not currently support dead code elimination, it cannot
break down any conditionals inside method bodies.  One trick that we use to
work around this is to move those conditional pieces into separate methods;
then we can give the linker a list of those methods and tell it to replace
their bodies with exceptions.

After this has been done in the BCL, we need to explicitly tell the linker
to turn those method bodies into stubs when `--exclude-feature globalization`.

Ideally, we would want to use `MethodAction.ConvertToStub` instead of `ConvertToThrow`
here, but we'd have to extend the code rewriter first to support methods with
arbitrary return types and parameters.


Commit migrated from dotnet/linker@3eca6ad
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants