diff options
author | Justus Winter <[email protected]> | 2017-03-23 14:21:36 +0000 |
---|---|---|
committer | Justus Winter <[email protected]> | 2017-04-07 11:50:20 +0000 |
commit | 8640fa880d7050917f4729f2c0cb506e165ee446 (patch) | |
tree | 3fe41a235ac6af9a902555093ff9814194b44995 /common/logging.c | |
parent | gpgscm: Make global data constant when possible. (diff) | |
download | gnupg-8640fa880d7050917f4729f2c0cb506e165ee446.tar.gz gnupg-8640fa880d7050917f4729f2c0cb506e165ee446.zip |
gpgscm: Allocate small integers in the rodata section.
* tests/gpgscm/Makefile.am (gpgscm_SOURCES): Add new file.
* tests/gpgscm/scheme-private.h (struct cell): Move number to the top
of the union so that we can initialize it.
(struct scheme): Remove 'integer_segment'.
* tests/gpgscm/scheme.c (initialize_small_integers): Remove function.
(small_integers): New variable.
(MAX_SMALL_INTEGER): Compute.
(mk_small_integer): Adapt.
(mark): Avoid marking objects already marked. This allows us to run
the algorithm over objects in the rodata section if they are already
marked.
(scheme_init_custom_alloc): Remove initialization.
(scheme_deinit): Remove deallocation.
* tests/gpgscm/small-integers.h: New file.
--
Allocate small integers from a fixed pool in the rodata section. This
spares us the initialization, and deduplicates integers across
different processes. It also makes the integers immutable, increasing
memory safety.
Signed-off-by: Justus Winter <[email protected]>
Diffstat (limited to 'common/logging.c')
0 files changed, 0 insertions, 0 deletions