Da Vinci Machine - Architecture

Architecture

Dynamic invocation is built on the fact that, even if Java is a strongly static language at the language level, the type information is much less prevalent at the bytecode level.

However, dynamic languages implementations need to be able to use just-in-time compilation (rather than reflection) to achieve a good performance, and so to compile scripts to bytecode at runtime. To be allowed to be run by the Java Virtual Machine, these bytecodes must be verified prior to the execution, and the verifier check that the types are static throughout the code. It leads to these implementations having to create many different bytecodes for the different contexts of a method call, each time the signature of the arguments change.

This not only uses a lot of memory, but also fills a memory area called Permanent Generation, a part of the heap used by the JVM to store information about classes. Memory used in this area is never garbage collected because it stores immutable data in the context of Java programs; and because of that, dynamic languages implementations can only compile a small part of the scripts.

JSR 292 proposes to:

  • provide a mechanism whereby an existing class can be loaded and modified, producing a new class with those modifications but sharing the rest of its structure and data, thus not filling the Permanent Generation space,
  • provide the new invokedynamic bytecode which allows the JVM to optimize these kind of calls.

Read more about this topic:  Da Vinci Machine

Famous quotes containing the word architecture:

    Art is a jealous mistress, and if a man have a genius for painting, poetry, music, architecture or philosophy, he makes a bad husband and an ill provider, and should be wise in season and not fetter himself with duties which will embitter his days and spoil him for his proper work.
    Ralph Waldo Emerson (1803–1882)

    All architecture is great architecture after sunset; perhaps architecture is really a nocturnal art, like the art of fireworks.
    Gilbert Keith Chesterton (1874–1936)

    Art is a jealous mistress, and, if a man have a genius for painting, poetry, music, architecture or philosophy, he makes a bad husband and an ill provider.
    Ralph Waldo Emerson (1803–1882)