 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Paul van der Eijk Guest
|
Posted: Thu Feb 02, 2006 2:53 am Post subject: Implementing a stack using virtualalloc |
|
|
While writing an interpreter, I have implemented a stack using
VirtualAlloc. The disadvantage of my current implementation is that it
is a post-increment stack. So when I push a string for example the
code looks like:
PShortString(sp)^ := s;
Inc(sp, Length(s));
What I realy want is a pre-increment stack, so I can write:
Dec(sp, Length(s));
PShortString(sp)^ := s;
This leaves the lenth byte on top of the stack.
In the post-increment example I use VirtualAlloc to extend the stack
storage as needed (like left to right). Using the pre-increment stack,
I would need to commit pages right to left. Is there a way of doing
that?
--Paul
PS Posting in this forum because of all the heap management knowledge!
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|