Skip to content

Commit

Permalink
New figure
Browse files Browse the repository at this point in the history
  • Loading branch information
guillep committed Aug 19, 2024
1 parent 837479c commit 76d7cb5
Show file tree
Hide file tree
Showing 13 changed files with 54 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
|| The Stack | |
|| Grows +._ _ _.- - -._ _ _.- - -._ _ _.- - -._ +
|| Grows +._ _ _.- - -._ _ _.- - -._ _ _.- - -.__+
\/ Down | |
| callerFramePointer |
| method |
Expand All @@ -9,10 +9,10 @@
| temporary 1 |
| temporary 2 |
| ... |
| stack value n (send receiver) ------+--> someObject
| stack value n+1 (send argument 1 ) |
| "stack value n (send receiver)" ----+--> someObject
| "stack value n+1 (send argument 1 ) " |
| ... | ^
| stack value n+m (send argument n ) | |
| "stack value n+m (send argument n )" | |
| instructionPointer | |
framePointer ----->+--------------------------------------+ |
| callerFramePointer | |
Expand Down
Binary file modified Chapters/4-Interpreter/figures/interpreter_activation.pdf
Binary file not shown.
36 changes: 36 additions & 0 deletions Chapters/4-Interpreter/figures/interpreter_dnu-ascii.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
Before | | || The Stack
+._ _ _.- - -._ _ _.- - -._ _ _.- - -.__+ || Grows
+._ _ _.- - -._ _ _.- - -._ _ _.- - -.__+ \/ Down
+---------------------------------------+
framePointer ---->+ callerFramePointer |
| method |
| context |
| flags Caller's frame |
| receiver |
| temporary 1 |
| temporary 2 |
| ... |
| "stack value n (send receiver)" ---+-------------->+--+<-.
| "stack value n+1 (send argument 1)"---+---->+--+<---. +--+ |
| ... | +--+ | |
stackPointer ---->+ "stack value n+m (send argument n)"---+-->+--+<---. | |
+---------------------------------------+ +--+ | | |
| | |
Before Send | | |
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - + - - - - - -
After Send | | | +---+<--.
| | | | `-+-1 | |
+._ _ _.- - -._ _ _.- - -._ _ _.- - -.__+ | | +---+ |
+._ _ _.- - -._ _ _.- - -._ _ _.- - -.__+ | `---------+-2 | |
+---------------------------------------+ | +---+ |
framePointer ---->+ callerFramePointer | `-----------+-3 | |
| method | +---+ |
| context | message object |
| flags Caller's frame | .->+---------------+ |
| receiver | | | selector --+-> ... |
| temporary 1 | | | arguments --+----------'
| temporary 2 | | | lookupClass --+-> ...
| ... | | +---------------+
| "stack value n (send receiver)" | |
stackPointer ---->+ "stack value n+1 (send argument 1)"---+-'
+---------------------------------------+
Binary file not shown.
4 changes: 2 additions & 2 deletions Chapters/4-Interpreter/figures/interpreter_flags-ascii.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
+63 ------------------ 56 +55 - 32 +31 -- 24 +23 ----- 16 +15 --- 8 +7 ----- 0 +
| backjumpCount (JIT VM ) | unused | isBlock | hasContext | numArgs | 00000001 |
| "backjumpCount (JIT VM)"| unused | isBlock | hasContext | numArgs | 00000001 |
+-------------------------+--------+---------+------------+---------+----------+

+31 -------------------------- 24 +23 ----- 16 +15 --- 8 +7 ----- 0 +
| backjumpCount (JIT VM )/isBlock | hasContext | numArgs | 00000001 |
| "backjumpCount (JIT VM)/isBlock"| hasContext | numArgs | 00000001 |
+---------------------------------+------------+---------+----------+
Binary file modified Chapters/4-Interpreter/figures/interpreter_flags.pdf
Binary file not shown.
4 changes: 2 additions & 2 deletions Chapters/4-Interpreter/figures/interpreter_return-ascii.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Before return : After return
:
|| The Stack | | : | |
|| Grows +._ _ _.- - -._ _ _.- - -._ _ _.- - -._ + : +._ _ _.- - -._ _ _.- - -._ _ _.- - -._ +
|| Grows +._ _ _.- - -._ _ _.- - -._ _ _.- - -.__+ : +._ _ _.- - -._ _ _.- - -._ _ _.- - -.__+
\/ Down +---------------------------------------+ : framePointer ---->+---------------------------------------+
| callerFramePointer | : | callerFramePointer |
| method | : | method |
Expand All @@ -14,7 +14,7 @@
| 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 )" | : .--------------.
| stack value n+m "(send argument n)" | : .--------------.
| saved instructionPointer -------------|--. : instructionPointer --. |object header |
framePointer ----->+--------------------------------------+ | : | |literal 0 |
| callerFramePointer | | : | |... |
Expand Down
Binary file modified Chapters/4-Interpreter/figures/interpreter_return.pdf
Binary file not shown.
12 changes: 6 additions & 6 deletions Chapters/4-Interpreter/figures/interpreter_send-ascii.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
|| The Stack | |
|| Grows +._ _ _.- - -._ _ _.- - -._ _ _.- - -._ +
\/ Down +._ _ _.- - -._ _ _.- - -._ _ _.- - -._ +
|| Grows +._ _ _.- - -._ _ _.- - -._ _ _.- - -.__+
\/ Down +._ _ _.- - -._ _ _.- - -._ _ _.- - -.__+
+---------------------------------------+
framePointer ----->+callerFramePointer |
framePointer ---->+ callerFramePointer |
| method |
| context |
| flags Caller's frame |
| receiver |
| temporary 1 |
| temporary 2 |
| ... |
| stack value n (send receiver) +
| stack value n+1 (send argument 1 ) |
| stack value n "(send receiver)" +
| stack value n+1 "(send argument 1 )" |
| ... |
stackPointer -----> stack value n+m (send argument n ) |
stackPointer -----> stack value n+m "(send argument n )" |
+---------------------------------------+
Binary file modified Chapters/4-Interpreter/figures/interpreter_send.pdf
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@


framePointer ----------->+---------------------+
stackPointer --------. | callerFramePointer -+---> null (bottom of stack)
stackPointer --------. | callerFramePointer -+---> null "(bottom of stack)"
instructionPointer -. | | method -------------+--.
| | | context | \
| | | flags | '-->.--------------.
Expand Down
Binary file modified Chapters/4-Interpreter/figures/interpreter_variables.pdf
Binary file not shown.
3 changes: 3 additions & 0 deletions Chapters/4-Interpreter/theInterpreter.md
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,9 @@ Then the original message reification is set up by:
- allocating an array to hold all the original arguments
- popping the arguments from the stack and store them in the new array
- allocating a message object and storing in it the original selector, argument array and lookup class
![Reifying the message for does not understand.](figures/interpreter_dnu.pdf?label=dnu_message)
Then, the `messageSelector` interpreter variable is overwritten with the `doesNotUnderstand:` selector found in the special objects array, and the lookup is restarted.
```caption=The lookup method revisited with `doesNotUnderstand:` support
Expand Down

0 comments on commit 76d7cb5

Please sign in to comment.