Smalltalks-2017, La Plata, Argentina |
In practical engineering of the Smalltalk VMs in industrial use today, the "Just-in-Time" native compiler is programmed via one or another form of direct expression of machine-language program-text output. As such, the execution engine definition is an entanglement of the VM programmer's intuition about what the bytecodes mean, with that person's intuition about what the machine instructions do. The reasoning about why the construct works is carried out informally in the programmer's head, and usually lost (discarded/forgotten) after the construct is written as source code; at best, we may be provided with a U-language remark in a comment.
Attempting to address this problem, the author built two different n-code generators based on two independent principles. In the first approach, the machine automatically finds instruction sequences using a unification algorithm which matches formal definitions of bytecode semantics to formal definitions of processor instruction semantics. In other words, the n-code generator is automatically inferred from a formal processor description. In the second approach, the transformations leading from bytecode to machine code are specified by the human programmer, but the semantics of each representation language is specified with enough formal rigor to allow a mechanical proof of semantic preservation, carried out in an automatic theorem prover.
In retrospect, it turns out that the two code generators are unexpectedly similar in fundamental operation. In this talk, we'll look at both and try to recognize some common principles which should be applicable universally to any effort towards rigorous Smalltalk execution engine construction.
The live nature of Smalltalk's development paradigm is among the most fundamental reasons of its effectiveness. Unfortunately, in some important cases this liveness gets in the way, for example when debugging low-level parts of the system on which the tools are themselves based. Another example is debugging-into-existence or testing of a partially constructed Smalltalk. Let alone working on the virtual machine itself: the VM programmer is left to use tools such as GDB which don't help in understanding complex VM/VI interactions.
In a number of previous publications, this author introduced the "Universally-Live Smalltalk Debugger" based on executing the "inner VM" under control of a "mother Smalltalk" to achieve four benefits:
In contrast to those previous publications which were focusing chiefly on the theoretical basis for ULD, this talk shows the actual experience of ULD's behavior in a matrix of different VM workloads (TAM, VLS) multiplied by different ISAs (PowerPC, AMD64, RISC-V) and different execution substrates (GEM5, OpenOCD, GDB). We hope to extend the discussion of ULD's application to the needs of the wider community.