Return-Path: Received: from SYLITH.GWYDION.CS.CMU.EDU by G.GP.CS.CMU.EDU id aa23911; 7 Jun 97 3:05:09 EDT Received: from localhost by SYLITH.GWYDION.CS.CMU.EDU id aa08006; 7 Jun 97 7:04 GMT To: ram+@cs.cmu.edu Subject: Re: d2c assembler routine Reply-To: wlott+@cs.cmu.edu In-reply-to: Your message of "Fri, 06 Jun 1997 15:23:29 EDT." Date: Sat, 07 Jun 1997 03:04:36 -0400 Message-ID: <8003.865667076@SYLITH.GWYDION.CS.CMU.EDU> From: William Lott On Fri, 06 Jun 1997 15:23:29 EDT, Rob MacLachlan wrote: > From: Andreas Bogk > To: gwydion-bugs@cs.cmu.edu > Subject: Hazards porting gd-2.0 to other platforms > > And I'm afraid I need some help on the meaning of call_on_stack, > save_state and restore_state in the assembler files in > d2c/runtime/c-code. > > So what do these things do? Is this GC or Melange support? Both? Neither. They are used by nlx. If I remember correctly, save_state takes a function and an argument, saves all the C register state on the stack, and then calls the function with the argument and a pointer to the saved registers. Restore state does the opposite: it takes a return value and a pointer to some saved registers, restores the registers, unrolls the stack back to the save_state call, and then returns the return value. call_on_stack takes a function pointer, an argument, and a stack pointer. It calls the function with the argument using the supplied stack. It is an error for the function to return. I don't think it is actually used. Or if it is, I can't think of what uses it. I have no idea why I used save/restore_state instead of setjmp and longjmp. Maybe because I had them left over from working on the lisp runtime stuff, and I'm not sure what restrictions setjmp/longjmp come with. I think there is something about local variables not guaranteed to work across the longjmp unless they are declared volatile. So maybe I just decided to get around that whole issue by using code I wrote myself. -William