GLIL-C compilation
Hi, Stefan Israelsson Tampe stefan.ita...@gmail.com writes: #include cfkn.h #define LOCAL_REF(i) fp[i] #define LOCAL_SET(i,v) fp[i] = (v) void cfkn3676(SCM *fp, SCM **spp) { /* setup of environment */ SCM *objects, *free, program, *sp, sss[100]; sp = sss; program = fp[-1]; objects = SCM_I_VECTOR_WELTS (SCM_PROGRAM_OBJTABLE (program)); free= SCM_PROGRAM_FREE_VARIABLES(program); /* compiled section */ LCASE3666: goto L3668; LCASE3665: sp++; *sp = LOCAL_REF(1); sp++; *sp = SCM_I_MAKINUM(0); sp-=2; if(!scm_is_eq(sp[1],sp[2])) goto L3669; sp++; *sp = LOCAL_REF(2); [...] Comparing this to the VM’s bytecode interpreter should show the overhead incurred by instruction dispatch. Did you try to measure this? That’d be interesting. Thanks, Ludo’.
Re: GLIL-C compilation
On Saturday, November 20, 2010 12:11:16 am Ludovic Courtès wrote: Hi, Stefan Israelsson Tampe stefan.ita...@gmail.com writes: #include cfkn.h #define LOCAL_REF(i) fp[i] #define LOCAL_SET(i,v) fp[i] = (v) void cfkn3676(SCM *fp, SCM **spp) { /* setup of environment */ SCM *objects, *free, program, *sp, sss[100]; sp = sss; program = fp[-1]; objects = SCM_I_VECTOR_WELTS (SCM_PROGRAM_OBJTABLE (program)); free= SCM_PROGRAM_FREE_VARIABLES(program); /* compiled section */ LCASE3666: goto L3668; LCASE3665: sp++; *sp = LOCAL_REF(1); sp++; *sp = SCM_I_MAKINUM(0); sp-=2; if(!scm_is_eq(sp[1],sp[2])) goto L3669; sp++; *sp = LOCAL_REF(2); [...] Comparing this to the VM’s bytecode interpreter should show the overhead incurred by instruction dispatch. Did you try to measure this? That’d be interesting. Thanks, Ludo’. Yes on one of my machine one loop takes about 6ns for the compiled one and about 50ns for the bytcode, say a factor of 7-10 for simple tasks, but remember this is for rather trivial work.
Re: GLIL-C compilation
Stefan Israelsson Tampe stefan.ita...@gmail.com writes: On Saturday, November 20, 2010 12:11:16 am Ludovic Courtès wrote: Hi, Stefan Israelsson Tampe stefan.ita...@gmail.com writes: #include cfkn.h #define LOCAL_REF(i) fp[i] #define LOCAL_SET(i,v) fp[i] = (v) void cfkn3676(SCM *fp, SCM **spp) { /* setup of environment */ SCM *objects, *free, program, *sp, sss[100]; sp = sss; program = fp[-1]; objects = SCM_I_VECTOR_WELTS (SCM_PROGRAM_OBJTABLE (program)); free= SCM_PROGRAM_FREE_VARIABLES(program); /* compiled section */ LCASE3666: goto L3668; LCASE3665: sp++; *sp = LOCAL_REF(1); sp++; *sp = SCM_I_MAKINUM(0); sp-=2; if(!scm_is_eq(sp[1],sp[2])) goto L3669; sp++; *sp = LOCAL_REF(2); [...] Comparing this to the VM’s bytecode interpreter should show the overhead incurred by instruction dispatch. Did you try to measure this? That’d be interesting. Thanks, Ludo’. Yes on one of my machine one loop takes about 6ns for the compiled one and about 50ns for the bytcode, say a factor of 7-10 for simple tasks, but remember this is for rather trivial work. Woow, I didn’t expect so much. Ludo’.