From: Jörg "F. Wittenberger" <[email protected]> Subject: Re: [Chicken-users] handling the undefined value Date: Fri, 19 Nov 2010 22:31:29 +0100
> Am Freitag, den 19.11.2010, 02:56 -0500 schrieb Felix: >> From: Jörg "F. Wittenberger" <[email protected]> >> Subject: Re: [Chicken-users] handling the undefined value >> Date: Thu, 18 Nov 2010 22:42:42 +0100 >> >> > >> > I guess I found the reason: "-local". Apparently it changed slightly. >> > >> > At least I found a case, where one compilation unit of mine used set! to >> > change the value of root-object. Once removed the error is gone (though >> > now I have a lot of trouble with the program logic ;-). >> > >> > I did not catch that before, because the -local switch is there for >> > quite a long time. >> > >> >> Yes, local mode is used more aggressively recently. It implies that >> toplevel definitions inside the compilation unit are not modified from >> outside (other compilation units or evaluated code). This gives much >> more inlining opportunities (which, in turn, gives most performance >> improvements). Unfortunately, redefinitions or modifications of such >> toplevel variables from other compilation units will be ineffective, >> thus not following R5RS semantics. Therefore either do not compile >> in local mode (implied by optimization-level 3), or use >> >> (declare (not inline <IDENTIFIER>)) >> >> which will prevent <IDENTIFIER> from being inlined (either completely, >> or by replacing its invocation with a direct call). > > THANK YOU VERY MUCH > > ;-) > > Seriously: I know that there is a Turing complete way to modify either > the Scheme source, auxiliary input or the compile time switches of > chicken to make it compile any s...@home data sample into a standard > "Hello world". > > But when I put "-local" into the Makefile I thereby want to express that > I do not expect my source to violate the documented rules wrt. "-local". And the compiler does exactly what you tell him/her. `-local' is an optimization option: it is intended to allow the compiler to assume that toplevel definitions are not modified from other compilation units. So, what does that mean? It means that it can inline procedures (which is possibly the most valuable optimization), that would otherwise not be subject to inlining. So why, for heaven's sake, are you using this option, if it gives you problems? Are you interested in performance? Then you will have to pay in terms of non-standard semantics, because Scheme's semantics make nearly all sorts of non-local optimizations impossible. Are you looking for optimal runtime performance? Yes? Then you will have to accept these things, or wrap everything into an enclosing scope or re-structure your code in other ways to give more opportunities for optimization. But if you are not performance paranoid, then just don't use it and be happy. I also don't understand what you mean by "violating the documented rules", not from what is stated in the manual (which is very little, admittedly - I have added a note about inlining). cheers, felix _______________________________________________ Chicken-users mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/chicken-users
