firmware: Fix object references in tuples

Sine 8740ec3dd, the alignment() information from
"run-time type information" (i.e. the Tag type) is also
used when sending tuples to the host.
This commit is contained in:
David Nadlinger 2022-12-19 00:57:46 +00:00
parent e0c7880c77
commit 1dd0d3432c
2 changed files with 5 additions and 2 deletions

View File

@ -429,8 +429,8 @@ mod tag {
// the ptr/length(s) pair is basically CSlice // the ptr/length(s) pair is basically CSlice
Tag::Bytes | Tag::String | Tag::ByteArray | Tag::List(_) | Tag::Array(_, _) => Tag::Bytes | Tag::String | Tag::ByteArray | Tag::List(_) | Tag::Array(_, _) =>
core::mem::align_of::<CSlice<()>>(), core::mem::align_of::<CSlice<()>>(),
// will not be sent from the host Tag::Keyword(_) => unreachable!("Tag::Keyword should not appear in composite types"),
_ => unreachable!("unexpected tag from host") Tag::Object => core::mem::align_of::<u32>(),
} }
} }

View File

@ -74,6 +74,9 @@ class RoundtripTest(ExperimentCase):
def test_object_list(self): def test_object_list(self):
self.assertRoundtrip([object(), object()]) self.assertRoundtrip([object(), object()])
def test_object_tuple(self):
self.assertRoundtrip((False, object(), True, 0x12345678))
def test_list_tuple(self): def test_list_tuple(self):
self.assertRoundtrip(([1, 2], [3, 4])) self.assertRoundtrip(([1, 2], [3, 4]))