Skip to content
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

Allow WTF timers to participate in the event loop #15557

Draft
wants to merge 83 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
d6fc0c1
Support WTF timers integrating with event loop
190n Nov 28, 2024
2b795f0
Add regression test for #14982
190n Nov 22, 2024
a62b22d
Revert
190n Nov 22, 2024
a8079c1
Cherry-pick memory/perf tests from #14996
190n Nov 9, 2024
4977c0d
Kill zombie processes with SIGKILL instead of SIGTERM in test runner
190n Nov 9, 2024
3714111
WIP regression testing for #14982
190n Nov 9, 2024
9cd5426
Fix compile error
190n Nov 9, 2024
62a26a6
Test server performance in #14982 regression test
190n Nov 11, 2024
6af5b25
Make SubtleCrypto use Bun WorkPool instead of WTF::WorkQueue
190n Dec 3, 2024
06a894f
Specify WebKit version using commit from oven-sh/WebKit#70
190n Dec 4, 2024
351eda5
Release heap access while waiting for events (the change from #14996)
190n Dec 4, 2024
f606c10
Fix PhonyWorkQueue
190n Dec 4, 2024
40e96d9
Merge branch 'main' into ben/wtf-timer-event-loop
190n Dec 5, 2024
66b1d9a
Merge branch 'main' into ben/wtf-timer-event-loop
190n Dec 5, 2024
7bc87b3
Address todos
190n Dec 6, 2024
de5bec1
Merge branch 'ben/wtf-timer-event-loop' of github.com:oven-sh/bun int…
190n Dec 6, 2024
33d2241
Remove outdated comment
190n Dec 6, 2024
ef9ed38
Clean up #14982 regression test
190n Dec 6, 2024
26bdf55
Merge branch 'main' into ben/wtf-timer-event-loop
Jarred-Sumner Dec 12, 2024
c25469f
Update CryptoAlgorithmHMACOpenSSL.cpp
Jarred-Sumner Dec 12, 2024
908b864
Partially fix some threadsafety issues in the new timers
Jarred-Sumner Dec 12, 2024
3340ac6
oopsie
Jarred-Sumner Dec 12, 2024
3b26ee3
Merge branch 'main' into ben/wtf-timer-event-loop
190n Dec 18, 2024
e311358
Add binding for performOpportunisticallyScheduledTasks
190n Dec 20, 2024
339d2d3
Clean up WTFTimer.update
190n Dec 20, 2024
2eeb022
Merge branch 'main' into ben/wtf-timer-event-loop
190n Dec 20, 2024
204edcb
`bun run clang-tidy`
190n Dec 20, 2024
95dfb03
Merge branch 'main' into ben/wtf-timer-event-loop
Jarred-Sumner Dec 22, 2024
eea51d9
Update wtf_timer_inspection.cpp
Jarred-Sumner Dec 22, 2024
9d5b1bd
Merge branch 'main' into ben/wtf-timer-event-loop
Jarred-Sumner Dec 23, 2024
7a1cc62
Update SetupWebKit.cmake
Jarred-Sumner Dec 23, 2024
b10ec97
imminent timer
Jarred-Sumner Dec 23, 2024
bf844f6
micro-optimize
Jarred-Sumner Dec 23, 2024
b10929d
Disable WTFTimer in bytecode cache
Jarred-Sumner Dec 23, 2024
19707e2
Don't use SIGUSR1 on linux
Jarred-Sumner Dec 23, 2024
0a3d43f
Fix commander test
Jarred-Sumner Dec 23, 2024
91f9521
avoid SIGUSR1 on linux
Jarred-Sumner Dec 23, 2024
20b26f9
Merge branch 'main' into ben/wtf-timer-event-loop
190n Jan 4, 2025
b68ac34
Fix imminent timer
190n Jan 4, 2025
792756f
Merge branch 'main' into ben/wtf-timer-event-loop
190n Jan 16, 2025
e35e05f
Remove TODO
190n Jan 16, 2025
7cbf97a
Specify USE_BUN_EVENT_LOOP when building local WebKit
190n Jan 16, 2025
0378bed
Possibly remove unnecessary headers
190n Jan 16, 2025
39c7083
Use clang 18 in Makefile
190n Jan 16, 2025
50ed8d5
Fix remaining references to old clang in Makefile
190n Jan 17, 2025
0dad62e
Port bun.Lock usage to bun.Mutex
190n Jan 17, 2025
740d4d9
Remove unused extern declarations
190n Jan 17, 2025
1db3e9f
Fix C++ compile errors
190n Jan 17, 2025
b89a0ed
Merge branch 'main' into ben/wtf-timer-event-loop
190n Jan 17, 2025
9524dc9
Bump WebKit to include USE_BUN_EVENT_LOOP
190n Jan 17, 2025
114639e
Set is_bundler_thread_for_bytecode_cache for all JSC.initialize calls…
190n Jan 18, 2025
0af25fe
Bump WebKit for oven-sh/WebKit#80
190n Jan 18, 2025
deabec8
Increase timeout for #14982 test
190n Jan 18, 2025
15a7f64
Possibly fix Worker refcount issue
190n Jan 18, 2025
aa768a8
Remove unneeded file
190n Jan 20, 2025
94840d6
Fix SubtleCrypto tasks not keeping event loop alive
190n Jan 20, 2025
403f9d6
More properly fix not refing event loop
190n Jan 20, 2025
e462d93
Fix process-signal-handler.fixture.js
190n Jan 20, 2025
e420329
Revert autokiller change
190n Jan 20, 2025
7b313be
Revert TestRunner.scheduleTimeout to call remove/insert instead of up…
190n Jan 21, 2025
65ab1d3
Fix test-aborted.test.ts
190n Jan 21, 2025
77acfa1
Merge branch 'main' into ben/wtf-timer-event-loop
190n Jan 21, 2025
11edf7c
Move commander dependency to outer test folder
190n Jan 21, 2025
c07ac33
Increase #14982 timeout even more
190n Jan 21, 2025
fd2d5c0
Add missing UV timer initialization on Windows
190n Jan 21, 2025
e6773e6
Merge branch 'main' into ben/wtf-timer-event-loop
190n Jan 21, 2025
1422066
Init event loop before VM in more places
190n Jan 21, 2025
4b5941f
Fix bogus pointers stored in event loop
190n Jan 23, 2025
170d351
Fix comment
190n Jan 24, 2025
46921ef
seq_cst
190n Jan 24, 2025
ea53a88
Consolidate event loop initialization before VM
190n Jan 24, 2025
a354c0e
Merge branch 'main' into ben/wtf-timer-event-loop
190n Jan 24, 2025
b5d1f68
Implement refConcurrently/unrefConcurrently with tasks instead of ato…
190n Jan 24, 2025
e9221b2
Delete newly-unused field
190n Jan 24, 2025
7c41382
Fix ignoring concurrent_tasks in isEventLoopAlive
190n Jan 24, 2025
7ecefc2
Document expected output in napi test_promise_with_threadsafe_function
190n Jan 24, 2025
d13a100
Make some worker events fire only once
190n Jan 25, 2025
c6e62c3
Avoid never resolving worker.terminate() promise
190n Jan 25, 2025
7572913
Revert "Fix ignoring concurrent_tasks in isEventLoopAlive"
190n Jan 25, 2025
14a0ab5
Revert "Delete newly-unused field"
190n Jan 25, 2025
1736450
Revert "Implement refConcurrently/unrefConcurrently with tasks instea…
190n Jan 25, 2025
2297e90
Make Terminated and TerminateRequested tracked separately
190n Jan 25, 2025
d58e5dc
Merge branch 'main' into ben/wtf-timer-event-loop
Jarred-Sumner Jan 26, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 16 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ ZIG ?= $(shell which zig 2>/dev/null || echo -e "error: Missing zig. Please make
# This is easier to happen than you'd expect.
# Using realpath here causes issues because clang uses clang++ as a symlink
# so if that's resolved, it won't build for C++
REAL_CC = $(shell which clang-16 2>/dev/null || which clang 2>/dev/null)
REAL_CXX = $(shell which clang++-16 2>/dev/null || which clang++ 2>/dev/null)
CLANG_FORMAT = $(shell which clang-format-16 2>/dev/null || which clang-format 2>/dev/null)
REAL_CC = $(shell which clang-18 2>/dev/null || which clang 2>/dev/null)
REAL_CXX = $(shell which clang++-18 2>/dev/null || which clang++ 2>/dev/null)
CLANG_FORMAT = $(shell which clang-format-18 2>/dev/null || which clang-format 2>/dev/null)

CC = $(REAL_CC)
CXX = $(REAL_CXX)
Expand All @@ -117,14 +117,14 @@ CC_WITH_CCACHE = $(CCACHE_PATH) $(CC)
ifeq ($(OS_NAME),darwin)
# Find LLVM
ifeq ($(wildcard $(LLVM_PREFIX)),)
LLVM_PREFIX = $(shell brew --prefix llvm@16)
LLVM_PREFIX = $(shell brew --prefix llvm@18)
endif
ifeq ($(wildcard $(LLVM_PREFIX)),)
LLVM_PREFIX = $(shell brew --prefix llvm)
endif
ifeq ($(wildcard $(LLVM_PREFIX)),)
# This is kinda ugly, but I can't find a better way to error :(
LLVM_PREFIX = $(shell echo -e "error: Unable to find llvm. Please run 'brew install llvm@16' or set LLVM_PREFIX=/path/to/llvm")
LLVM_PREFIX = $(shell echo -e "error: Unable to find llvm. Please run 'brew install llvm@18' or set LLVM_PREFIX=/path/to/llvm")
endif

LDFLAGS += -L$(LLVM_PREFIX)/lib
Expand Down Expand Up @@ -164,7 +164,7 @@ CMAKE_FLAGS_WITHOUT_RELEASE = -DCMAKE_C_COMPILER=$(CC) \
-DCMAKE_OSX_DEPLOYMENT_TARGET=$(MIN_MACOS_VERSION) \
$(CMAKE_CXX_COMPILER_LAUNCHER_FLAG) \
-DCMAKE_AR=$(AR) \
-DCMAKE_RANLIB=$(which llvm-16-ranlib 2>/dev/null || which llvm-ranlib 2>/dev/null) \
-DCMAKE_RANLIB=$(which llvm-18-ranlib 2>/dev/null || which llvm-ranlib 2>/dev/null) \
-DCMAKE_CXX_STANDARD=20 \
-DCMAKE_C_STANDARD=17 \
-DCMAKE_CXX_STANDARD_REQUIRED=ON \
Expand All @@ -191,7 +191,7 @@ endif

ifeq ($(OS_NAME),linux)
LIBICONV_PATH =
AR = $(shell which llvm-ar-16 2>/dev/null || which llvm-ar 2>/dev/null || which ar 2>/dev/null)
AR = $(shell which llvm-ar-18 2>/dev/null || which llvm-ar 2>/dev/null || which ar 2>/dev/null)
endif

OPTIMIZATION_LEVEL=-O3 $(MARCH_NATIVE)
Expand Down Expand Up @@ -286,7 +286,7 @@ STRIP=/usr/bin/strip
endif

ifeq ($(OS_NAME),linux)
STRIP=$(shell which llvm-strip 2>/dev/null || which llvm-strip-16 2>/dev/null || which strip 2>/dev/null || echo "Missing strip")
STRIP=$(shell which llvm-strip 2>/dev/null || which llvm-strip-18 2>/dev/null || which strip 2>/dev/null || echo "Missing strip")
endif


Expand Down Expand Up @@ -674,7 +674,7 @@ endif
.PHONY: assert-deps
assert-deps:
@echo "Checking if the required utilities are available..."
@if [ $(CLANG_VERSION) -lt "15" ]; then echo -e "ERROR: clang version >=15 required, found: $(CLANG_VERSION). Install with:\n\n $(POSIX_PKG_MANAGER) install llvm@16"; exit 1; fi
@if [ $(CLANG_VERSION) -lt "18" ]; then echo -e "ERROR: clang version >=18 required, found: $(CLANG_VERSION). Install with:\n\n $(POSIX_PKG_MANAGER) install llvm@18"; exit 1; fi
@cmake --version >/dev/null 2>&1 || (echo -e "ERROR: cmake is required."; exit 1)
@$(PYTHON) --version >/dev/null 2>&1 || (echo -e "ERROR: python is required."; exit 1)
@$(ESBUILD) --version >/dev/null 2>&1 || (echo -e "ERROR: esbuild is required."; exit 1)
Expand Down Expand Up @@ -1261,6 +1261,7 @@ jsc-build-mac-compile:
-DBUN_FAST_TLS=ON \
-DENABLE_FTL_JIT=ON \
-DUSE_BUN_JSC_ADDITIONS=ON \
-DUSE_BUN_EVENT_LOOP=ON \
-G Ninja \
$(CMAKE_FLAGS_WITHOUT_RELEASE) \
-DPTHREAD_JIT_PERMISSIONS_API=1 \
Expand All @@ -1284,6 +1285,7 @@ jsc-build-mac-compile-lto:
-DUSE_THIN_ARCHIVES=OFF \
-DBUN_FAST_TLS=ON \
-DUSE_BUN_JSC_ADDITIONS=ON \
-DUSE_BUN_EVENT_LOOP=ON \
-DCMAKE_C_FLAGS="-flto=full" \
-DCMAKE_CXX_FLAGS="-flto=full" \
-DENABLE_FTL_JIT=ON \
Expand All @@ -1310,6 +1312,7 @@ jsc-build-mac-compile-debug:
-DENABLE_MALLOC_HEAP_BREAKDOWN=ON \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DUSE_BUN_JSC_ADDITIONS=ON \
-DUSE_BUN_EVENT_LOOP=ON \
-DENABLE_BUN_SKIP_FAILING_ASSERTIONS=ON \
-DALLOW_LINE_AND_COLUMN_NUMBER_IN_BUILTINS=ON \
-G Ninja \
Expand All @@ -1334,6 +1337,7 @@ jsc-build-linux-compile-config:
-DENABLE_BUN_SKIP_FAILING_ASSERTIONS=ON \
-DUSE_THIN_ARCHIVES=OFF \
-DUSE_BUN_JSC_ADDITIONS=ON \
-DUSE_BUN_EVENT_LOOP=ON \
-DENABLE_FTL_JIT=ON \
-DENABLE_REMOTE_INSPECTOR=ON \
-DJSEXPORT_PRIVATE=WTF_EXPORT_DECLARATION \
Expand All @@ -1357,6 +1361,7 @@ jsc-build-linux-compile-config-debug:
-DENABLE_BUN_SKIP_FAILING_ASSERTIONS=ON \
-DUSE_THIN_ARCHIVES=OFF \
-DUSE_BUN_JSC_ADDITIONS=ON \
-DUSE_BUN_EVENT_LOOP=ON \
-DENABLE_FTL_JIT=ON \
-DENABLE_REMOTE_INSPECTOR=ON \
-DJSEXPORT_PRIVATE=WTF_EXPORT_DECLARATION \
Expand All @@ -1375,14 +1380,14 @@ jsc-build-linux-compile-config-debug:
jsc-build-linux-compile-build:
mkdir -p $(WEBKIT_RELEASE_DIR) && \
cd $(WEBKIT_RELEASE_DIR) && \
CFLAGS="$(CFLAGS) -Wl,--whole-archive -ffat-lto-objects" CXXFLAGS="$(CXXFLAGS) -Wl,--whole-archive -ffat-lto-objects -DUSE_BUN_JSC_ADDITIONS=ON" \
CFLAGS="$(CFLAGS) -Wl,--whole-archive -ffat-lto-objects" CXXFLAGS="$(CXXFLAGS) -Wl,--whole-archive -ffat-lto-objects -DUSE_BUN_JSC_ADDITIONS=ON -DUSE_BUN_EVENT_LOOP=ON" \
cmake --build $(WEBKIT_RELEASE_DIR) --config relwithdebuginfo --target jsc

.PHONY: jsc-build-linux-compile-build-debug
jsc-build-linux-compile-build-debug:
mkdir -p $(WEBKIT_DEBUG_DIR) && \
cd $(WEBKIT_DEBUG_DIR) && \
CFLAGS="$(CFLAGS) -Wl,--whole-archive -ffat-lto-objects" CXXFLAGS="$(CXXFLAGS) -Wl,--whole-archive -ffat-lto-objects -DUSE_BUN_JSC_ADDITIONS=ON" \
CFLAGS="$(CFLAGS) -Wl,--whole-archive -ffat-lto-objects" CXXFLAGS="$(CXXFLAGS) -Wl,--whole-archive -ffat-lto-objects -DUSE_BUN_JSC_ADDITIONS=ON -DUSE_BUN_EVENT_LOOP=ON" \
cmake --build $(WEBKIT_DEBUG_DIR) --config Debug --target jsc


Expand Down
2 changes: 1 addition & 1 deletion cmake/tools/SetupWebKit.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ option(WEBKIT_VERSION "The version of WebKit to use")
option(WEBKIT_LOCAL "If a local version of WebKit should be used instead of downloading")

if(NOT WEBKIT_VERSION)
set(WEBKIT_VERSION 9e3b60e4a6438d20ee6f8aa5bec6b71d2b7d213f)
set(WEBKIT_VERSION e6cb36cabed465c28c7bcbb28d86e8466ea36e8d)
endif()

string(SUBSTRING ${WEBKIT_VERSION} 0 16 WEBKIT_VERSION_PREFIX)
Expand Down
Loading
Loading