Skip to content

Cross-platform virtual machine for Squeak, Pharo, Cuis, and Newspeak.

License

Notifications You must be signed in to change notification settings

fedegr/opensmalltalk-vm

 
 

Repository files navigation

Headless OpenSmalltalk-VM for Pharo

This is the branch of the Headless VM used for Pharo. This branch has the modifications required to run Pharo in a true headless environment. The image running on the VM is responsible of handling the UI and the events.

The image includes a default implementation of the handling of UI through the use of SDL2.

CI

This project is continuously built and test in the CI infrastructure located at:

https://ci.inria.fr/pharo-ci-jenkins2/job/pharo-vm/job/headless/

Building

For building the VM it is required the following set of tools:

  • A working Pharo
  • CMake (at least version 2.8.4)
  • CLang
  • Binutils (make and friends)
  • wget
  • unzip

Building in OSX / Linux:

$ cmake . 
$ make install

Building in Windows:

The build in Windows, uses Cygwin. This tool should be installed, and the following Cygwin packages are needed:

cmake mingw64-x86_64-clang zip unzip wget

$ cmake . -DWIN=1
$ make install

The VM is built from generated code and code written by hand. The generated code is the result of converting Smalltalk code into C. This conversion is performed during the cmake process.

This will generate the VM in build/dist/

Source Directory Structure

The headless mode is developed on top of code of the Cog branch of Opensmalltalk-vm. The code that is used without changes is stored in the extracted directory. This allows us to easy integrate changes from and to the Cog branch.

The code that has been specially created or modified for this branch is stored in src / include and plugins.

  • smalltalksrc: includes the tonel repository with the code in Slang.
  • generated: here VMMaker will generate the VM code.
  • includes: All non generated includes required by headless mode
  • src: All non generated code required by headless mode.
  • extracted: This code is literally the same code base used in the normal OpenSmalltalk-VM build.
  • plugins: The code of the different plugins developed for headless mode.

Overview of OpenSmalltalk-VM

This branch is based on the open-smalltalk vm (https://github.com/OpenSmalltalk/opensmalltalk-vm). Opensmalltalk-vm (a.k.a. the Cog VM) is the virtual machine beneath the Cuis, Pharo and Squeak Smalltalk dialects and one of the VMs beneath the Newspeak language. For issues related to these systems that are unrelated to the VM itself, please use their forums:

Second, the core VM, which comprises the execution engine and garbage collector, and the core plugins, is developed in Smalltalk, using the VM Simulator. This repository contains the code generated by the Simulator, and the platform support code for the entire VM, its CI infrastructure and so on. The core VM should not be developed by editing the generated code. The core VM should be developed using Smalltalk. You can find scripts to build a Smalltalk image in which to do core VM development in the image directory in this repository. You can read about the Simulator here:

Cog is an evolution of the Squeak Back-to-the-future Smalltalk virtual machine that provides a number of different Smalltalk virtual machines. The VMs are developed in Smalltalk, using all the dynamic and reflective facilities of the Squeak/Pharo Smalltalk system. As such, developing in Cog is a delight. The Smalltalk framework comprising the various Cog VMs is translated into C by its Slang component to produce VM source that is combined with platform-specific support sources and compiled via a C compiler to obtain a fast production VM. This directory tree includes the output of Slang for various configurations of "Cog VM" and the associated platform support code, plus build directories that can be used to produce production VMs.

This directory tree also includes an instance of the Smalltalk Cog development system, suitable for developing the VM in Smalltalk, and for generating new VM sources.

The "Cog VM" comes in a bewildering variety of forms. The first distinction is between Squeak/Croquet VMs that run Squeak, Pharo, Cuis, Croquet images and their ilk, and between Newspeak VMs that run Newspeak.

Another distinction is between Stack, Cog and Sista VMs. Stack VMs are those with context-to-stack mapping that optimise message sending by keeping method activations on a stack instead of in contexts. These are pure interpreters but are significantly faster than the standard context-based Interpreter VM. Cog VMs add a JIT to the mix, compiling methods used more than once to machine code on the fly. Sista VMs, as yet unrealised and in development, add support for adaptive optimization that does speculative inlining at the bytecode-to-bytecode level. These are under development and targeted for release in 2015.

Another distinction is between "v3" VMs and Spur VMs. "v3" is the original object representation for Squeak as described in the back-to-the-future paper. Spur, as described on the www.mirandabanda.org blog, is a faster object representation which uses generation scavenging, lazy forwarding for fast become, a single object header format common to 32 and 64 bit versions, and a segmented heap that can grow and shrink, releasing memory back to the host OS. Newspeak, Squeak 5.0 and Pharo 5 use Spur.

Another distinction is between normal single-threaded VMs that schedule "green" Smalltalk light-weight processes above a single-threaded VM, and multi-threaded VMs that share the VM between any number of native threads such that only one native thread owns the VM at any one time, switching between threads on FFI calls and callbacks or on Smalltalk process switches when Smalltalk processes are owned by threads. This architecture offers non-blocking FFI calls and interoperability with multiple native threads, but does /not/ provide true concurrency. This multi-threaded support is as yet experimental.

About

Cross-platform virtual machine for Squeak, Pharo, Cuis, and Newspeak.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Smalltalk 63.0%
  • C 25.9%
  • HTML 10.2%
  • Objective-C 0.4%
  • C++ 0.3%
  • CMake 0.2%