Use longjmp at setjmp where possible
Where we can we should use longjmp and setjmp in preference to swapcontext/ setcontext as they seem to be more performant. Reviewed-by: Rich Salz <rsalz@openssl.org>
This commit is contained in:
parent
4cfa6204e8
commit
7070e5ca2f
@ -77,7 +77,7 @@ clean:
|
|||||||
|
|
||||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||||
|
|
||||||
arch/async_posix.o: ../../include/openssl/async.h
|
arch/async_posix.o: ../../e_os.h ../../include/openssl/async.h
|
||||||
arch/async_posix.o: ../../include/openssl/crypto.h
|
arch/async_posix.o: ../../include/openssl/crypto.h
|
||||||
arch/async_posix.o: ../../include/openssl/e_os2.h
|
arch/async_posix.o: ../../include/openssl/e_os2.h
|
||||||
arch/async_posix.o: ../../include/openssl/opensslconf.h
|
arch/async_posix.o: ../../include/openssl/opensslconf.h
|
||||||
@ -90,9 +90,10 @@ arch/async_posix.o: arch/../arch/async_posix.h arch/../arch/async_win.h
|
|||||||
arch/async_posix.o: arch/../async_locl.h arch/async_posix.c
|
arch/async_posix.o: arch/../async_locl.h arch/async_posix.c
|
||||||
arch/async_win.o: ../../include/openssl/async.h arch/async_win.c
|
arch/async_win.o: ../../include/openssl/async.h arch/async_win.c
|
||||||
arch/async_win.o: arch/async_win.h
|
arch/async_win.o: arch/async_win.h
|
||||||
async.o: ../../include/openssl/async.h ../../include/openssl/crypto.h
|
async.o: ../../e_os.h ../../include/openssl/async.h
|
||||||
async.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
|
async.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
|
||||||
async.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
|
async.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
|
||||||
async.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
|
async.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
|
||||||
async.o: ../../include/openssl/symhacks.h arch/async_null.h arch/async_posix.h
|
async.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
|
||||||
async.o: arch/async_win.h async.c async_locl.h
|
async.o: arch/async_null.h arch/async_posix.h arch/async_win.h async.c
|
||||||
|
async.o: async_locl.h
|
||||||
|
@ -75,6 +75,7 @@ int ASYNC_FIBRE_init(ASYNC_FIBRE *fibre)
|
|||||||
fibre->fibre.uc_stack.ss_sp = stack;
|
fibre->fibre.uc_stack.ss_sp = stack;
|
||||||
fibre->fibre.uc_stack.ss_size = STACKSIZE;
|
fibre->fibre.uc_stack.ss_size = STACKSIZE;
|
||||||
fibre->fibre.uc_link = NULL;
|
fibre->fibre.uc_link = NULL;
|
||||||
|
fibre->env_init = 0;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -62,20 +62,34 @@
|
|||||||
# define ASYNC_ARCH
|
# define ASYNC_ARCH
|
||||||
|
|
||||||
# include <ucontext.h>
|
# include <ucontext.h>
|
||||||
|
# include <setjmp.h>
|
||||||
|
# include "e_os.h"
|
||||||
|
|
||||||
extern __thread ASYNC_CTX *sysvctx;
|
extern __thread ASYNC_CTX *sysvctx;
|
||||||
|
|
||||||
typedef struct async_fibre_st {
|
typedef struct async_fibre_st {
|
||||||
ucontext_t fibre;
|
ucontext_t fibre;
|
||||||
|
jmp_buf env;
|
||||||
|
int env_init;
|
||||||
} ASYNC_FIBRE;
|
} ASYNC_FIBRE;
|
||||||
|
|
||||||
# define ASYNC_set_ctx(nctx) (sysvctx = (nctx))
|
# define ASYNC_set_ctx(nctx) (sysvctx = (nctx))
|
||||||
# define ASYNC_get_ctx() (sysvctx)
|
# define ASYNC_get_ctx() (sysvctx)
|
||||||
# define ASYNC_FIBRE_swapcontext(o,n,r) \
|
|
||||||
((r)? \
|
static inline int ASYNC_FIBRE_swapcontext(ASYNC_FIBRE *o, ASYNC_FIBRE *n, int r)
|
||||||
!swapcontext(&(o)->fibre, &(n)->fibre) \
|
{
|
||||||
: \
|
o->env_init = 1;
|
||||||
!setcontext(&(n)->fibre))
|
|
||||||
|
if (!r || !setjmp(o->env)) {
|
||||||
|
if (n->env_init)
|
||||||
|
longjmp(n->env, 1);
|
||||||
|
else
|
||||||
|
setcontext(&n->fibre);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
# define ASYNC_FIBRE_makecontext(c) \
|
# define ASYNC_FIBRE_makecontext(c) \
|
||||||
(ASYNC_FIBRE_init(c) \
|
(ASYNC_FIBRE_init(c) \
|
||||||
&& !getcontext(&(c)->fibre) \
|
&& !getcontext(&(c)->fibre) \
|
||||||
|
@ -4651,6 +4651,6 @@ TS_RESP_CTX_set_signer_digest 5010 EXIST::FUNCTION:
|
|||||||
TS_CONF_set_signer_digest 5011 EXIST::FUNCTION:
|
TS_CONF_set_signer_digest 5011 EXIST::FUNCTION:
|
||||||
ENGINE_load_dasync 5012 EXIST::FUNCTION:ENGINE,STATIC_ENGINE
|
ENGINE_load_dasync 5012 EXIST::FUNCTION:ENGINE,STATIC_ENGINE
|
||||||
ASYNC_pause_job 5013 EXIST::FUNCTION:
|
ASYNC_pause_job 5013 EXIST::FUNCTION:
|
||||||
ASYNC_job_is_waiting 5014 EXIST::FUNCTION:
|
ASYNC_job_is_waiting 5014 NOEXIST::FUNCTION:
|
||||||
ASYNC_in_job 5015 EXIST::FUNCTION:
|
ASYNC_in_job 5015 EXIST::FUNCTION:
|
||||||
ASYNC_start_job 5016 EXIST::FUNCTION:
|
ASYNC_start_job 5016 EXIST::FUNCTION:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user