[Ecls-list] Function type proclaimations not working?
Jason Sewall
jasonsewall at gmail.com
Thu May 16 22:33:38 UTC 2013
On Thu, May 16, 2013 at 3:22 PM, Matthew Mondor
<mm_lists at pulsar-zone.net> wrote:
> Would it be possible to indicate what you expect different below?
>
>> /* 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;
>> }
>
> Above I can see inline use of < rather than a generic comparison
> function call, as well as inline use of -1 instead of a generic
> substraction function call, along with the required conversions to
> fixnum...
Sorry for the missing context; the doc page I got the 'tak' example
from indicates that this is the sort of output you should expect:
/* local entry for function TAK */
static int LI1(register int V1,register int V2,register int V3)
{ VT3 VLEX3 CLSR3
TTL:
if (V2 < V1) {
goto L2;}
return(V3);
L2:
{ int V5;
V5 = LI1((V1)-1,V2,V3);
{ int V6;
V6 = LI1((V2)-1,V3,V1);
V3 = LI1((V3)-1,V1,V2);
V2 = V6;
V1 = V5;}}
goto TTL;
;;; Note: Tail-recursive call of TAK was replaced by iteration.
}
Note the signature of Ll1 and the lack of conversion functions. I am
simply interested to see how good the ECL compiler is compared to
hand-coding C, and type information is obviously a large part of that.
Cheers,
Jason
More information about the ecl-devel
mailing list