Hello Lennon,
LDR> However, there are issues with this approach. Unlike most Lisps and
LDR> Smalltalks, Ruby is not a self-hosting system; the core runtime is
LDR> implemented in C, and depends heavily on the system libraries and
LDR> memory model of the underlying operating system. By using native
LDR> structures like file handles, dynamic libraries, and virtual memory
LDR> management pervasively, Ruby has more or less bound itself to the
LDR> lifecycle and call conventions of a "native" application.
Sorry but here you miss the point, using file handles, DLL's and
native structure does not mean anything for implementing an image
based language (it's not a heap image by the way).
LDR> However, it should be entirely possible to experiment with a limited
LDR> form of the global-image class of persistence. There are two main
LDR> paths I could see working. The more obvious would be performing a
LDR> standard Marshal.dump on every object in the heap, saving the state of
LDR> any serializable objects to disk (and allowing them to perform any
LDR> cleanup necessary prior to shutdown).
At the moment you can't dump methods and classes. So this would
require a lot of work. We are not talking about data persistence here.
LDR> Less trivial, but potentially more interesting, would be to allocate
LDR> new objects within mmap'ed address space, (effectively bypassing the
LDR> native virtual memory system) which would allow a 'dump' operation to
LDR> simply be implemented as a 'sync' on that space. Updates could be
LDR> incremental, and have near the same performance as the native OS does
LDR> with VM paging.
The current problem is the serialization of the program stack because
there native C function calls and ruby calls are mixed. Okay we could
dump only if there is nothing on the stack (which is the case when the
program exits normally), and return to a special "main" function on
the next start, but this is normally not that what you want in an
image based language.
LDR> Anyone with more language implementation experience care to weigh in
LDR> on the feasibility of such a hack? I know that several "academic"
LDR> languages already implement such functionality, and that as a
LDR> garbage-collected language, Ruby should already have most of the
LDR> infrastructure necessary to build it again.
I think the technical implementation is not the difficult thing here,
its the current state of libraries.
Oh yes, i implemented an LISP system in about 50000 lines of Assembler
code many many years ago. The core system, the VM, is not difficult to
write, but we would need a complete rewrite of Ruby.
--
Best regards, emailto: scholz at scriptolutions dot com
Lothar Scholz
http://www.ruby-ide.com
CTO Scriptolutions Ruby, PHP, Python IDE 's