Re: mixing lush with clush
Ralf Juengling <[email protected]> Thu, 16 Mar 2006 21:53:47 -0800 (PST)
| Newsgroups | gmane.lisp.lush.devel |
|---|---|
| Message-ID | <[email protected]> |
On Thu, 16 Mar 2006, Ralf Juengling wrote: > On Thu, 16 Mar 2006, Yann LeCun wrote: >> >>> Sorry, I'm not clear on the differences between DX, DY, and DH. >>> What does it mean to generate DXs instead of DHs? >> >> DX and DYs are are interpreter functions written in C. >> A DH is a function generated by the Lush compiler. The compiler actually generates a pair of functions, a C function that other C functions can call, and a DH, a little wrapper for that C function. The DH is what the interpreter gets to see; if the interpreter wants to evaluate a function that is a DH, it calls dh_listeval (in src/lisp_c). A DX is another kind of wrapper for C functions. If the interpreter wants to evaluate a DX, it calls dx_listeval (defined in src/functions; same thing for DYs). Currently, there are C functions for many DX/DY functions, but not for all. If you look into src/string.c, for example, you find the pair str_index (the C function), xstr_index (the DX wrapper for str_index), which implements the function 'index'. The implementation of function 'concat' OTH is not broken down into a pair of C function + DX wrapper, there is only one function, xstr_concat (so in this case the "wrapper" includes everything). This is what I meant with "C API" earlier: some_cfunc for every pair of some_cfunc/xsome_cfunc or some_func/ysome_func in the files in src. The DX wrappers are all hand-coded. They essentially do runtime type-checking and then call the wrapped C function (if it exits). When you say "the compiler should produce marshalling code" for C API functions, I guess you mean it should do the type checking at compile time if possible, perhaps emit C code for runtime type checking where it doesn't have enough information at compile time, and finally emit the C function call. It currently cannot do compile time type-checking because the DXs do not carry information about the C functions they wrap. DHs do carry that information. I hope that makes sense. Ralf ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642