Re: HP48 : recursion : more and more slower



On Feb 17, 7:34 am, "John H Meyers" <jhmey...@xxxxxxxxxxxxxx> wrote:
On Tue, 17 Feb 2009 04:42:07 -0600:

A SWAP exchanges stack pointer 1 with stack pointer 2.
If you look into SWAP you see that the pointers are written into the
CPU and from there into memory.
So, memory changes, the system goes through all pointers (keeps track
of all pointers) and the time needed for this depends on the number of
pointers the system has to keep track of.

I still don't follow the "goes through" and "keeps track" details here :)


John is right. The stack is just an sequence of pointers. SWAP just
exchanges the top two. Adding or dropping items from the stack just
adds a new pointer and changes the register that points to the top of
the stack. It doesn't move or even look at the rest of the stack.
I'm aware of two, possibly three, times when the entire stack is
scanned, garbage collection, moving an object in temporary memory
(when all references to the object must be updated) and (possibly)
setting up error processing (sorry, I can't recall the exact command
here). In the latter case, the stack might be copied, I'm not sure.

But in the recursive program, it was the RETURN stack that grows, not
the data stack. So I'm thinking that it's the error processing and
it's copying the return stack as well as the data stack. I believe
that most SysRPL commands don't do error processing. Does one of the
commands in the original program do it?

Dave
.



Relevant Pages

  • Re: HP48 : recursion : more and more slower
    ... However Available memory are sufficient... ... objects on the stack and you will notice how the whole calc slows ... the system has to keep track of the pointers shown in the "normal ... Is it an internal operation of RPL operating system, ...
    (comp.sys.hp48)
  • Re: Preventing exploitation with rebasing
    ... which would tell us what segments were ... The best way to think of the NDS represntation of pointers is as tokens. ... therefor puts memory addresses (sometimes actual pointers to kernel ... but it turned out to be just a part of my stack.) ...
    (Bugtraq)
  • Re: Arrays
    ... cannot use pointers. ... say that basically when you pass an array, you ARE passing a pointer. ... the memory allocated for the call stack is returned to the ... and any parameters become garbage in unused memory. ...
    (microsoft.public.vb.controls)
  • Re: where does function reside in memory in C++
    ... the pointers point to? ... Is it stack or heap? ... pre-allocates memory and copies the binary ...
    (microsoft.public.dotnet.languages.vc)
  • Re: Bounds checked arrays
    ... The pointers themselves need not grow ... a stack oriented machine will have an entry for the ... Exit from a stack frame will ...
    (comp.lang.c)