mirror of
https://github.com/m-labs/artiq.git
synced 2024-12-19 00:16:29 +08:00
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:
parent
e0c7880c77
commit
1dd0d3432c
@ -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>(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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]))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user