>In some of the recent meetings we have discussed the ABI contract for
>pike functions. Since apply already cleans up the stack (the
>top is the return value, and the rest is discarded), it would make
>sense to change the contract so that C functions don't have to care
>what is on the stack beside the return value.
>
>However, the drawback is that you can no longer just call these
>functions (typically f_*) from other C-code if you intend to use
>anthing more than the top of the stack. E.g.
>
>  f_a();
>  f_b();
>  f_aggregate(2);

Note that f_aggregate() is an efun, and thus is responsible for
keeping track of the stack by itself.

>You would have to save the stack position and do a
>stack_pop_n_elems_keep_top() after each call.
>
>Do we still think this change is a good one?

Well, most of the functions that are called from C-code are efuns
(where clean up of the stack isn't automatic anyway). Calling
functions in objects directly is too complicated in most cases
(setting up the frame with all offsets etc), and wouldn't support
overloading, so I assume most C-code that needs to call functions in
objects does so via apply() et al.
  • C-function ... Martin Nilsson (Opera Mini - AFK!) @ Pike (-) developers forum
    • C-func... Henrik Grubbstr�m (Lysator) @ Pike (-) developers forum

Reply via email to