Skip to content

Commit da7c66e

Browse files
Make parking_control (etc) use vtables (#6275)
* 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
1 parent 2495bcc commit da7c66e

File tree

3 files changed

+116
-210
lines changed

3 files changed

+116
-210
lines changed

Makefile

+3-1
Original file line numberDiff line numberDiff line change
@@ -989,7 +989,9 @@ RUNTIME_TRIPLE_WIN_GENERIC_64 = "le64-unknown-windows-unknown"
989989

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

994996
$(BUILD_DIR)/initmod.windows_%_x86_32.ll: $(SRC_DIR)/runtime/windows_%_x86.cpp $(BUILD_DIR)/clang_ok
995997
@mkdir -p $(@D)

src/runtime/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,8 @@ set(RUNTIME_CXX_FLAGS
152152
-fno-vectorize
153153
# Note: we don't want static locals to get thread synchronization stuff.
154154
-fno-threadsafe-statics
155+
# Necessary for using virtual functions in the runtime code.
156+
-fno-rtti
155157
-Wall
156158
-Wcast-qual
157159
-Werror

0 commit comments

Comments
 (0)