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

Brian Spilsbury brian.spilsbury at gmail.com
Sat Aug 18 19:38:11 UTC 2007


Hello,

Yesterday I thought that I'd have another go and unboxed functions.
This is the result. It seems a lot cleaner than before, and seems to
work nicely.

There is one big issue, which is how to deal with boxed and unboxed
versions of the same function.

In this patch, I'm using a rather ugly hack to bind the boxed version
as an anonymous function directly to the symbol-function of the name,
and ignoring (setf ...) functions -- this is not a viable approach,
but it should be sufficient to test and verify the meat of the
compiler changes.

I think that it would probably be better to have the boxed version as
the primary function, and to use a property to refer direct calls to a
different function. This would also allow the unboxed interface to
have a specific C name.

When I produced this cvs diff I also noticed two other changes that I
had forgotten about, but they're small, so I've left them in.

When using sockets, I found that short reads weren't being handled
properly -- also the built-in socket server code was leaking
descriptors.

Regards,
Brian.

---- example ----

(declaim (ftype (function (fixnum fixnum) fixnum) test))

(defun test (a b)
  (declare (type fixnum a b))
  (the fixnum (+ a b)))

should produce something like ...

/*      function definition for TEST                                  */
static cl_fixnum L1test(cl_fixnum V1, cl_fixnum V2)
{ VT2 VLEX2 CLSR2
        cl_object value0;
        {
        cl_fixnum V3;
        cl_fixnum V4;
        V3= V1;
        V4= V2;
TTL:
        return((V3)+(V4));
        }
}
/*      local function G54                                            */
static cl_object LC2__g54(cl_object V1, cl_object V2)
{ VT3 VLEX3 CLSR3
        cl_object value0;
        {
TTL:
        value0=ecl_plus(V1,V2); NVALUES=1;
        return value0;
        }
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sock-unboxed.diff
Type: application/octet-stream
Size: 13762 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20070819/8a75f5bf/attachment.obj>


More information about the ecl-devel mailing list