On Sun 28 Nov 2010 21:56, Noah Lavine <noah.b.lav...@gmail.com> writes:
> I've been poking around in the code, and noticed that procs.c has a > reference to "applicable structs". They aren't as efficient as they could be. Currently applicable structs are the only nonuniform case in procedure calls -- I was trying to get procedure calls to have no conditional branches, and they (and applicable smobs) are the only odd cases. I prefer the trampoline approach used by primitives, continuations, foreign functions, etc -- they are normal procedures, whose code is a stub that does the type-specific dispatch. This is also (and even more the case) what you want for native procedures -- a native procedure call should just be a jmp and arg shuffle. Objects which don't have native implementations should have a stub that does the right thing. > I don't see how to get from C code to JIT code without pushing onto > the stack without either some assembly code or a trampoline. Well, that's what a jit library is for, no? :) Presumably it knows the calling convention for C, so it should know how to do a tail call from C -- implemented in assembly of course. Cheers, Andy -- http://wingolog.org/