Skip to content

Commit

Permalink
Restructuration
Browse files Browse the repository at this point in the history
  • Loading branch information
guillep committed Aug 23, 2024
1 parent 6acfb8b commit 257a2e5
Show file tree
Hide file tree
Showing 137 changed files with 38 additions and 118 deletions.
90 changes: 0 additions & 90 deletions Chapters/Intro.md

This file was deleted.

File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,12 @@ If the check succeeds, the primitive performs its operation and returns without
This first execution path is the _fast path_.
If the check fails, the primitive fails and the method's fallback bytecode implements the slower type conversion for the other type combinations.


### Conclusion

In this chapter we studied how the Pharo virtual machine represents code.
- The Pharo VM defines a stack machine: computation is expressed by manipulating a stack with push and pop operations. These operations are called bytecode instructions and primitive instructions.
- Code is organized in methods. Methods contain at most one primitive, a sequence of bytecode instructions and a list of literal values.
- bytecode instructions manipulating variables carry semantic information about them: there are special instructions for instance variables, class variables and temporary variables. This allows the VM to concentrate on the execution and not to do name analysis at runtime to guess what kind of variable is each name
- primitive instructions can fail. If they succeed in their computation they pop their arguments and push the result. If they fail, they leave the stack untouched and return an error code.
- primitive methods make a strong distinction between slow and fast paths: in the fast path they execute the primitive instruction. If it was a success, execution continues in the sender. Otherwise, the method's bytecode is executed.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -352,12 +352,13 @@ Some of the most notable instructions are:
### Conclusion
In this chapter we studied how the Pharo virtual machine represents code.
The Pharo VM defines a stack machine: computation is expressed by manipulating a stack with push and pop operations.
Code is organized in methods. Methods contain at most one primitive, a sequence of bytecode instructions and a list of literal values.
In this chapter we studied the actual encoding of Pharo instructions.
Moreover, we explored many optimizations that can be done at the level of bytecode encoding.
We explored many optimizations that can be done at the level of bytecode encoding.
Encoding optimizations help make methods shorter by having smaller bytecode sequences and less method literals.
- Pharo's bytecode set has a variable encoding with instructions taking between 1 and 3 bytes
- Encoding optimizations make methods shorter by having smaller bytecode sequencesx and less method literals
- common bytecode instructions can be shortened and made special instructions, avoiding expensive literals and arguments
- common bytecode sequences can be combined into (shorter!) super instructions too
In the following chapters we will study the implementation of the Pharo interpreter and several of its portable optimizations.
In later chapters we will study low-level optimizations of the interpreter thanks to the Slang framework that applies indirect threading, inlinings, and variable autolocalization.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 7 additions & 7 deletions index-part1.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@ _Acknowledgements._ This work is supported by Ministry of Higher Education and R
The work is supported by I-Site ERC-Generator Multi project 2018-2022. We gratefully acknowledge the financial support of the Métropole Européenne de Lille.
This work is also supported by the Action Exploratoire Alamvic led by G. Polito and S. Ducasse.

<!inputFile|path=Chapters/0-RuntimeSystemOverview/runtime.md!>
<!inputFile|path=Part0-Preamble/0-RuntimeSystemOverview/runtime.md!>

# The Basics

<!inputFile|path=Chapters/1-ObjectStructure/objectStructure.md!>
<!inputFile|path=Chapters/2-MethodsAndBytecode/methodsbytecode.md!>
<!inputFile|path=Part0-Preamble/1-ObjectStructure/objectStructure.md!>
<!inputFile|path=Part1-InterpreterAndBytecode/2-MethodsAndBytecode/methodsbytecode.md!>

# Bytecode Execution

<!inputFile|path=Chapters/3-SemanticsByExample/basicsOnExecution.md!>
<!inputFile|path=Chapters/4-Interpreter/theInterpreter.md!>
<!inputFile|path=Chapters/5-DeeperBytecode/methodsbytecode.md!>
<!inputFile|path=Part1-InterpreterAndBytecode/3-SemanticsByExample/basicsOnExecution.md!>
<!inputFile|path=Part1-InterpreterAndBytecode/4-Interpreter/theInterpreter.md!>
<!inputFile|path=Part1-InterpreterAndBytecode/5-DeeperBytecode/methodsbytecode.md!>

%# Optimizations

%<!inputFile|path=Chapters/6-InterpreterOptimizations/interpreteroptimizations.md!>
%<!inputFile|path=Part1-InterpreterAndBytecode/6-InterpreterOptimizations/interpreteroptimizations.md!>
30 changes: 15 additions & 15 deletions index.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,40 +17,40 @@ _Acknowledgements._ This work is supported by Ministry of Higher Education and R
The work is supported by I-Site ERC-Generator Multi project 2018-2022. We gratefully acknowledge the financial support of the Métropole Européenne de Lille.
This work is also supported by the Action Exploratoire Alamvic led by G. Polito and S. Ducasse.

<!inputFile|path=Chapters/0-RuntimeSystemOverview/runtime.md!>
<!inputFile|path=Part0-Preamble/0-RuntimeSystemOverview/runtime.md!>

# The Basics

<!inputFile|path=Chapters/1-ObjectStructure/objectStructure.md!>
<!inputFile|path=Chapters/2-MethodsAndBytecode/methodsbytecode.md!>
<!inputFile|path=Part0-Preamble/1-ObjectStructure/objectStructure.md!>
<!inputFile|path=Part1-InterpreterAndBytecode/2-MethodsAndBytecode/methodsbytecode.md!>

# Bytecode Execution

<!inputFile|path=Chapters/3-SemanticsByExample/basicsOnExecution.md!>
<!inputFile|path=Chapters/4-Interpreter/theInterpreter.md!>
<!inputFile|path=Part1-InterpreterAndBytecode/3-SemanticsByExample/basicsOnExecution.md!>
<!inputFile|path=Part1-InterpreterAndBytecode/4-Interpreter/theInterpreter.md!>

# Optimizations

<!inputFile|path=Chapters/5-DeeperBytecode/methodsbytecode.md!>
<!inputFile|path=Chapters/6-InterpreterOptimizations/interpreteroptimizations.md!>
<!inputFile|path=Part1-InterpreterAndBytecode/5-DeeperBytecode/methodsbytecode.md!>
<!inputFile|path=Part1-InterpreterAndBytecode/6-InterpreterOptimizations/interpreteroptimizations.md!>

# The Memory Manager

<!inputFile|path=Chapters/GarbageCollector/memoryStructure.md!>
<!inputFile|path=Chapters/GarbageCollector/newSpace.md!>
<!inputFile|path=Chapters/GarbageCollector/oldSpace.md!>
<!inputFile|path=Chapters/GarbageCollector/freeList.md!>
<!inputFile|path=Chapters/GarbageCollector/ephemerons.md!>
<!inputFile|path=Part3-MemoryManagement/GarbageCollector/memoryStructure.md!>
<!inputFile|path=Part3-MemoryManagement/GarbageCollector/newSpace.md!>
<!inputFile|path=Part3-MemoryManagement/GarbageCollector/oldSpace.md!>
<!inputFile|path=Part3-MemoryManagement/GarbageCollector/freeList.md!>
<!inputFile|path=Part3-MemoryManagement/GarbageCollector/ephemerons.md!>

# JIT Compilation

<!inputFile|path=Chapters/CallingConventions/CallingConventions.md!>
<!inputFile|path=Chapters/JIT/stackStructure.md!>
<!inputFile|path=Part2-JIT/CallingConventions/CallingConventions.md!>
<!inputFile|path=Part2-JIT/JIT/stackStructure.md!>

## Slang
@cha:Slang
Just here so that we can refer to it

# Exercises

<!inputFile|path=Chapters/HandonsStatic/handonsstatic.md!>
<!inputFile|path=Part4-Tutorials/HandonsStatic/handonsstatic.md!>
2 changes: 1 addition & 1 deletion pillar.conf
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "series" : "Square Bracket tutorials", "base_url" : "", "\"tocFile\": \"index.md\" if you have a index.pillar file containing the table of contents of your book" : "comment", "attribution" : "The Pharo team", "latexWriter" : "miclatex:sbabook", "keywords" : "Virtual machine, object encodings, garbage collection, Pharo, Smalltalk", "htmlWriter" : "html", "title" : "[DRAFT/WIP] The Pharo Virtual Machine Explained", "site_name" : "Pharo Book", "bibFile" : "vmbib.bib"}
{ "series" : "Square Bracket tutorials", "base_url" : "", "\"tocFile\": \"index.md\" if you have a index.pillar file containing the table of contents of your book" : "comment", "attribution" : "The Pharo team", "latexWriter" : "miclatex:sbabook", "keywords" : "Virtual machine, object encodings, garbage collection, Pharo, Smalltalk", "htmlWriter" : "html", "title" : "Unveiling the Pharo Virtual Machine", "site_name" : "Pharo Book", "bibFile" : "vmbib.bib"}
Expand Down

0 comments on commit 257a2e5

Please sign in to comment.