[Ecls-list] Function type proclaimations not working?

Jason Sewall jasonsewall at gmail.com
Thu May 16 22:09:59 UTC 2013


The docs (III 4.4) give an example for optimizing code based on type
info (which seems to be missing a close paren, by the way):

(eval-when (compile)
  (proclaim '(function tak (fixnum fixnum fixnum) fixnum)))

(defun tak (x y z)
  (declare (fixnum x y z))
  (if (not (< y x))
      z
      (tak (tak (1- x) y z)
       (tak (1- y) z x)
       (tak (1- z) x y))))


ECL 13.4.1 (from HEAD built a few weeks ago) complains "Warning: The
variable name (FIXNUM FIXNUM FIXNUM) is not a symbol."

The resulting c file does not look anything like the example. Did some
behavior change/go away? Even if I add (proclaim '(optimize (speed 3)
(safety 0))), lots of type info doesn't get propagated.

If this is my fault for running things off of HEAD, please tell me to
shut up and I'll do so. Let me know if I can help, too.

Cheers,
Jason

P.S. Here's the C file (or the first part of it, anyway) if I add the
optimize directive to the above:
/*    Compiler: ECL 13.4.1                                          */
/*    Date: 2013/5/16 16:00 (yyyy/mm/dd)                            */
/*    Machine: Linux 3.8.7-201.fc18.x86_64 x86_64                   */
/*    Source: var.lisp                                              */
#include <ecl/ecl-cmp.h>
#include "var.eclh"
/*    function definition for TAK                                   */
/*    optimize speed 3, debug 0, space 0, safety 0                  */
static cl_object L1tak(cl_object v1x, cl_object v2y, cl_object v3z)
{
 cl_object T0;
 const cl_env_ptr cl_env_copy = ecl_process_env();
 cl_object value0;
 cl_fixnum v4x;
 cl_fixnum v5y;
 cl_fixnum v6z;
 v4x = ecl_fixnum(v1x);
 v5y = ecl_fixnum(v2y);
 v6z = ecl_fixnum(v3z);
TTL:
 if ((v5y)<(v4x)) { goto L1; }
 value0 = ecl_make_fixnum(v6z);
 cl_env_copy->nvalues = 1;
 return value0;
L1:;
 {
  cl_fixnum v7;
  T0 = ecl_make_integer((v4x)-1);
  v7 = ecl_fixnum(L1tak(T0, ecl_make_fixnum(v5y), ecl_make_fixnum(v6z)));
  {
   cl_fixnum v8;
   T0 = ecl_make_integer((v5y)-1);
   v8 = ecl_fixnum(L1tak(T0, ecl_make_fixnum(v6z), ecl_make_fixnum(v4x)));
   T0 = ecl_make_integer((v6z)-1);
   v6z = ecl_fixnum(L1tak(T0, ecl_make_fixnum(v4x), ecl_make_fixnum(v5y)));
   v5y = v8;
   v4x = v7;
  }
 }
 goto TTL;
}




More information about the ecl-devel mailing list