[34S] Proposal for Entry RPN mode with dynamic stack
|
02-18-2015, 01:40 AM
Post: #29
|
|||
|
|||
RE: [34S] Proposal for Entry RPN mode with dynamic stack
(02-15-2015 10:28 PM)matthiaspaul Wrote: When the stack shrinks, the contents of the last stored value in the dynamic stack would be dropped back into the T register, the register set to 0 and deallocated from stack use by (normalizing the buffer and) adjusting the stack pointer accordingly.In my previous post I described the potential behaviour of the FILL command in a dynamic stack environment. This demonstrated an advantage for keeping the T duplication feature enabled. However, I have also identified a reason, why inserting 0 instead of duplicating the previous value might be useful in the dynamic RPN stack model (although with slightly more effort the T duplication feature could be supported as well - see below): If we assume, that an "empty" stack holds 0 on all 4 or 8 levels (because this is what CLSTK does), we could slightly improve the implementation so that the allocation of the *first* value on the dynamic stack only happens when a non-zero value would be pushed out of the base stack. Once the dynamic stack is not empty, any further values pushed out of the base stack would have to be stored in the dynamic stack as well (including zeros). This initial-zero-suppression scheme would save us 4 or 8 initial register allocations (of zeros) in the case of an originally empty stack, thereby relaxing the memory situation by the same amount. This works only for as long as we insert dummy zeros on stack pops when the dynamic stack is empty. We'd thereby reproduce the original stack contents. If the original stack was not empty orignally, we would neither save or loose anything. If the T duplication feature would still be desirable in the dynamic stack model, an improvement of the above could utilize a repetition counter (and optionally a variable to hold the repeated value). Basically, it would be a very crude initial-zero- or initial-value-compression scheme then. Instead of actually storing the value on the dynamic stack, we'd just count up the repetition counter for as long as the same value would have to be stored on the dynamic stack. Likewise, as soon as the dynamic stack is empty, we'd insert the repeated value (or 0 without a variable to hold the original value) for as long as the counter is not back to zero. Only then, the normal T value duplication would start again. The index-counting in the proposed R/S stack-relative addressing extension could be adapted to take this repetition counter into account as well. Greetings, Matthias -- "Programs are poems for computers." |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)