-
Notifications
You must be signed in to change notification settings - Fork 12.3k
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
[libunwind][WebAssembly] Omit unused parts of libunwind.cpp for Wasm #73196
Conversation
@llvm/pr-subscribers-libunwind Author: Heejin Ahn (aheejin) ChangesWasm doesn't use that file; Wasm does not allow access of system registers and those functionalities are provided from the VM. Wasm only uses Full diff: https://github.com/llvm/llvm-project/pull/73196.diff 1 Files Affected:
diff --git a/libunwind/src/libunwind.cpp b/libunwind/src/libunwind.cpp
index 1bd18659b7860c0..cd610377b63de8d 100644
--- a/libunwind/src/libunwind.cpp
+++ b/libunwind/src/libunwind.cpp
@@ -26,7 +26,7 @@
#include <sanitizer/asan_interface.h>
#endif
-#if !defined(__USING_SJLJ_EXCEPTIONS__)
+#if !defined(__USING_SJLJ_EXCEPTIONS__) || !defined(__USING_WASM_EXCEPTIONS__)
#include "AddressSpace.hpp"
#include "UnwindCursor.hpp"
@@ -347,7 +347,8 @@ void __unw_remove_dynamic_eh_frame_section(unw_word_t eh_frame_start) {
}
#endif // defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND)
-#endif // !defined(__USING_SJLJ_EXCEPTIONS__)
+#endif // !defined(__USING_SJLJ_EXCEPTIONS__) ||
+ // !defined(__USING_WASM_EXCEPTIONS__)
#ifdef __APPLE__
|
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.
The commit message is slightly misleading, it appears there are some parts of the file that are actually used?
Other than this, the change looks good to me. |
As the commit message says, we only use https://github.com/llvm/llvm-project/blob/main/libunwind/src/Unwind-wasm.c and not libunwind.cpp. We don't use any parts of libunwind.cpp. Do you have any suggestions on how to improve the message to make it clearer? |
Looking at the file, there is some code that will still be compiled for wasm (at least for debug builds). If those functions are also not used for wasm they should be ifdef'd out as well? Commit message could be something like |
Hmm, yes, I thought we didn't build llvm-project/libunwind/src/libunwind.cpp Lines 352 to 432 in a8ac930
But yeah then we build the llvm-project/libunwind/src/libunwind.cpp Lines 434 to 474 in a8ac930
Will fix the message accordingly. |
Wasm doesn't use most of that file; Wasm does not allow access of system registers and those functionalities are provided from the VM.
f26f6ec
to
cb110ab
Compare
I think the CI failures are unrelated. Merging. |
@trcrsired When we use it in Emscripten, we build it with |
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.
Please correct this code. Thank you!
@@ -26,7 +26,7 @@ | |||
#include <sanitizer/asan_interface.h> | |||
#endif | |||
|
|||
#if !defined(__USING_SJLJ_EXCEPTIONS__) | |||
#if !defined(__USING_SJLJ_EXCEPTIONS__) || !defined(__USING_WASM_EXCEPTIONS__) |
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.
This must be #if !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__USING_WASM_EXCEPTIONS__)
since we don't want to compile this code for either sjlj or wasm users. not (sjlj || wasm)
is equal to not(sjlj) && not(wasm)
as you know...
VE use only SjLj, so it should be warnned by the buildbot for VE, but our buildbot has been stopped last 2 months. I've noticed this problem when I've been trying to recover our buildbot. ;-)
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.
Sorry, fixed in #78230.
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.
Thanks a lot!!
Most of the changes seem irrelevant to us given that we only use `Uniwnd-wasm.cpp`. Changes related to Wasm are what I submitted upstream for adding the file to `CMakeLists.txt` and fixing some guards: llvm/llvm-project#67770 llvm/llvm-project#73196 llvm/llvm-project#78230
Most of the changes seem irrelevant to us given that we only use `Uniwnd-wasm.cpp`. Changes related to Wasm are what I submitted upstream for adding the file to `CMakeLists.txt` and fixing some guards: llvm/llvm-project#67770 llvm/llvm-project#73196 llvm/llvm-project#78230
Wasm doesn't use most of that file; Wasm does not allow access of system registers and those functionalities are provided from the VM.