C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Core-Language Extension for Fetch-Only Instruction Semantics

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Wed, 3 Dec 2025 15:50:29 +0200
On Wed, 3 Dec 2025 at 15:27, Peter Bindels via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>> VI. Required Changes in C++ and OS
>>
>> A. C++ Core Language
>> Introduce new semantic category of instructions (fetch-only) with defined behavior:
>> - Visible to the abstract machine as fetch-control constructs.
>> - No execution-stage participation.
>> - No side effects beyond fetch redirection.
>
> C++ doesn't have instructions. Adding a category of instructions does not make sense since it doesn't have any to begin with.

Yet C++ has operations, including atomic operations and SIMD
operations that map directly to hw instructions. So, presumably,
C++ could have fetch-only operations that map directly to fetch-only
instructions and regions thereof.

>> B. Abstract Machine Model
>> Extend program order to include fetch-stage–only redirections.
>> Clarify that these operations do not constitute observable side effects.
>
> How would the abstract machine deal with CPU implementation level detail specifics? It's the *abstract* machine - not tied to details of how you might implement something.

In a fashion similar-ish to how the abstract machine specifies how
atomic operations work.

>> Fetch-Only Region properties:
>> - Holds fetch-only metadata (instructions addresses + 8-bit thread/execution context).
>> - MMU-enforced write validation.
>> - Stricter rules than normal memory.
>> - Prevents unauthorized metadata forging.
>
> How would that region exist? What is it for? This reads like wishful thinking or, honestly, keyword vomit.

It would exist for grouping operations that are all (guaranteed to be)
fetch-only operations. What it's for is for efficient
immune-to-reordering grouping of such operations.

>> These changes enable fetch-only instructions as a safe and efficient core-language construct.
>
> To do what?!

At the end of section III of the description:
"These reorderings may occur very frequently. Existing hardware and
language mechanisms must execute branches, indirect jumps, or
scheduler calls—each causing pipeline flushes, mispredictions, and
stalls."

So, to avoid those problems within fetch-only regions.

Received on 2025-12-03 13:50:42