pub(crate) fn fiber_yield(vm: &mut VM, args: &Args2) -> VMResult {
        let val = match args.len() {
            0 => Value::nil(),
            1 => vm[0],
            _ => Value::array_from(vm.args().to_vec()),
        };
        match vm.handle {
            None => Err(RubyError::fiber("Can not yield from main fiber.")),
            Some(handle) => {
                #[cfg(feature = "perf")]
                vm.globals.perf.get_perf(Perf::INVALID);
                #[cfg(feature = "trace")]
                eprintln!("<=== yield Ok({:?})", val);
                vm.globals.fiber_result = VMResult::Ok(val);
                asm::yield_context(handle.0);
                let val = vm.stack_pop();
                Ok(val)
            }
        }
    }
Yield args to parent fiber. (execute Fiber.yield)
ruruby/src/coroutine.rs