feat: expose precise observations for synchronous read-only calls
This commit is contained in:
+15
-1
@@ -59,9 +59,23 @@ impl Vm {
|
||||
arguments: &[Value],
|
||||
limits: ExecutionLimits,
|
||||
) -> Result<(Value, Vec<ObjectRef>), VmError> {
|
||||
let (value, reads) =
|
||||
self.call_read_only_precise_with_limits(function, arguments, limits)?;
|
||||
Ok((value, reads.objects))
|
||||
}
|
||||
|
||||
/// Synchronous read-only call with precise observations as well as the
|
||||
/// conservative object list. Result ownership and hard limits match call().
|
||||
/// ReadSet and all identities/value snapshots inside it are borrowed only.
|
||||
pub fn call_read_only_precise_with_limits(
|
||||
&mut self,
|
||||
function: ObjectRef,
|
||||
arguments: &[Value],
|
||||
limits: ExecutionLimits,
|
||||
) -> Result<(Value, crate::ReadSet), VmError> {
|
||||
let scope = self.objects.begin_read_only();
|
||||
let result = self.call_with_limits(function, arguments, limits);
|
||||
let reads = self.objects.end_read_only(scope)?;
|
||||
let reads = self.objects.end_read_only_precise(scope)?;
|
||||
result.map(|value| (value, reads))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user