-
Type:
Task
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Query Execution
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Currently, sbe::vm::ByteCode exposes two helpers for reading values from the VM stack:
- getFromStack returns FastTuple<bool ownedOnStack, value::TypeTags, value::Value>. The ownedOnStack flag describes whether the stack slot owns the underlying value, not whether the caller does.
- getOwnedFromStack pop from the stack and return an owned tag-value pair.
The intent is for getFromStack to behave as a peek (no ownership transfer, stack retains ownership) and for getOwnedFromStack to behave as a pop (ownership moves to the caller). However, the ownedOnStack flag in getFromStack is easy to misread as “the caller owns this value,” which is not true. To make the ownership semantics explicit, change getFromStack to return a value::TagValueView (a non‑owning
{tag, value}view). Call sites that need ownership should use the “pop” helper (getOwnedFromStack / moveOwnedFromStack) and work with TagValueOwned/TagValueMaybeOwned.