fitzgen opened PR #14705 from fitzgen:bench-api-updates to bytecodealliance:main:
See each commit for details.
fitzgen requested dicej for a review on PR #14705.
fitzgen requested wasmtime-core-reviewers for a review on PR #14705.
:memo: alexcrichton submitted PR review:
I might recommend using a version field rather than a
sizefield (or maybe both?) -- I've had some good experience with that in the past over inwit-bindgen. With just asizefield then it might still be possible to read uninitialized padding bytes for example where trailingbools might not resize the structure due to padding but are otherwise uninitialized. With a version field where documentation can be added for "this field was added in this version" that might help with that problem.IIRC I've seen other C libraries have a version field as well, such as with the curl library.
fitzgen commented on PR #14705:
Good idea, I didn't think about trailing padding.
alexcrichton commented on PR #14705:
If it's helpful, this is what curl does
fitzgen updated PR #14705.
fitzgen commented on PR #14705:
Updated to include a version field as well.
:thumbs_up: alexcrichton submitted PR review.
:speech_balloon: alexcrichton created PR review comment:
I think this might technically be unsound given MIRI-style rules because this is aserting that all of
configis valid initialized memory forWasmBenchConfigwhich isn't the case for padding bytes an added fields. I think the only 100% safe way to model this would be to preserve the raw pointer under-the-hood and go to fields through raw pointers (not through&WasmBenchConfig).Another possible example is if the latest version is version 2, but this is given version 1. In that case the accessor of
cachebelow currently goes through&WasmBenchConfigbut that pointer is actually invalid for version 1 because version 2 presumably added more fields so we'd be tricking rustc into thinking there's more fields than there actually are.This is a pretty minor concern though and may not actually end up causing any issues in practice.
fitzgen updated PR #14705.
:memo: fitzgen submitted PR review.
:speech_balloon: fitzgen created PR review comment:
I pushed a new commit that should address this. Mind taking another look?
:thumbs_up: alexcrichton submitted PR review:
mmm love me some macros
alexcrichton has enabled auto merge for PR #14705.
alexcrichton added PR #14705 bench-api: breaking ABI updates to enable future extensibility and add a cache option to the merge queue.
:check: alexcrichton merged PR #14705.
alexcrichton removed PR #14705 bench-api: breaking ABI updates to enable future extensibility and add a cache option from the merge queue.
Last updated: Oct 31 2026 at 23:03 UTC