feat: comment

This commit is contained in:
2025-05-11 10:25:08 +08:00
parent 7cbb082dc4
commit be0c416c13
2 changed files with 15 additions and 0 deletions

View File

@@ -52,10 +52,16 @@ impl<'vm> VM<'vm> {
}
pub fn get_thunk(&self, idx: usize) -> &'vm Thunk<'vm> {
// SAFETY: The `idx` is within bounds as `thunks` is initialized with `prog.thunks`
// and `idx` is expected to be a valid index into this collection.
// The lifetime of the returned reference is tied to `&self`.
unsafe { &*(&self.thunks[idx] as *const _) }
}
pub fn get_func(&self, idx: usize) -> &'vm Func<'vm> {
// SAFETY: The `idx` is within bounds as `funcs` is initialized with `prog.funcs`
// and `idx` is expected to be a valid index into this collection.
// The lifetime of the returned reference is tied to `&self`.
unsafe { &*(&self.funcs[idx] as *const _) }
}