-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add return and calling convention summary
- Loading branch information
Showing
3 changed files
with
96 additions
and
15 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
Chapters/4-Interpreter/figures/interpreter_return-ascii.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
Before return : After return | ||
: | ||
|| The Stack | | : | | | ||
|| Grows +._ _ _.- - -._ _ _.- - -._ _ _.- - -._ + : +._ _ _.- - -._ _ _.- - -._ _ _.- - -._ + | ||
\/ Down +---------------------------------------+ : framePointer ---->+---------------------------------------+ | ||
| callerFramePointer | : | callerFramePointer | | ||
| method | : | method | | ||
| context | : | context | | ||
| flags Caller's frame | : | flags Caller's frame | | ||
| receiver | : | receiver | | ||
| temporary 1 | : | temporary 1 | | ||
| temporary 2 | : | temporary 2 | | ||
| ... | : | ... | | ||
| stack value n "(send receiver)" | : stackPointer ---->| stack value n "(return value)" | | ||
| stack value n+1 "(send argument 1)" | : +---------------------------------------+ | ||
| ... | : | ||
| stack value n+m "(send argument n )" | : .--------------. | ||
| saved instructionPointer -------------|--. : instructionPointer --. |object header | | ||
framePointer ----->+--------------------------------------+ | : | |literal 0 | | ||
| callerFramePointer | | : | |... | | ||
| method | | : | |literal n | | ||
| context Callee's frame | | : | |~~~~~~~~~~~~~~| | ||
| flags | | : | |bytecode 1 | | ||
| receiver | `-:----------------------+->|bytecode 2 | | ||
| temporary 1 | : |... | | ||
| temporary 2 | : |bytecode n | | ||
| ... | : '--------------' | ||
stackPointer -----> stack value 1 | : | ||
+---------------------------------------+ : | ||
instructionPointer --> ... |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters