[Ecls-list] ECL_FOREIGN_DATA_P(), ecl_foreign_data_pointer_safe(), etc
Matthew Mondor
mm_lists at pulsar-zone.net
Tue Oct 2 15:29:53 UTC 2012
On Tue, 2 Oct 2012 15:40:01 +0200
Juan Jose Garcia-Ripoll <juanjose.garciaripoll at gmail.com> wrote:
> On Tue, Oct 2, 2012 at 1:14 PM, Matthew Mondor <mm_lists at pulsar-zone.net>wrote:
> I also noticed that my DECLAIM to inline the accessor functions do not
> > appear to work, so there also always are function calls made to
> > access/set structure fields no matter the SPEED/SAFETY level. This is
> > not terrible, although if such small functions could be inlined it'd be
> > nice. Since the inline declamations appeared to work in other contexts
> > for small functions, I wondered if perhaps it's a limitation of
> > functions using C-INLINE.
>
>
> The thing is that ECL does not keep code across compilations and not even
> in compiled images. This means that the INLINE declaration is not useful
> right now outside the same file (but even then, I am not sure when it is
> active. I would have to look it up)
Well interestingly enough a test just now showed the accessor functions
being inlined, thus the DECLAIM worked. The file needed to already
have been compiled and loaded once before recompilation uses the
declamations (which has been fixed by using an EVAL-WHEN).
Interestingly, the second SETF doesn't get inlined, but the first, and
the last two read accesses are (neat). I initially thought it could be
something to do with the SETF optimizer not going deep enough, but it's
still the case using two SETF.
(defun print-timeval-2 ()
(declare (optimize (speed 3) (safety 0) (debug 0)))
(let ((tv (make-timeval)))
(setf (timeval-sec tv) 1)
(setf (timeval-usec tv) 2)
(format t "~A, ~A~%" (timeval-sec tv) (timeval-usec tv))))
/* function definition for PRINT-TIMEVAL-2 */
/* optimize speed 3, debug 0, space 0, safety 0 */
static cl_object L25print_timeval_2()
{ VT26 VLEX26 CLSR26 STCK26
const cl_env_ptr cl_env_copy = ecl_process_env();
cl_object value0;
TTL:
{cl_object V1; /* TV */
V1= ecl_make_pointer(GC_MALLOC(sizeof(struct timeval)));
(((struct timeval *)ecl_to_pointer(V1))->tv_sec = (ecl_int64_t)(1));
L20_setf_timeval_usec_(ecl_make_fixnum(2),V1) /* (SETF TIMEVAL-USEC) */;
{long V2;
V2= (long)((((struct timeval *)ecl_to_pointer(V1))->tv_sec));
{long V3;
V3= (long)((((struct timeval *)ecl_to_pointer(V1))->tv_usec));
value0=cl_format(4,ECL_T,VV[139],ecl_make_long(V2),ecl_make_long(V3)) /* FORMAT */;
return value0;}}
}
}
--
Matt
More information about the ecl-devel
mailing list