[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

declarations



First, can someone please add me to this mailing list?

Now, I can't get declarations in AKCL to work.  I'm running the latest
AKCL (505) on a Sun 3/260 compiled with cc (not gcc).  Code described
below was compiled with the default settings, i.e., OPTIMIZE levels:
Safety=0 (No runtime error checking), Space=0, Speed=3.


I looked at the code in the .c file for the following four functions,
and they were all the same.

(defun test1 (x)
  (* x x))

(defun test2 (x)
  (declare (fixnum x))
  (* x x))

(defun test3 (x)
  (the fixnum (* x x)))

(defun test4 (x)
  (declare (fixnum x))
  (the fixnum (* x x)))


The C code is shown below.  I would have at least expected #2 to
produce code using int instead of object for V1.


static L1()
{register object *base=vs_base;
	register object *sup=base+VM1; VC1
	vs_check;
	{object V1;
	V1=(base[0]);
	vs_top=sup;
TTL:;
	base[1]= number_times((V1),(V1));
	vs_top=(vs_base=base+1)+1;
	return;
	}
}



Likewise, the following four functions produced the same C code;


(proclaim '(ftype (function (fixnum) fixnum) test5))
(defun test5 (x)
  (* x x))

(proclaim '(ftype (function (fixnum) fixnum) test6))
(defun test6 (x)
  (declare (fixnum x))
  (* x x))

(proclaim '(ftype (function (fixnum) fixnum) test7))
(defun test7 (x)
  (the fixnum (* x x)))

(proclaim '(ftype (function (fixnum) fixnum) test8))
(defun test8 (x)
  (declare (fixnum x))
  (the fixnum (* x x)))


The C code this time included int declarations for the function and
arg, but rather than accepting that the arguments and result would be
fixnum, explicitly converted them to fixnums using CMPmake_fixnum.


static int LI5(V6)

int V6;
{	 VMB5 VMS5 VMV5
TTL:;{object V7;
	V7= CMPmake_fixnum(V6);{object V8;
	V8= CMPmake_fixnum(V6);
	VMR5(fix(number_times(V7,V8)))}}
}