Implement keepGoing in asm if musttail is not available
Some checks failed
Tests / Clang total: 4452, passed: 4452
Clang |Total|New|Outstanding|Fixed|Trend |:-:|:-:|:-:|:-:|:-: |0|0|0|0|:clap:
Tests / 64 bit versions total: 4452, passed: 4452
Tests / Debug total: 4450, passed: 4450
Tests / SIMD fallback total: 4452, passed: 4452
Tests / Release [gcc] total: 4452, passed: 4452
GNU C Compiler (gcc) |Total|New|Outstanding|Fixed|Trend |:-:|:-:|:-:|:-:|:-: |0|0|0|0|:clap:
Tests / Release [gcc,aarch64] total: 3313, passed: 3313
Tests / Coverage total: 3347, failed: 2, passed: 3345
weaselab/conflict-set/pipeline/head There was a failure building this commit

This commit is contained in:
2024-10-10 16:52:27 -07:00
parent 0dc657bfeb
commit 1faeb220d5
2 changed files with 19 additions and 5 deletions

View File

@@ -38,11 +38,6 @@ if(NOT APPLE)
add_compile_options(-g -fno-omit-frame-pointer)
endif()
# work around lack of musttail for gcc
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_BUILD_TYPE STREQUAL "Debug")
add_compile_options(-O1 -foptimize-sibling-calls)
endif()
set(full_relro_flags "-pie;LINKER:-z,relro,-z,now,-z,noexecstack")
cmake_push_check_state()
list(APPEND CMAKE_REQUIRED_LINK_OPTIONS ${full_relro_flags})

View File

@@ -3262,10 +3262,29 @@ struct CheckContext {
ReadContext *tls;
};
#if __has_attribute(musttail)
FLATTEN PRESERVE_NONE void keepGoing(CheckJob *job, CheckContext *context) {
job = job->next;
MUSTTAIL return job->continuation(job, context);
}
#else
static_assert(offsetof(CheckJob, next) == 0x38);
static_assert(offsetof(CheckJob, continuation) == 0x28);
extern "C" void keepGoing(CheckJob *, CheckContext *);
#if defined(__x86_64__)
asm("keepGoing:\n"
" mov 0x38(%rdi),%rdi\n"
" jmp *0x28(%rdi)\n");
#elif defined(__aarch64__)
asm("keepGoing:\n"
" ldr x0, [x0, #0x38]\n"
" ldr x16, [x0, #0x28]\n"
" br x16\n");
#else
#error "Only x64 and aarch64 are supported"
#endif
#endif
FLATTEN PRESERVE_NONE void complete(CheckJob *job, CheckContext *context) {
if (context->started == context->count) {