unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* Question About the Variable Allocator
@ 2012-06-03 14:20 Noah Lavine
  2012-06-03 21:30 ` Andy Wingo
  0 siblings, 1 reply; 2+ messages in thread
From: Noah Lavine @ 2012-06-03 14:20 UTC (permalink / raw)
  To: guile-devel

Hello,

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?

Thanks,
Noah



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Question About the Variable Allocator
  2012-06-03 14:20 Question About the Variable Allocator Noah Lavine
@ 2012-06-03 21:30 ` Andy Wingo
  0 siblings, 0 replies; 2+ messages in thread
From: Andy Wingo @ 2012-06-03 21:30 UTC (permalink / raw)
  To: Noah Lavine; +Cc: guile-devel

Hi Noah,

On Sun 03 Jun 2012 16:20, Noah Lavine <noah.b.lavine@gmail.com> 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/



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-06-03 21:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-03 14:20 Question About the Variable Allocator Noah Lavine
2012-06-03 21:30 ` Andy Wingo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).