Primitives, lists, and memory

70 views
Skip to first unread message

rodol

unread,
Feb 2, 2020, 8:04:32 PM2/2/20
to ats-lang-users
I am trying to understand exactly how ATS internals work.

I don't understand how the datatypes work. Are they like named unboxed tuples,
essentially? Or are they boxed? I assume they are unboxed, but then I have trouble
understanding how lists work, since they would be like a bunch of nested unboxed
tuples. Which would be problematic since they'd be passed by value, and large lists
would have bad performance. On the other hand, if datatypes are boxed, then lists
would be like linked lists, and wouldn't be linear in memory so...

Are arrays the preferred way to get performance?

Is there something I can read that explain this part of ATS?

Andreas ZUERCHER

unread,
Feb 3, 2020, 3:26:24 PM2/3/20
to ats-lang-users
The answer(s) to this question will be fascinating & instructive to those of us studying the internals of ATS.  There will likely be 2 different avenues of answers:  the ATS2/Postiats (transliteration to C) answer and the ATS3 (interpreter for now, then compilation to LLVM IR forthcoming) answer, because the internals might differ due to the intended destination of C versus LLVM IR.  Everything about ATS2 and ATS3 is intriguing.  What a time to be alive!

gmhwxi

unread,
Feb 4, 2020, 6:47:38 AM2/4/20
to ats-lan...@googlegroups.com
Values of a datatype are boxed. In compiler terminology, such values are
referred to as boxed tagged union. Here is an example that may shed some light:


Yes, lists in ATS are the same as singly-linked lists in C.

>>Are arrays the preferred way to get performance?

Compared to lists, arrays certainly can give you more performance.
The rule of thumb for performance is that you get more performance if
you have more "flatness" in your data.

By the way, real-time systems are primarily concerned with responsiveness
(not performance).

Sorry for lack of documentation. I can only be focusing on implementing ATS3
right now :)

gmhwxi

unread,
Feb 4, 2020, 6:54:45 AM2/4/20
to ats-lang-users

I have to say that compiling ATS3 to LLVM is just a preliminary plan.
The primary plan as of now is still to target C. I hope that there will be a
community effort at some point. The implementation of ATS3 is already
structured in a way to facilitate such a effort (on building an ecosystem).

Cheers!

rodol

unread,
Feb 4, 2020, 4:31:35 PM2/4/20
to ats-lang-users
Thank you for your replies! I understand much better now, thanks.

I see now the allure of temptory, centered around batch processing arrays.
Will be looking into it and playing around with it!
Reply all
Reply to author
Forward
0 new messages