fn call_with_vm<E>(&self, vm: &mut Vm, args: usize, extra: E) -> Result<Option<VmCall>, VmError>
    where
        E: Args,
    {
        Function::check_args(args, self.args)?;

        // Fast past, just allocate a call frame and keep running.
        if let Call::Immediate = self.call {
            if vm.is_same(&self.context, &self.unit) {
                vm.push_call_frame(self.offset, args)?;
                extra.into_stack(vm.stack_mut())?;
                return Ok(None);
            }
        }

        let mut new_stack = vm.stack_mut().drain_stack_top(args)?.collect::<Stack>();
        extra.into_stack(&mut new_stack)?;
        let mut vm = Vm::new_with_stack(self.context.clone(), self.unit.clone(), new_stack);
        vm.set_ip(self.offset);
        Ok(Some(VmCall::new(self.call, vm)))
    }
/// Perform a potentially optimized call into the specified vm.
///
/// This will cause a halt in case the vm being called into isn't the same
/// as the context and unit of the function.
Perform a potentially optimized call into the specified vm.
This will cause a halt in case the vm being called into isn't the same
as the context and unit of the function.
Perform a potentially optimized call into the specified vm . This will cause a halt in case the vm being called into isn ' t the same as the context and unit of the function .
fn call_with_vm<E>(&self, vm: &mut Vm, args: usize, extra: E) -> Result<Option<VmCall>, VmError>
    where
        E: Args,
    {
        Function::check_args(args, self.args)?;
        // Fast past, just allocate a call frame and keep running.
        if let Call::Immediate = self.call {
            if vm.is_same(&self.context, &self.unit) {
                vm.push_call_frame(self.offset, args)?;
                extra.into_stack(vm.stack_mut())?;
                return Ok(None);
            }
        }
        let mut new_stack = vm.stack_mut().drain_stack_top(args)?.collect::<Stack>();
        extra.into_stack(&mut new_stack)?;
        let mut vm = Vm::new_with_stack(self.context.clone(), self.unit.clone(), new_stack);
        vm.set_ip(self.offset);
        Ok(Some(VmCall::new(self.call, vm)))
    }
fn call_with_vm < E > ( & self , vm : & mut Vm , args : usize , extra : E ) -> Result < Option < VmCall > , VmError > where E : Args , { Function :: check_args ( args , self . args ) ? ; // Fast past, just allocate a call frame and keep running. if let Call :: Immediate = self . call { if vm . is_same ( & self . context , & self . unit ) { vm . push_call_frame ( self . offset , args ) ? ; extra . into_stack ( vm . stack_mut ( ) ) ? ; return Ok ( None ) ; } } let mut new_stack = vm . stack_mut ( ) . drain_stack_top ( args ) ? . collect :: < Stack > ( ) ; extra . into_stack ( & mut new_stack ) ? ; let mut vm = Vm :: new_with_stack ( self . context . clone ( ) , self . unit . clone ( ) , new_stack ) ; vm . set_ip ( self . offset ) ; Ok ( Some ( VmCall :: new ( self . call , vm ) ) ) }
Perform a potentially optimized call into the specified vm.
Perform a potentially optimized call into the specified vm .
&self
vm
&mut Vm
args
usize
extra
E
&self
vm
&mut Vm
args
usize
extra
E