fn move_ep_to_heap(&mut self, ep: EnvFrame) -> EnvFrame {
        if self.check_boundary(ep.as_ptr()).is_none() {
            return ep;
        }
        let outer = ep.outer().map(|d| self.move_ep_to_heap(d));
        let heap_ep = HeapCtxRef::dup_frame(ep, outer).as_ep();

        if self.cfp.as_ptr() == ep.as_ptr() {
            self.lfp = heap_ep.get_lfp();
        }
        #[cfg(feature = "trace-func")]
        eprintln!("stack {:?} => heap {:?}", ep.as_ptr(), heap_ep.as_ptr());
        heap_ep
    }
Move outer execution contexts on the stack to the heap.
ruruby/src/vm/executor/frame.rs