[pure-lang-svn] SF.net SVN: pure-lang:[562] pure/trunk
Status: Beta
Brought to you by:
agraef
From: <ag...@us...> - 2008-08-22 08:31:36
|
Revision: 562 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=562&view=rev Author: agraef Date: 2008-08-22 08:31:46 +0000 (Fri, 22 Aug 2008) Log Message: ----------- Bugfix in comparison of global functions. Modified Paths: -------------- pure/trunk/ChangeLog pure/trunk/runtime.cc Modified: pure/trunk/ChangeLog =================================================================== --- pure/trunk/ChangeLog 2008-08-22 00:03:45 UTC (rev 561) +++ pure/trunk/ChangeLog 2008-08-22 08:31:46 UTC (rev 562) @@ -1,7 +1,15 @@ -2008-08-21 Albert Graef <Dr....@t-...> +2008-08-22 Albert Graef <Dr....@t-...> * 0.5 release. + * runtime.cc (same): Bugfix in comparison of global functions. + Handle the case of of an external which may chain to a Pure + definition of the same global. In that case we may safely assume + that the functions are the same anyway if they are represented by + the same global symbol. + +2008-08-21 Albert Graef <Dr....@t-...> + * interpreter.cc (subst): Defer const substitutions (and propagation of type tags) until all variable bindings have been processed, to prevent name capture in const substitutions. Modified: pure/trunk/runtime.cc =================================================================== --- pure/trunk/runtime.cc 2008-08-22 00:03:45 UTC (rev 561) +++ pure/trunk/runtime.cc 2008-08-22 08:31:46 UTC (rev 562) @@ -2428,13 +2428,19 @@ char test; if (x == y) return 1; + else if (x->tag != y->tag) + return 0; else if (x->tag >= 0 && y->tag >= 0) if (x->data.clos && y->data.clos) - return x->tag == y->tag && x->data.clos->fp == y->data.clos->fp; + /* Note that for global functions the function pointers may differ in + some cases (specifically in the case of an external which may chain + to a Pure definition of the same global). However, in that case we + may safely assume that the functions are the same anyway, since they + are referred to by the same global symbol. */ + return !x->data.clos->local && !y->data.clos->local || + x->data.clos->fp == y->data.clos->fp; else - return x->tag == y->tag && x->data.clos == y->data.clos; - else if (x->tag != y->tag) - return 0; + return x->data.clos == y->data.clos; else { switch (x->tag) { case EXPR::APP: { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |