[CM] Safe functions

bil at ccrma.Stanford.EDU bil at ccrma.Stanford.EDU
Tue Jan 19 08:34:47 PST 2021


A safe function does not push anything on the s7 stack, and treats the 
arg list
passed to it as immutable and temporary (that is, it just grabs the 
arguments from
the list).  A few s7_* functions are unsafe, and that makes anything 
that calls
them also unsafe.  If the optimizer knows a function is safe, it can use 
prebuilt
lists to pass the arguments (saving in the GC), and can combine it in 
various
ways with other stuff.  If the safe function knows its return and 
argument
types, there is another level of optimization that can call it without
setting up an arglist or "unboxing" values, basically a direct call in 
C.
s7.html has a brief example (see s7_set_i_i_function), and there are 
many
examples in s7.c and clm2xen.c in Snd.



More information about the Cmdist mailing list