Here's my first stab at the data type for 01_ values:
%val = type { i32, i1, %val*, { i1, %.val* } (i8*)*, void (i8*)*, i8* }
which, in a C-like syntax would be:
struct val {
int refcount;
bool bit;
struct val *next;
struct { bool bit, struct val *next } (void*) *eval;
void (void *) *free_env;
void *env;
};
where bit and next are undefined and eval is non-null for unevaluated promises, and bit is undefined and next is null and eval is null for values evaluating to nil, and bit contains the bit value and next points to the next value and eval is null for non-nil values. That's a pretty large data structure for a single element of a bit list. I could shrink it by the size of a pointer by using the same location for next and env and casting, as env and free_env are never valid at the same time as next and bit. I won't do that, though, because it would make the code less clear, and having more understandable code is more important to me in this project.
No comments:
Post a Comment