6/36  

Progress Towards a Cross-Dialect Smalltalk FFI

Mentor: Eliot Miranda
Second mentor: John McIntosh
Level: Advanced
Accepted student: Dmitry Matveev
Invited students: Dmitry Matveev, Reinout Stevens
Students interested: Dmitry Matveev(very), Reinout Stevens(very)

There is no one common foreign function interface amongst the various Smalltalk dialects and descendants.  There is a wide range of basic functionality, some systems providing only call-outs with limited or no callback facilities, some systems providing non-blocking call-outs that can run on separate threads, and accept call-backs from arbitrary threads.  At this lower level the absence of multi-threaded and callback facilities cause grave problems for interfacing SMalltalk to other languages.  At a higher level there is no up-to-date cross-dialect header parser written in Smalltalk which can be used to analyse external apis and auto-generate FFI bindings to those apis.  As the various C parsers have languished so auto-generating bindings to foreign languages has got ever more tedious and tricky.  But there has been significant innovation in Smalltalk VM architectures that allow simple and efficient multi-threaded FFIs, and a cross-platform C parser should have much broader support and hence be better maintained and functional.

Technical Details

The goals of this project would be, one, to build a reference implementation of a multi-threaded FFI, in either Squeak or Gnu Smalltalk, two, to build above that a cross-dialect set of facilities for defining C types, call-outs and call-backs, and three, to upgrade and port Gnu Smalltalk's CObject C parser, with the aim of providing a powerful multi-threaded cross-platform FFI for Smalltalk.  The actual work undertaken is open ended.  One can attack these problems at a high or low level and progress from there.

Benefits to the Student

The student(s) will gain an understanding of the full stack of a dynamic language FFI, including cutting-edge FFI architecture for dynamic language VMs, and the issues of deconstructing C header files from which Smalltalk interfaces there-to can be auto-generated.

Benefits to the Community

The Smalltalk community will gain important steps towards a modern cross-Smalltalk-dialect threaded FFI that makes it easy to interface Smalltalk with other languages and systems.




Updated: 22.3.2010