Add comments explaining the unsafe impls and simplify the code, too

This commit is contained in:
Mark McCaskey
2019-09-17 18:35:12 -07:00
parent 83c3909b00
commit 9c205e05a2
6 changed files with 15 additions and 13 deletions

View File

@ -474,6 +474,7 @@ pub struct ImportedFunc {
pub vmctx: *mut Ctx,
}
// manually implemented because ImportedFunc contains raw pointers directly; `Func` is marked Send (But `Ctx` actually isn't! (TODO: review this, shouldn't `Ctx` be Send?))
unsafe impl Send for ImportedFunc {}
impl ImportedFunc {
@ -503,6 +504,7 @@ pub struct LocalTable {
pub table: *mut (),
}
// manually implemented because LocalTable contains raw pointers directly
unsafe impl Send for LocalTable {}
impl LocalTable {
@ -534,6 +536,9 @@ pub struct LocalMemory {
pub memory: *mut (),
}
// manually implemented because LocalMemory contains raw pointers
unsafe impl Send for LocalMemory {}
impl LocalMemory {
#[allow(clippy::erasing_op)] // TODO
pub fn offset_base() -> u8 {
@ -584,6 +589,7 @@ pub struct Anyfunc {
pub sig_id: SigId,
}
// manually implemented because Anyfunc contains raw pointers directly
unsafe impl Send for Anyfunc {}
impl Anyfunc {