[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-hackers] [PATCH] scanning toplevel assignments for "safe" g
Re: [Chicken-hackers] [PATCH] scanning toplevel assignments for "safe" globals largely ineffective
Tue, 5 Jun 2012 12:27:57 +0200
On Sat, Jun 02, 2012 at 01:36:29PM +0200, Felix wrote:
> The attached patch fixes a problem with the compiler pass that scans
> toplevel assignments. That pass walks toplevel expressions and marks
> global variable definitions that appear before any code that could
> escape and possibly refer to those variables (Variables assigned
> before code executes that may use them can be referenced without a
> bounds-check). The scanning treated "##core#callunit" nodes similar to
> "##core#call" (and thus escaping) but unit-invocations are only
> generated by the compiler and always inserted at the start of the
> program, before user code. So we can just treat them as no-ops, for
> this particular analysis. Using units (or compiling stand-alone
> programs which use the default library units) was making this
> optimization mostly ineffective.
I'm not 100% sure (I don't fully grok this code), but as I understand it
a user pass could modify code and possibly insert things before the
callunit expressions. However, the unit names are strings, not
variables, so AFAIK it wouldn't make a difference either way.
In short, I've signed off and pushed this.
"The process of preparing programs for a digital computer
is especially attractive, not only because it can be economically
and scientifically rewarding, but also because it can be an aesthetic
experience much like composing poetry or music."
-- Donald Knuth