mirror of
https://github.com/fluencelabs/interface-types
synced 2024-12-04 07:10:21 +00:00
add some logs
This commit is contained in:
parent
8de882c159
commit
d7d91a263e
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -41,6 +41,7 @@ name = "it-lilo-utils"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"fluence-it-types",
|
||||
"log",
|
||||
"paste",
|
||||
"thiserror",
|
||||
]
|
||||
|
@ -15,3 +15,4 @@ fluence-it-types = { path = "../it-types/", version = "0.2.0" }
|
||||
|
||||
paste = "1.0.5"
|
||||
thiserror = "1.0.24"
|
||||
log = "0.4.14"
|
||||
|
@ -122,6 +122,7 @@ impl<'w, 'm> SequentialWriter<'w, 'm> {
|
||||
// specialization of write_array for u8
|
||||
pub fn write_u8(&self, value: u8) {
|
||||
let offset = self.offset.get();
|
||||
log::trace!("write_u8: write {} to {}", value, offset);
|
||||
|
||||
self.writer.memory[offset].set(value);
|
||||
|
||||
|
@ -119,6 +119,7 @@ where
|
||||
})?;
|
||||
}
|
||||
|
||||
log::trace!("array.lower_memory: 1");
|
||||
let memory_index = 0;
|
||||
let memory_view = instance
|
||||
.memory(memory_index)
|
||||
@ -129,10 +130,12 @@ where
|
||||
)
|
||||
})?
|
||||
.view();
|
||||
log::trace!("array.lower_memory: 1");
|
||||
let memory = memory_view.deref();
|
||||
|
||||
let lo_helper = lilo::LoHelper::new(&**instance, memory)
|
||||
.map_err(|e| InstructionError::from_lilo(instruction.clone(), e))?;
|
||||
log::trace!("array.lower_memory: 3");
|
||||
let (offset, size) = array_lower_memory_impl(&lo_helper, values)
|
||||
.map_err(|e| InstructionError::from_lilo(instruction.clone(), e))?;
|
||||
|
||||
|
@ -43,6 +43,7 @@ pub(crate) fn array_lift_memory_impl(
|
||||
Ok(IValue::Array(ivalues))
|
||||
}
|
||||
|
||||
// Vec<String> => Vec<u32> (2 * len of prev)
|
||||
fn read_string_array(
|
||||
li_helper: &LiHelper,
|
||||
offset: usize,
|
||||
|
@ -9,6 +9,7 @@ pub(crate) fn array_lower_memory_impl(
|
||||
lo_helper: &LoHelper,
|
||||
array_values: Vec<IValue>,
|
||||
) -> LiLoResult<(usize, usize)> {
|
||||
log::trace!("array_lower_memory_impl: 1");
|
||||
if array_values.is_empty() {
|
||||
return Ok((0, 0));
|
||||
}
|
||||
@ -19,13 +20,16 @@ pub(crate) fn array_lower_memory_impl(
|
||||
size_to_allocate as _,
|
||||
type_tag_form_ivalue(&array_values[0]) as _,
|
||||
)?;
|
||||
log::trace!("array_lower_memory_impl: 2");
|
||||
|
||||
let seq_writer = lo_helper
|
||||
.writer
|
||||
.sequential_writer(offset, size_to_allocate)?;
|
||||
log::trace!("array_lower_memory_impl: 3");
|
||||
|
||||
// here it's known that all interface values have the same type
|
||||
for value in array_values {
|
||||
log::trace!("array_lower_memory_impl: write {:?}", value);
|
||||
match value {
|
||||
IValue::Boolean(value) => seq_writer.write_u8(value as _),
|
||||
IValue::S8(value) => seq_writer.write_u8(value as _),
|
||||
|
Loading…
Reference in New Issue
Block a user