Commit 0454a7fa authored by Pavel Zakopaylo's avatar Pavel Zakopaylo

Added support for more integer sizes

This is mostly in service of implementing TagRef64, which can
now be initialized by a bundle (but is as of yet not properly
implemented).
parent 5bdbeb56
Pipeline #617 canceled with stages
...@@ -186,14 +186,13 @@ pub fn resolve_backend_type_info (ty: &MuType, vm: &VM) -> BackendTypeInfo { ...@@ -186,14 +186,13 @@ pub fn resolve_backend_type_info (ty: &MuType, vm: &VM) -> BackendTypeInfo {
size: 8, alignment: 8, struct_layout: None, elem_padded_size: None, size: 8, alignment: 8, struct_layout: None, elem_padded_size: None,
gc_type: mm::add_gc_type(GCType::new_noreftype(8, 8)) gc_type: mm::add_gc_type(GCType::new_noreftype(8, 8))
}, },
// tagref
MuType_::Tagref64 => unimplemented!(),
// floating point // floating point
MuType_::Float => BackendTypeInfo{ MuType_::Float => BackendTypeInfo{
size: 4, alignment: 4, struct_layout: None, elem_padded_size: None, size: 4, alignment: 4, struct_layout: None, elem_padded_size: None,
gc_type: mm::add_gc_type(GCType::new_noreftype(4, 4)) gc_type: mm::add_gc_type(GCType::new_noreftype(4, 4))
}, },
MuType_::Double => BackendTypeInfo { // tagref or floating point
MuType_::Tagref64 | MuType_::Double => BackendTypeInfo {
size: 8, alignment: 8, struct_layout: None, elem_padded_size: None, size: 8, alignment: 8, struct_layout: None, elem_padded_size: None,
gc_type: mm::add_gc_type(GCType::new_noreftype(8, 8)) gc_type: mm::add_gc_type(GCType::new_noreftype(8, 8))
}, },
......
...@@ -1411,11 +1411,14 @@ impl <'a> VM { ...@@ -1411,11 +1411,14 @@ impl <'a> VM {
match val.v { match val.v {
APIHandleValue::Int(ival, bits) => { APIHandleValue::Int(ival, bits) => {
match bits { match bits {
8 => addr.store::<u8>(ival as u8), 1 => addr.store::<u8>((ival as u8) & 0b1u8),
6 => addr.store::<u8>((ival as u8) & 0b111111u8),
8 => addr.store::<u8>(ival as u8),
16 => addr.store::<u16>(ival as u16), 16 => addr.store::<u16>(ival as u16),
32 => addr.store::<u32>(ival as u32), 32 => addr.store::<u32>(ival as u32),
52 => addr.store::<u64>(ival & ((1 << 51)-1)),
64 => addr.store::<u64>(ival), 64 => addr.store::<u64>(ival),
_ => panic!("unimplemented int length") _ => panic!("unimplemented int length")
} }
}, },
APIHandleValue::Float(fval) => addr.store::<f32>(fval), APIHandleValue::Float(fval) => addr.store::<f32>(fval),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment