Hi. This is a short post to tell you that we have finished the first part of the “Journey through the Virtual Machine“. I would like to do a little summary of what we have alreasy seen and tell you about the next part.
Summary of the first part of the trip
I’ve started the Journey with an introduction to the Pharo/Squeak Virtual Machine. I told you the VM was split in two parts, the platform code (written in C) and the VMMaker which was the “Core” of the VM as was written in SLANG, a subset of Smalltalk. I told you the minimal steps needed to build a VM and I also gave you a quick introduction to CogVM.
After, we continue to understand all the SCM and related topics about the VM, i.e., where it is committed each part of the VM. Interpreter VM is committed in the trunk of VMMaker (in squeaksource) and its platform code in the official SVN repository. CogVM has its VMMaker part as a fork in squeaksource, and its platform part is in a branch of the SVN but also in Gitorious repository. I mentioned all the problems I have seen so far while trying to build VMs and I also commented a new way of building them which is using Metacello configurations for Cog, the Git repository and CMakeVMMaker package which can automatically generate CMake files. In addition, I talked about the Pharo Hudson server which automatically builds the CogVMs.
Once that you knew which repositories to use and where everything was version, I explained you step by step how to build a CogVM using Metacello configurations, the Git repository and CMakeVMMaker. The post covered how to build the VM in each OS: Mac OS, Linux and Windows. There was then a second part, more advanced, where I showed the different CMakeVMMaker configurations and the ability to use CMake generators to create makefiles for different IDEs. In the same post, I explained a little how the code was synchronized between the platform code and VMMaker package, how you could customize the CMakeVMMaker configurations, and how Hudson builds the VMs for us.
In the last post, I explain you how to build a VM for debug, how to debug it using gdb from command line and finally how do generate makefiles for XCode and debug it from there. In addition, I did a screencast as part of the ” PharoCasts with Experts“. It was a 1:30 screencast about compiling and debugging the VM
What I hope you have learnt
One of my biggest doubts when I started this blog is whether to start by the VM internals or by the build process. And I decided the last one. Why? Because I think that if you really want to learn about the VM, you need to follow this cycle: read -> understand -> change -> build -> run -> crash -> debug. And that’s how you learn. I am sure that my posts are not 100% reproducible. And I am sure that if you try it you may have several problems, but I hope you got a general idea of what is needed to build and debug a Squeak/Pharo VM. I hope that you have included such tools in your toolbox.
Now in this “Journey” we will start to see several things about the internals of the VM, say method lookup, GC, primitives, bytecodes, etc. And what is cool is that you have learned all the needed tools to continue learning about the VM. You can modify and play with the VM since you can then build it and debug it.
Second part of the trip
It is not completely decided what I will talk about nor its order, but the following is a possible list:
- Analyze and change something in the method lookup / normal send.
- Introduction to CompiledMethods, literals and bytecodes.
- What are bytecodes and primitives and how they are map between image and VM.
- Create our own primitive.
- Objects as methods.
- Object header and the object format.
- Use FFI.
- Explain what is, modify and extend the specialObjectArray.
- What are compact classes.
- Method that are not executed.
- SLANG to C translation.
As I already told you several times, I really welcome any kind of feedback. This is my first experience with a blog so I hope you have enjoyed so far. If there is something I can improve, please let me know. You can send me a private mail, a post comment, an email in the mailing list, whatever…