Skip to content

Commit

Permalink
Make parking_control (etc) use vtables (#6275)
Browse files Browse the repository at this point in the history
* Make parking_control (etc) use vtables

This class hierarchy is clearly best modeled with virtual methods (rather than fn ptrs), but was not; we *think* this was due to COMDAT issues that have been resolved by other means. I refactored this to use virtual methods instead (and removed the unused unpark_all function); it seems to work locally.

* Add -fno-rtti to runtime compile flags (needed to allow vtables in runtime code)

* make all overrides 'final'

* Make virtual methods protected

* Make structs final too

* pacify clang-tidy
  • Loading branch information
steven-johnson authored Oct 4, 2021
1 parent 2495bcc commit da7c66e
Show file tree
Hide file tree
Showing 3 changed files with 116 additions and 210 deletions.
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -989,7 +989,9 @@ RUNTIME_TRIPLE_WIN_GENERIC_64 = "le64-unknown-windows-unknown"

# `-fno-threadsafe-statics` is very important here (note that it allows us to use a 'modern' C++
# standard but still skip threadsafe guards for static initialization in our runtime code)
RUNTIME_CXX_FLAGS = -std=c++17 -O3 -fno-vectorize -ffreestanding -fno-blocks -fno-exceptions -fno-unwind-tables -fno-threadsafe-statics
#
# `-fno-rtti` is necessary to allow us to use classes with virtual functions in the runtime code
RUNTIME_CXX_FLAGS = -std=c++17 -O3 -fno-vectorize -ffreestanding -fno-blocks -fno-exceptions -fno-unwind-tables -fno-threadsafe-statics -fno-rtti

$(BUILD_DIR)/initmod.windows_%_x86_32.ll: $(SRC_DIR)/runtime/windows_%_x86.cpp $(BUILD_DIR)/clang_ok
@mkdir -p $(@D)
Expand Down
2 changes: 2 additions & 0 deletions src/runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ set(RUNTIME_CXX_FLAGS
-fno-vectorize
# Note: we don't want static locals to get thread synchronization stuff.
-fno-threadsafe-statics
# Necessary for using virtual functions in the runtime code.
-fno-rtti
-Wall
-Wcast-qual
-Werror
Expand Down
Loading

0 comments on commit da7c66e

Please sign in to comment.