Runtime stack frame management

Postby guy on Thu Jun 07, 2001 7:36 am

Change the stack frame management in the runtime so that functions can be called with a variable argument list.

Currently the stack frame is handled at compile time, so the argument pointer is wrong at the start of the called function, and the stack unwind breaks at the end of a called function.

This shouldn't need a compiler change, just the runtime:

1. Use a global to store the current stack frame pointer.
2. Stack the current stack frame on a call, and replace it with the new one.
3. Ignore the compiled in argument count on a return, use the stack frame at the point of call, and unstack the previous stack frame.

Bargain.


Guy
Guy
[url]mailto:pcform@pcform.net[/url]
http://www.pcform.net
PocketC CE API interface: http://www.networkdynamics.net/PCForm.html#library
PCForm and CE API forum: http://www.networkdynamics.net/forum
guy
 
Posts: 879
Joined: Thu Dec 07, 2000 8:58 am
Location: United Kingdom

Return to PocketC for CE Suggestions

Who is online

Users browsing this forum: No registered users and 0 guests

cron