[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Question About the Variable Allocator
From: |
Andy Wingo |
Subject: |
Re: Question About the Variable Allocator |
Date: |
Sun, 03 Jun 2012 23:30:41 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) |
Hi Noah,
On Sun 03 Jun 2012 16:20, Noah Lavine <address@hidden> writes:
> I've always been puzzled about part of the variable allocator. In
> module/language/tree-il/analyze.scm, we deal with allocations, which
> are hash tables that say where in the stack each local variable goes.
> The maps are two level, symbol -> {lambda -> location}. The reason
> given is that different lambdas could have different variables with
> the same symbol.
>
> But if I understand correctly, each variable also gets a gensym, and
> the gensyms are globally unique. So wouldn't it be possible to use the
> gensyms as keys instead, and only have a single level map? If so, why
> don't we do it?
AFAIR the reason is not to permit multiple lexically bound variables
with the same gensym, but to provide for different allocations of the
same variable in different closures.
Thus a variable might be at local 5 in one closure, free variable 3 in
another, free variable 6 in another, etc.
Cheers,
Andy
--
http://wingolog.org/