BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Implementing a stack using virtualalloc

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Language BASM
View previous topic :: View next topic  
Author Message
Paul van der Eijk
Guest





PostPosted: Thu Feb 02, 2006 2:53 am    Post subject: Implementing a stack using virtualalloc Reply with quote



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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Language BASM All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.