Stream: compiler development

Topic: list vs str 64bit abi


view this post on Zulip Brendan Hansknecht (Sep 23 2023 at 00:11):

Anyone know why we treat lists and strings differently on 64bit systems? They both should be exactly the same given they have the exact same in memory structure. I assume it is just for some legacy reason with how we generated the structures or something?

It seems that lists are are internally passed around as structs while strings are passed around as pointers. I think they probably both should be pointers. At a minimum, they probably should be the same.

view this post on Zulip Richard Feldman (Sep 23 2023 at 02:31):

I don't know the reason, but I agree we should pass them the same way!

view this post on Zulip Richard Feldman (Sep 23 2023 at 02:32):

might have been an accident bc they were implemented at different times?

view this post on Zulip Luke Boswell (Sep 23 2023 at 02:56):

Could it be we generally have more registers to fit things into on 64bit?

view this post on Zulip Brendan Hansknecht (Sep 23 2023 at 03:10):

I mean that would be a reason for maybe passing as a struct instead of a pointer, but not a reason for list and str differing.

view this post on Zulip Brendan Hansknecht (Sep 23 2023 at 03:11):

That said, I think at the size of 3 usize, by pointer is most common.

view this post on Zulip Folkert de Vries (Sep 23 2023 at 03:18):

I think we got started with strings and then got distracted and never did lists. We should

view this post on Zulip Brendan Hansknecht (Sep 23 2023 at 03:37):

Ah. That makes a lot of sense


Last updated: Jul 06 2025 at 12:14 UTC