-
- Downloads
hashx: API changes to allow recovery from late compile failures
This is an API breaking change to hashx, which modifies the error
handling strategy. The main goal here is to allow unproblematic
recovery from hashx_compile failures.
hashx_alloc can no longer fail for reasons other than memory
allocation. All platform-specific compile failures are now reported via
hashx_make(), in order to both allow later failure and avoid requiring
users of the API to maintain and test multiple failure paths.
Note that late failures may be more common in actual use than early
failures. Early failures represent architectures other than x86_64 and
aarch64. Late failures could represent a number of system configurations
where syscalls are restricted.
The definition of a hashx context no longer tries to overlay storage for
the different types of program, and instead allows one context to always
contain an interpretable description of the program as well as an optional
buffer for compiled code.
The hashx_type enum is now used to mean either a specific type of hash
function or a type of hashx context. You can allocate a context for use
only with interpreted or compiled functions, or you can use
HASHX_TRY_COMPILE to prefer the compiler with an automatic fallback on
the interpreter. After calling hashx_make(), the new hashx_query_type()
can be used if needed to determine which implementation was actually
chosen.
The error return types have been overhauled so that everyone uses the
hashx_result enum, and seed failures vs compile failures are always
clearly distinguishable.
Signed-off-by:
Micah Elizabeth Scott <beth@torproject.org>
parent
6fd5ca49
No related branches found
No related tags found
Showing
- src/ext/equix/hashx/README.md 32 additions, 5 deletionssrc/ext/equix/hashx/README.md
- src/ext/equix/hashx/include/hashx.h 54 additions, 18 deletionssrc/ext/equix/hashx/include/hashx.h
- src/ext/equix/hashx/src/bench.c 23 additions, 11 deletionssrc/ext/equix/hashx/src/bench.c
- src/ext/equix/hashx/src/compiler.c 5 additions, 4 deletionssrc/ext/equix/hashx/src/compiler.c
- src/ext/equix/hashx/src/compiler.h 1 addition, 4 deletionssrc/ext/equix/hashx/src/compiler.h
- src/ext/equix/hashx/src/context.c 10 additions, 35 deletionssrc/ext/equix/hashx/src/context.c
- src/ext/equix/hashx/src/context.h 5 additions, 11 deletionssrc/ext/equix/hashx/src/context.h
- src/ext/equix/hashx/src/hashx.c 51 additions, 27 deletionssrc/ext/equix/hashx/src/hashx.c
- src/ext/equix/hashx/src/tests.c 85 additions, 31 deletionssrc/ext/equix/hashx/src/tests.c
- src/ext/equix/hashx/src/virtual_memory.c 3 additions, 0 deletionssrc/ext/equix/hashx/src/virtual_memory.c
Loading
Please register or sign in to comment