diff options
author | Justus Winter <[email protected]> | 2016-11-10 10:47:08 +0000 |
---|---|---|
committer | Justus Winter <[email protected]> | 2016-11-10 13:57:07 +0000 |
commit | d3a98ff5bc972a4c9b01b9e5338a4a59b5b4ac48 (patch) | |
tree | 1120ba6d7f8317ce19d8a94315becabf783e8c5f /tests/gpgscm/scheme.h | |
parent | gpgscm: Make the compile-hook configurable. (diff) | |
download | gnupg-d3a98ff5bc972a4c9b01b9e5338a4a59b5b4ac48.tar.gz gnupg-d3a98ff5bc972a4c9b01b9e5338a4a59b5b4ac48.zip |
gpgscm: Reduce opcode dispatch overhead.
* tests/gpgscm/scheme.c (s_thread_to): New macro.
(CASE): Likewise.
(opexe_[0-6]): Use 'CASE' instead of 'case' statements, replace
's_goto' with 's_thread_to' where applicable.
--
This is a straight-forward optimization that replaces 's_goto' in
certain cases. Instead of returning to the calling function, and
dispatching the next opcode, we can jump to the opcode handler.
Signed-off-by: Justus Winter <[email protected]>
Diffstat (limited to 'tests/gpgscm/scheme.h')
-rw-r--r-- | tests/gpgscm/scheme.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/gpgscm/scheme.h b/tests/gpgscm/scheme.h index 8d6fb42d5..8e93177cb 100644 --- a/tests/gpgscm/scheme.h +++ b/tests/gpgscm/scheme.h @@ -90,6 +90,11 @@ extern "C" { # define USE_COMPILE_HOOK 1 #endif +/* Enable faster opcode dispatch. */ +#ifndef USE_THREADED_CODE +# define USE_THREADED_CODE 1 +#endif + #ifndef USE_STRCASECMP /* stricmp for Unix */ # define USE_STRCASECMP 0 #endif |