On 12/17/2010 2:51 AM, Andrew Stubbs wrote:
- Have the compiler expose an API for recording information about the
value of arguments to a function when profiling. For integer arguments, this might be the minimum, maximum, and average. For pointers, NULL vs. non-NULL. Etc.
Presumably recording the return value of functions would also be handy, especially in this case?
Indeed.
- Provide a plug-in that allows the user to instrument particular
functions (e.g., strlen) by providing profiling rules:
This is cool, but most users want it to Just Work (tm). Is a plugin a suitable way to implement an on-by-default feature?
I think so. The plug-in could always ship with the compiler, just as various Eclips plug-ins ship with Eclipse, or as various kernel modules ship with the kernel. The benefit of a plug-in interface is not just third-party delivery, but also the ability for users to modify and configure behavior.
We've traditionally hard-coded things into the compiler to optimize the behavior of built-in functions, but that's something that should (ideally) be under the control of users. For example, a library developer might very well like to ship some Python code that told the compiler that calling f(g(x)) is equivalent to calling h(x), or that if n < 3, you should translate f(n) into g(1); ...; g(n).