forked from weaselab/conflict-set
Implement keepGoing in asm if musttail is not available
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user