Proposal by Dmitry Matveev for Progress Towards a Cross-Dialect Smalltalk FFI

Proposed by Dmitry Matveev (profile, biography) Don't forget to submit this proposal to official Google Melange site too!

Why I'd like to execute on this particular project?

Virtual machine internals and the FFIs are extremely interesting themes for me.
Strong FFI subsystem will give an additional degree of freedom to Smalltalk developers and will make possible to use the same unified bindings in all the Smalltalk dialects.

Why I would be a fine choice to do the project?

  • I have strong C programming skills (for Windows and Linux) and I am  familiar with the dynamic library loading in the both operating systems
  • I have experience in writing the parsers on Smalltalk - I use GNU Smalltalk for difficult text processing tasks at work
  • I am familiar with the GNU Smalltalk's CObject FFI subsystem, I've used it to make a binding for the X Window Sytem libraries (this activity is currently postponed)
  • I have a great experience in the working and support of the existing source code (it's my everyday job); getting familiar with the Squeak/GNU Smalltalk VM's code will be easy for me.


Details of my non-Smalltalk experience

  • Studying programming for more than 7 years
  • Avaya (ex. Nortel) VoIP software sustainer since 2008: VxWorks/Windows Mobile/Windows programming, network protocols, realtime data processing, multithreading, etc
  • Very good knowledge of C and C++; medium knowledge of Smalltalk; currently studying Common Lisp; introduced in to Python, Prolog and Scheme
  • I have a lot of projects finished during my study (university course works with databases, nerual networks, IPC, etc)


Contact information

Dmitry Matveev (

How will I do that project

  • First of all, I will study the current low-level FFI implementation for both Squeak ans GNU Smalltalk. Squeak's Alien and GNU Smalltalk's CObject use different approaches, I will find out the similarities between these two implementations to form up a generic architecture of the future FFI, that may be used with the other popular VMs too.
  • Then I will build up a cross-dialect set of facilities for defining C types, call-outs and call-backs for Smalltalk. I really like the GNU Smalltalk's CObject, it is pretty clear and quite useful, so I have an idea to form the high-level Smalltalk FFI facilities based on the CObject (i.e. to port the Smalltalk part of the CObject to Squeak).
  • To make the binding really portable, I will try to unify the C interface for both VMs for interacting with the Smalltalk runtime from C.
  • Finally, I am going to implement a C header parser for the automatic binding generation.


What methodologies will I use

Probably I will use the test-driven development, since the set of unit test will help to ensure that the FFI works well in the both dialects

Suggested timeline and milestones

  1. Weeks 1-4: Low-level unified FFI implementation for the virtual machine; implementing an unified C interface for the virtual machine.
  2. Weeks 5-8: Porting the CObject from the GNU Smalltalk to the Squeak
  3. Week 9: Improving the GNU Smalltalk's C preprocessor in order to generate both GNU Smalltalk and Squeak bindings automatically
  4. Weeks 10-12: Solving possible problems, testing and debugging, writing documentation


Where I see the risks

  • The whole project is a big and difficult one. But it's a great challenge I could not miss! :)
  • Multithreading can introduce some issues I will have to solve, since the multithreading APIs are quite different on the vaious operating systems 


How the results will look like

  • The low-level implementation: a set of patches for the Squeak or GNU Smalltalk virtual machines
  • The high-level implementation: a Monticello package for Squeak/Pharo, a STAR archive for the GNU Smalltalk
  • The binding generator: a GNU Smalltalk script or a Squeak tool (Morphic UI)
  • The documentation: feature specification, feature description, high-level design documents. 


Updated: 9.4.2010