pub enum ArgBinding<'d> {
Show 17 variants
In {
formal: Symbol<'d>,
actual: Expression<'d>,
},
Init {
var: Symbol<'d>,
},
Out {
actual: Expression<'d>,
formal: Symbol<'d>,
},
Const {
var: Symbol<'d>,
value: i64,
},
ThisOf {
var: Symbol<'d>,
},
Release {
var: Symbol<'d>,
},
Step {
var: Symbol<'d>,
by: i64,
},
AssocKey {
var: Symbol<'d>,
arr: Expression<'d>,
path: Vec<NestStep<'d>>,
next: bool,
},
Capture {
temp: u32,
value: Expression<'d>,
},
AssignCaptured {
temp: u32,
target: Expression<'d>,
nba: bool,
},
FromCaptured {
temp: u32,
formal: Symbol<'d>,
},
ToCaptured {
temp: u32,
formal: Symbol<'d>,
},
CallResult {
temp: u32,
call: Expression<'d>,
},
ClassEventLeave,
CaptureThis {
temp: u32,
},
RefOpen {
temp: u32,
formal: Symbol<'d>,
actual: Expression<'d>,
},
RefClose {
temp: u32,
formal: Symbol<'d>,
actual: Expression<'d>,
},
}Expand description
One argument transfer of a task call inlined into the process CFG
(CfgBuilder::inline_task_call): a task whose body can suspend (@, #,
wait, …) cannot be an ordinary compiled function, so its body is
walked in place and these run at the start of the inlined region’s
blocks. Every symbol named here is one of ProcessCfg::inlined_locals.
Variants§
In
formal = actual: an input (or the copy-in of an inout) formal.
Init
var = its declaration initializer, or its type’s default: an
output formal or one of the task’s own locals, at task entry.
Out
actual = formal: an output/inout formal’s copy-back after the body
(actual is the lvalue expression).
Const
var = value: a foreach loop variable’s starting value.
ThisOf
var = the current object: the this of a class-method task inlined
for an implicit-this call (run() inside another method), bound in
the caller’s context. An explicit receiver (obj.run()) binds through
ArgBinding::In instead.
Release
An inlined task’s input formal or entry-initialized local ending
with the call (an automatic variable ends with its scope, LRM 6.21):
whatever class / collection handles it holds are released (LRM
13.5.1). Runs at the call’s exit block, so return and disable
release too.
Step
var += by: a foreach loop variable’s per-iteration step.
AssocKey
void'(arr.first(var)), or with next void'(arr.next(var)): a
foreach over the associative array arr walking its keys.
For an associative array nested in a collection (int m[int][string],
int q[$][int]), path holds the enclosing foreach levels that
select the array from arr (as RepeatCount::NestedSize); empty
for arr itself.
Capture
lhs = #d rhs; and the other intra-assignment timing controls (LRM
1800-2023 §10.4.1): the right-hand side is evaluated before the wait
into the compiler temporary temp (a FrameSlotSource::Temporary
frame slot, sized by ProcessCfg::captures[temp])…
AssignCaptured
…and assigned to its target after it.
With nba (lhs <= @(e) rhs;, LRM 1800-2023 §10.4.2) the assignment
is a nonblocking one, staged for the NBA region: it runs in the
synthetic fork branch [CfgBuilder::walk_nba_event] spawns.
FromCaptured
formal = temp: a recursive task’s input formal, copied from the
call’s evaluated argument (InheritedSlot::Temp) as the forked
activation starts ([CfgBuilder::inline_recursive_task]).
ToCaptured
temp = formal: a recursive task’s output/inout formal, parked in
a compiler temporary as the activation ends so the spawner can copy
it back (InheritedSlot::Return).
CallResult
Marks capture temporary temp as the value of the inlined call call
of a function that spawns processes: the call’s expression reads the
temporary (keyed by call_result_key) instead of the function’s
shared result variable, which a second call of the same function in
the statement, or another override of a virtual method, overwrites.
A no-op at run time; ArgBinding::ToCaptured parks the value.
ClassEventLeave
The resume of a mixed @(class_event or signal ...) wait (LRM 1800-2023
9.4.2.1, 15.5): the process leaves the class-event queues it is still
queued on (the signal side woke it), so a later trigger of one of those
events cannot wake a wait it is no longer in.
CaptureThis
temp = the caller’s current object: the receiver slot of a recursive
class-method activation called with an implicit this (LRM 1800-2023
8.11, 13.4.1); an explicit receiver is an ordinary
ArgBinding::Capture.
RefOpen
A ref formal bound to element actual = c[i] of a queue or dynamic
array (LRM 1800-2023 13.5.2, 7.10.3): opens a runtime reference to the
element into the 64-bit temporary temp (the collection’s tracking
outdates it on delete / pop / clear / resize), then formal = the
element.
RefClose
The copy-out of ArgBinding::RefOpen: actual = formal unless
the reference temp was outdated meanwhile.