assembly/profiling question

Stephen Weeks
Thu, 23 Aug 2001 19:59:47 -0700

> Besides that, it would require an array whose size is the
> same as the size of the program times 4.  (The profiler uses this much.)

We want that for space profiling too.  In fact, 2^32 could really be a
limitation in self compiles.

> If you are willing to do that, then it is only one extra indirection.  You
> store the base address of the array minus _start in some cell, and then
> the store is to the contents of that word plus `.'.

Sounds excellent.  I await Matthew's approval.

> I can understand the convenience of having the output file be in the same
> format (what ever that exactly means) as the mlprof.out file, but the data
> in memory can just be what ever and be traversed when the file is written out.
> A linked list is just fine.  You follow the links into a new array, sort them
> and write it out.  What is the problem?

No problem.  What you say is true enough.  It's just a question of the
complexity of the code introduced into the code generator and the performance
overhead.  If we can come up with a scheme with only an extra instruction per
allocation, that would be ideal.  Maybe what you suggested above works.

> Note, either way the code being space-prof'd is going to be slower, so you
> can just call a C function at each allocation point.  This function can now
> compute where you are (from the return address) and just needs to get the
> size in some register.

I think the slowdown for this would be unnacceptable.