forked from dotnet/android
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Context: https://discord.com/channels/732297728826277939/732297837953679412/1067806732983746621 Context: https://discord.com/channels/732297728826277939/732297837953679412/1067822882274689024 In certain "bad app" scenarios, we would print a message and then **exit**(3) the app. The problem with using `exit()` in this manner is that it *can* result in the app constantly relaunching, "spamming" the UI. Improve this by calling **abort**(3) instead. This prevents Android from constantly re-launching the app, and also prints useful abort information such as registers and a native stack trace to `adb logcat`. Unexpectedly, however, "simply" replacing app calls to `exit()` with calls to `abort()` resulted in `libmonodroid.so` increasing in size by ~16%. For some reason, calling `abort()` caused the compiler to inline much more code and in a weird manner (it repeated essentially identical blocks of code from an inlined function, which were previously folded into a single block when `exit()` was used). We found that consolidating the `abort()` calls into `Helpers::abort_application()` removed the size increase.
- Loading branch information
Showing
17 changed files
with
74 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#include "helpers.hh" | ||
|
||
using namespace xamarin::android; | ||
|
||
[[noreturn]] void | ||
Helpers::abort_application () noexcept | ||
{ | ||
std::abort (); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.