Would Tunes be interested in this Object manager...?

Marcus Petersson d4marcus@dtek.chalmers.se
Fri Apr 12 14:19:02 2002


Hello,

I have had some trouble figuring out what the point of Tunes really is. It
is somewhat unclear whether you are into object systems or if your main
interest is in creating new languages.

However, as it seems Tunes have not produced much code yet, perhaps you
would be interested in an "object manager" I have written on behalf of
KOSH (http://www.kommunity-systems.com).

It's a bit hard for me to describe its purpose. One definition is that
it's "the minimal piece of code needed to handle objects" or "an extension
to the CPU to let it deal with objects".

On top of that we intend to build an operating system, with everything
including the kernel built as objects.


Here are the most important functions of the object manager:

* Find(char* name) 
    Finds a named object, by first looking in the system dictionary,
    then in the storage. All persistant objects, including classes,
    and methods (method identifiers) are loaded this way. A handle
    (object identifier) is returned.

* Release(handle h)
    Will release (your hold on) an object. When an object is no longer
    held by anything, it will be flushed out of memory. If persistant,
    it goes back to storage.
    Note that even if you don't explicitly release objects, they will
    be released automatically when you (your process) terminate.

* MakeArgs(int argc, void** argv, char** namev)
    Creates a parameter (argument) object and returns its handle.

* MakeInstance(handle _class, handle input)
    Creates an instance of _class with the values of the parameter
    object input, and returns its handle.

* SendMethod(handle target, handle method, handle input, handle output)
    Calls a method. With a more familiar syntax you might write:
       output = target.method(input)

* MakeMessage(handle target, handle method, handle input, handle output)
    Creates a message (method call) object and returns its handle.

* Send(handle message)
    Sends a message. MakeMessage + Send has the same effect as SendMethod.

In addition, there are functions to update parameter and message objects.
Some simple error-handling is also supported.


At the moment, I only support classes written in C and compiled as dynamic
libraries, but support for more class types can be added as needed.

Performance is quite bad I think. On this P133, I get about 10 - 25000
object creations + deletetions (release + recycle) per second, and at most
a million method calls per second. It's possible that the handle-to-object
dereference is the major bottleneck.

However, you should probably keep in mind that this is not designed to be
a programming language in the usual sense, but the foundation for an
operating system. Which means that in general, you rarely create "small"
objects like numbers or strings, unless you really need them to be shared.
Instead you should use the builtin language features, and try to write
classes and functions that are big enough to not suffer from the overhead.


Does this sound interesting at all? If so, I'd be happy to discuss the
features more. I'm almost desparate for feedback, so any input will be
greatly appreciated.

Marcus
------------------------------------
 If you find that life spits on you
 calm down and pretend it's raining