feat: add SMALL_OPTI flag for very small added optimisations

This commit is contained in:
Nemo D'ACREMONT 2025-05-07 13:41:20 +02:00
parent 7476ccc821
commit 3ad5dc1257
No known key found for this signature in database
GPG Key ID: 85F245EC3BB1E022
2 changed files with 6 additions and 1 deletions

View File

@ -20,7 +20,7 @@ check_targets=$(addprefix check_,${all_bins})
src_dirs=$(sort $(dir $(wildcard ${src_dir}/**/))) src_dirs=$(sort $(dir $(wildcard ${src_dir}/**/)))
includes=$(patsubst %,-I%,${src_dirs}) includes=$(patsubst %,-I%,${src_dirs})
CFLAGS+=${includes} -march=native -fPIC CFLAGS+=${includes} -march=native -fPIC -DSMALL_OPTI
LDFLAGS+= LDFLAGS+=
ifdef USE_PTHREAD ifdef USE_PTHREAD
LDFLAGS+=-lpthread LDFLAGS+=-lpthread

View File

@ -73,6 +73,11 @@ int thread_yield(void)
if (TAILQ_EMPTY(&scheduler_fifo)) if (TAILQ_EMPTY(&scheduler_fifo))
return 0; return 0;
#ifdef SMALL_OPTI
if (!IS_FINISHED(running) && !IS_WAITING(running) && !IS_MUTEX_WAITING(running))
return 0;
#endif
if (HAS_STATUS(running, MUTEX_LOCKING)) { if (HAS_STATUS(running, MUTEX_LOCKING)) {
if (running->mutex_prio > 0) { if (running->mutex_prio > 0) {
running->mutex_prio--; running->mutex_prio--;