Inquiry about return stack and function call implementation in Gforth

Jack Luo via Gforth discussion and announcements <gforth-mXXj517/[email protected]> Thu, 29 Aug 2024 00:43:28 +0000
Newsgroups gmane.comp.lang.forth.gforth
Message-ID <SYBPR01MB6969E269F70274F01BDFBB6DC2962@SYBPR01MB6969.ausprd01.prod.outlook.com>
Dear Gforth Users and Development Team,

My name is Jack, and I am a Mphil. Student at University of Sydney doing re=
search about fast fuzzing techniques. I am currently working on a project t=
hat involves deep understanding of Forth's return stack mechanics, particul=
arly in Gforth.

I am writing to inquire about the specific implementation details of the re=
turn stack in Gforth. Specifically, I am interested in:


  1.  How is the return stack physically implemented in Gforth?
2. Are there any design documents or detailed explanations available about =
the return stack's implementation?
3. How are function calls (words) implemented in terms of stack operations?=
 Specifically:

a. What exactly happens on the return stack when a word is called?
b. How is the return address handled during word execution and return?
c. Are there any special considerations for tail-call optimization in Gfort=
h?

 I have already consulted the Gforth manual and attempted to search through=
 the source code, but I haven't been able to find the specific information =
I'm looking for. I'm particularly interested in understanding how to potent=
ially implement unconditional jumps or optimize tail-recursive calls using =
return stack manipulation. Any insights or directions you could provide wou=
ld be greatly appreciated. If there are source files or documentation I sho=
uld be looking at, please let me know. Thank you for your time and for your=
 work on Gforth.

Best regards,
Jack.