Skip to content

Preserve effect provider identity across repeated calls - #1564

Merged
sbillig merged 1 commit into
masterfrom
fevm-pr-provider-identity
Sep 23, 2026
Merged

sbillig merged 1 commit into
masterfrom
fevm-pr-provider-identity

Conversation

@sbillig

@sbillig sbillig commented Sep 22, 2026 •

Copy link
Copy Markdown
Collaborator

Repeated calls through a temporary trait-effect provider can falsely move the provider or update separate copies. Capture each provider and its projections once per with entry, then pass the same place to every effect call. Preserve actual aggregate layouts at effect boundaries and keep read-only temporaries eligible for constant storage.

This changes shared semantic and runtime lowering while preserving move, alias, and escape checks. Native execution integration follows in the runtime PR.

@sbillig
sbillig marked this pull request as ready for review September 22, 2026 07:06
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-23T04:59:54.366919Z 9944786 New commits
🔒 Security Review ✅ Completed 2026-09-23T05:17:47.904510Z 9944786 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@sbillig
sbillig force-pushed the fevm-pr-provider-identity branch from 3bb573d to 9944786 Compare September 23, 2026 04:39
@sbillig
sbillig removed this pull request from stack #1578 September 23, 2026 04:48
@sbillig
sbillig changed the base branch from fevm-native-base to master September 23, 2026 04:48
@sbillig
sbillig merged commit 7e78f9c into master Sep 23, 2026
7 checks passed
@sbillig
sbillig deleted the fevm-pr-provider-identity branch September 23, 2026 06:09
micahscopes added a commit that referenced this pull request Sep 23, 2026
Const functions could not use effects at all: a `uses` clause on a
`const fn` was an error, a call to any function with effects was an
error, and every `with` expression in a `const fn` was rejected. A
trait provider is an ordinary value, so an immutable one can be
evaluated at compile time like any other argument.

Allow a `const fn` to declare immutable trait effects and to supply
them with `with`. During evaluation a call passes each provider as a
value into the callee's effect slot, matched by the effect's binding
index rather than by its position among ordinary arguments. A `with`
provider that lowering captured as a place (#1564) is read from that
place. The checker still rejects mutable effects, type-keyed (storage)
effects, and extern functions with effects.

A call whose const arguments are still symbolic normally falls back to
a symbolic value. An effectful call does not take that fallback,
because the value would lose its provider inputs.

The `with`-in-const-fn diagnostic (8-0056) is removed, and the two
remaining const-effect messages now say what is supported.
micahscopes added a commit that referenced this pull request Sep 25, 2026
Const functions could not use effects at all: a `uses` clause on a
`const fn` was an error, a call to any function with effects was an
error, and every `with` expression in a `const fn` was rejected. A
trait provider is an ordinary value, so an immutable one can be
evaluated at compile time like any other argument.

Allow a `const fn` to declare immutable trait effects and to supply
them with `with`. During evaluation a call passes each provider as a
value into the callee's effect slot, matched by the effect's binding
index rather than by its position among ordinary arguments. A `with`
provider that lowering captured as a place (#1564) is read from that
place. The checker still rejects mutable effects, type-keyed (storage)
effects, and extern functions with effects.

Deferral needs no special case. Since #1556, a call whose input is
still generic blocks the whole attempt, which is discarded and replayed
after specialization; the replay recomputes the providers from the
caller's body. Term extraction already declines calls with effect
arguments, so a provider never enters a retained term. A test checks
that an effectful call blocks while generic and evaluates with its
provider once specialized, like a pure call.

Effect slots follow the same rules as ordinary argument slots: a
request that supplies no providers for an effectful function is
unsupported (`NotConstEvaluable`), and a slot count or index mismatch
is an invalid operation, like the existing argument arity check.

The `with`-in-const-fn diagnostic (8-0056) is removed, and the two
remaining const-effect messages now say what is supported.
micahscopes added a commit that referenced this pull request Sep 28, 2026
Const functions could not use effects at all: a `uses` clause on a
`const fn` was an error, a call to any function with effects was an
error, and every `with` expression in a `const fn` was rejected. A
trait provider is an ordinary value, so an immutable one can be
evaluated at compile time like any other argument.

Allow a `const fn` to declare immutable trait effects and to supply
them with `with`. During evaluation a call passes each provider as a
value into the callee's effect slot, matched by the effect's binding
index rather than by its position among ordinary arguments. A `with`
provider that lowering captured as a place (#1564) is read from that
place. The checker still rejects mutable effects, type-keyed (storage)
effects, and extern functions with effects.

Deferral needs no special case. Since #1556, a call whose input is
still generic blocks the whole attempt, which is discarded and replayed
after specialization; the replay recomputes the providers from the
caller's body. Term extraction already declines calls with effect
arguments, so a provider never enters a retained term. A test checks
that an effectful call blocks while generic and evaluates with its
provider once specialized, like a pure call.

Effect slots follow the same rules as ordinary argument slots: a
request that supplies no providers for an effectful function is
unsupported (`NotConstEvaluable`), and a slot count or index mismatch
is an invalid operation, like the existing argument arity check.

The `with`-in-const-fn diagnostic (8-0056) is removed, and the two
remaining const-effect messages now say what is supported.
cburgdorf added a commit that referenced this pull request Sep 30, 2026
Several user-facing changes merged after 26.3 were missing release notes
entries:

- Bugfixes: event ABI `anonymous` flag (#1562), string literal escapes
  (#1563), effect provider identity (#1564), shared calls on non-Copy
  fields (#1581), recursive raw pointer types (#1609).
- Performance: `DynArray::get` for static elements (#1559), constant
  string ABI encoding (#1560), compile-time caching (#1617, #1619, #1621).
- Native backend features: workspaces, native tests and `std::io`
  (#1565), process arguments and CPU timing (#1566), `ByteBuffer`
  (#1580).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant