[Ecls-list] experimental patch for review (unboxed functions and some misc socket fixes)

Brian Spilsbury brian.spilsbury at gmail.com
Mon Aug 27 03:56:32 UTC 2007


Local unboxed calls;

(defun test5 ()
  (flet ((test6 (a b)
           (declare (type fixnum a b))
           (declare (si::c-unboxed ("test6" (:fixnum :fixnum) :fixnum)))
           (+ a b)))
    (declare (ftype (function (fixnum fixnum) fixnum) test6))
    (values (test6 3 4))))

produces;

/*      function definition for TEST5                                 */
static cl_object L1test5()
{ VT2 VLEX2 CLSR2
        cl_object value0;
        /* arg-rep-types NIL */

        {
TTL:
        value0=MAKE_FIXNUM(test6(2,3,4)           /*  TEST6
              */);
        NVALUES=1;
        return value0;
        }
}
/*      local function TEST6                                          */
cl_fixnum test6(cl_narg narg, cl_fixnum V1, cl_fixnum V2, ...)
{ VT3 VLEX3 CLSR3
        cl_object value0;
        /* arg-rep-types (:FIXNUM :FIXNUM) */

        if(narg!=2) FEwrong_num_arguments_anonym();
        {
        cl_fixnum V3;
        cl_fixnum V4;
        V3= V1;
        V4= V2;
TTL:
        /* call-global-loc.2  */
        NVALUES = 1; return((V3)+(V4));
        }
}

Well, it's starting to look potentially useful.

I'm wondering if the nargs argument can be removed from some closures
-- what do you think about that?

I'm also thinking about generating wrappers which just call the
unboxed function, and extending the unboxing to optionals.

I don't see how keywords or rest arguments can be sensibly unboxed.

Automatic unboxing for non-escaping closures would be very nice.

Interaction between forms taking higher order functions, like map, and
an unboxing mechanism might also be useful.

I guess I'm looking for some feedback on if this is work in the right direction.

Regards,
Brian.




More information about the ecl-devel mailing list