Add host_state() accessors to InstanceContents and VMContext too.

This commit is contained in:
Dan Gohman
2019-01-04 17:24:14 -08:00
parent 73b2c45313
commit 3ac4269dc5
2 changed files with 18 additions and 1 deletions

View File

@@ -409,6 +409,11 @@ impl InstanceContents {
foreign_instance_contents.memory_size(foreign_index)
}
/// Return a reference to the custom state attached to this instance.
pub fn host_state(&mut self) -> &mut Any {
return &mut *self.host_state;
}
}
/// A wrapper around an `Mmap` holding an `InstanceContents`.
@@ -686,7 +691,7 @@ impl Instance {
/// Return a reference to the custom state attached to this instance.
pub fn host_state(&mut self) -> &mut Any {
return &mut *self.mmap_field.contents_mut().host_state;
return self.mmap_field.contents_mut().host_state();
}
}