Looking under the covers at IDLs

In class, we discussed IDLs and how they can be used to describe interfaces that can be made accessible over an RMI system in a language neutral way. The idea was that one would describe the interface to be made accessible via RMI in an IDL, and then use an IDL compiler to generate the code that sits between the caller and callee, doing the work of marshalling and unmarshalling, calling into the lower level communication system, and potentially binding to different languages.

To appreciate what this layer that makes much of the magic of RMI happen looks like, I did a simple test with the Babel language interoperability and RMI tool from Lawrence Livermore National Lab. The simple interface that I described in the IDL (known as SIDL for Babel, for Scientific Interface Description Language) is:

package Hello version 1.2 {
  class World {
    string getMsg();
    int foo(in int i, out int o, inout int io );
  }
}

This IDL description was then fed into the babel compiler, and the resulting files (when asking for a C language binding) are linked to below. Clearly, the IDL compiler is a useful thing - while conceptually simple, this layer of code that provides the bindings of both the caller and callee to the underlying RMI system is not trivial. Note that this is not the complete set of files to build both the caller and callee on this interface, but enough to illustrate the concept. Also, the abbreviation "IOR" in the filenames and elsewhere stands for "Intermediate Object Representation", which is the Babel External Data Representation (XDR).

Why is this so complex? Babel provides a distributed object system, so even though I asked it for a C binding, it emits a large amount of code related to providing a C interface to the object oriented model that Babel implements. You can see this in files like Hello_World.h, in which code for reference counting is emitted. Fortunately, the actual code on the caller or callee side sees little of this complexity, and the IDL compiler handles that for you.

-matt / 10.16.2008