Question on bxDism

Started by gui_dpcs August 26, 2005
Hi,

I just downloaded the bxDism program from Mike Perks' website and have
been trying it out. We've been looking for a good way to do stack
analysis.

I ran it on our current project and it showed that we're about 100
bytes short of having enough stack space. You would think the project
would hardly run at all if it's that far short. I tried running bxDism
on a project that has been in continuous operation for months, and it
showed it to be 30 bytes short.

I realize bxDism is still in beta. I'm curious if there are any known
conditions that might cause it to overestimate the stack usage.
Thanks.

--
Gui Richard


--- In basicx@basi..., "gui_dpcs" <gui_dpcs@y...> wrote:
> I ran it on our current project and it showed that we're about 100
> bytes short of having enough stack space. You would think the project
> would hardly run at all if it's that far short.

Don't forget that the stack usage value is a worst-case estimate based
on a static analysis. The actual usage may differ due to the dynamic
nature of your particular program and/or its response to external
stimulii.

If you don't exercise the portion of the program that causes worst-
case usage it may run fine. Also, it is conceivable even if the worst-
case path is exercised that there won't be any ill effect.

There are also cases, which Mike describes, where the program is known
to produce an estimate that differs from reality.

My take on it is that if bxDism says you're close to or over the limit
you should take steps to reduce RAM usage. If it says you're well
under, you shouldn't have any concerns.

Don


gui_dpcs (Richard Gui) wrote:

> I just downloaded the bxDism program from Mike Perks' website and have
> been trying it out. We've been looking for a good way to do stack
> analysis.
>
> I ran it on our current project and it showed that we're about 100
> bytes short of having enough stack space. You would think the project
> would hardly run at all if it's that far short. I tried running bxDism
> on a project that has been in continuous operation for months, and it
> showed it to be 30 bytes short.
>
> I realize bxDism is still in beta. I'm curious if there are any known
> conditions that might cause it to overestimate the stack usage.
>
The one area that trips up bxDism is string manipulation and string
system function calls because of the way the BasicX runtime manipulates
the stack. Routines that may be suspect are marked with asterisks - do
you have many or few of these?

Stack space is calculated based on how much stack is used by each BasicX
machine instruction. For example a PUSHL uses 4 bytes for the long and a
POPL uses -4 bytes. It is possible that I have miscalculated the amount
of stack used by some instructions and you happen to be using a lot of
these instructions. As I don't have access to any of the internals (I do
not work for NetMedia), most of my work has been educated guesswork and
trial and error so it is possible that there are errors.

Of course bxDism does a static analysis and therefore the dynamic
runtime characteristics are slightly different. However it seems like
you have found a problem with bxDism as the margin of error is quite great.

Mike