Improve arrays and record passing scheme (#76)

This commit is contained in:
vms
2021-04-26 14:02:26 +03:00
committed by GitHub
parent c702311595
commit 96c32b64d8
79 changed files with 1109 additions and 1079 deletions

View File

@ -14,10 +14,12 @@
* limitations under the License.
*/
use crate::IType;
use super::WType;
use super::WValue;
use it_lilo::lifter::LiError;
use it_lilo::lowerer::LoError;
use it_lilo::traits::RecordResolvableError;
use thiserror::Error as ThisError;
#[derive(Debug, ThisError)]
@ -34,19 +36,15 @@ pub enum HostImportError {
#[error("Not enough WValue arguments are provided from the Wasm side")]
MismatchWValuesCount,
/// An error related to invalid memory access during lifting IValue.
#[error("Invalid memory access while lifting IValues, offset {0}, size {1}")]
InvalidMemoryAccess(i32, i32),
#[error("{0}")]
LifterError(#[from] LiError),
/// An error related to lifting memory from arrays of pointers with odd elements count.
#[error("Arrays of pointers for value type {0:?} contains non-even count of elements")]
OddPointersCount(IType),
#[error("{0}")]
LowererError(#[from] LoError),
/// An error related to not found record in module record types.
#[error("Record with type id {0} not found")]
RecordTypeNotFound(u64),
#[error("{0}")]
RecordNotFound(#[from] RecordResolvableError),
/// An error encountered while transmiting arrays.
#[error("array of bytes with len {0} can't be transmuted to {1} type")]
TransmuteArrayError(usize, &'static str),
#[error("{0}")]
InvalidUTF8String(#[from] std::string::FromUtf8Error),
}