The OO-System in the Polymorphic Inline Caching
Paper, the SELF Programming Language and System,
is very similar to a traditional Prolog implementation.
From the paper:
"SELF uses a tagged object representation with the
two lower bits as the tag. Dispatch tests involving
integers, as well as integer arithmetic operations,
test their argument’s tag using an and instruction;
similarly, the runtime system (e.g., the garbage collector)
often extracts an object’s tag. Together, these and
instructions account for about 25% of the logical
instructions. We are unable to explain the remaining
difference between SELF and the C programs because no
detailed data on C’s use of logical instructions
was available."
I guess this 25% overhead was eliminated in Java,
in that it introduced primitive integers and non-
primitive integers. On the other hand, if I am not
totally wrong, some of the PIC design went into the
Hotspot JIT from SUN.
But there is a tendency now for other compiler
designs from JIT to AOT:
Ahead-of-time compiling for dynamically typed
languages to native machine code or other static
VM bytecode is possible in a limited number of cases
only.[citation needed] For example, the High
Performance Erlang Project (HiPE) AOT compiler
for the language Erlang can do this because
of advanced static type reconstruction techniques
and type speculations.
In most situations with fully AOT compiled programs
and libraries, it is possible to drop a useful
fraction of a runtime environment, thus saving
disk space, memory, battery life, and startup times
(no JIT warmup phase), etc. Because of this, it can
be useful in embedded or mobile devices.
But the dimension JIT/AOT is orthogonal to
the dimension Log-Nonsense-Talk/ISO Module System.
Using reexport/1 as the IS-A relation and a
Pythonesk (::)/2 operator does not
necessarely imply that a JIT technique needs to
be applied. In Jekejeke Prolog I use JIT and no
AOT at the moment. I even don't know how I could
replicate Erlang stuff in my system.
Also a further dimension that is completely
ortogonal is all the gimicks of visibility and
a local modules etc.. Local modules can be done
either in Log-Nonse-Talk or in ISO-Modules,
in Jekejeke Prolog I have demonstrated how
to do it in ISO-Modules. All the additional visibility
rules work so far. There is no runtime overhead
because of the more complex visibility rules,
since the PICs do cache the visibility resolution.
I use PICs with negative and positive caching.
So even running agains a false forbidden call
multiple times in a loop is fast! Ha Ha
It would be interesting to try something AOT
in the future, but JIT is surely simpler to
implement. For Prolog it is advantageous if the
JIT is combined with truth maintenance,
so the negative and positive local caching,
needs to be invalidated appropriately when the
module loader changes the module network. An
atom table is very useless for visibility rules,
because the same "atom", when combined into
an indicator, i.e. functor and arity, inside some
contaxt, i.e. a module might have a totally
different visibility depending on the module
network. So atom tables are automatically a
dead end for OO-systems that have also visibility.
But the following dimensions are all ortogonal:
- JIT vs AOL, the runtime/compilation technique
- Log-Nonsense-Talk vs ISO-modules, the surface syntax
- Visibility/Local Modules, additional language features
- What else?
Best Regards