-
Notifications
You must be signed in to change notification settings - Fork 85
Conversation
this commit replaces the two default handler (DefaultDefaultHandler and DefaultUserHardFault) by a single handler named `EndlessLoop`. This results in one less symbol being generated. Also this new handler uses `compiler_fence` to avoid the "infinite loops w/o side effects are undef values" bug in LLVM. `compiler_fence` is guaranteed to generate no code so this reduces the size of the handler (when compiler in release).
Couple of comments
|
With or without this change you can put your breakpoint on the But in any case once you are in
InfiniteLoopDefaultHandler seems too long I'll try with two handlers and the compiler_fence. |
OK, I have changed to two separate default handlers. This still saves 18 bytes (before it was 20 bytes) and one now can inspect ExceptionFrame from the default user hard fault handler -- without this commit that was not possible because I have named the default handlers |
Thanks! I guess the only question is if the extra two bytes is worth the marginally easier debugging hard faults when using the default handlers. On balance I think it's probably worth it. The new names seem good.
|
(I'm holding off on bors to check you're happy that this is done and ready, feel free to r= me if so). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks goods, gave it a try and it is fine for debugability as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@japaric is on a roll it seems, very nice!
bors r=adamgreig |
96: reduce the size of default handlers r=adamgreig a=japaric this commit replaces the two default handler (DefaultDefaultHandler and DefaultUserHardFault) by a single handler named `EndlessLoop`. This results in one less symbol being generated. Also this new handler uses `compiler_fence` to avoid the "infinite loops w/o side effects are undef values" bug in LLVM. `compiler_fence` is guaranteed to generate no code so this reduces the size of the handler (when compiler in release). --- As far as I could test this new handler doesn't generate abort instructions when optimized so it seems like a safe replacement. If we are feeling paranoid then once #95 we could implement EndlessLoop in assembly. r? @rust-embedded/cortex-m (anyone) Co-authored-by: Jorge Aparicio <jorge@japaric.io>
Build succeeded |
this commit replaces the two default handler (DefaultDefaultHandler and
DefaultUserHardFault) by a single handler named
EndlessLoop
. This results inone less symbol being generated.
Also this new handler uses
compiler_fence
to avoid the "infinite loops w/oside effects are undef values" bug in LLVM.
compiler_fence
is guaranteed togenerate no code so this reduces the size of the handler (when compiler in
release).
As far as I could test this new handler doesn't generate abort instructions when
optimized so it seems like a safe replacement. If we are feeling paranoid then
once #95 we could implement EndlessLoop in assembly.
r? @rust-embedded/cortex-m (anyone)