Improve performance using the backend

Improve performance using the backend

Technical background
Using the backend
Call functions registered at the backend from Java

Another approach to improve generation and model transformation performance, is to use the M2T Backend. The M2T Backend is a new execution engine for model to text (M2T) and model to model (M2M) transformations that provides:

The M2T Backend provides a compiler that compiles resources written in Xpand / Xtend / Check and other languages supported on the backend to Java. The backend is used as a common platform just like the JVM is a common platform for multiple languages. Languages supported on the backend are interoperable in same way as languages supported on the JVM are interoperable. This enables you to import templates, extensions and transformations written in other languages than Xpand/Xtend/Check and call functions declared therein, e.g. call an QVT transformation from Xpand. As soon as a middleend for Xtend2 is available, interoperability with old fashioned Xpand/Xtend/Check will be supported.

Beginning with the Eclipse Helios release (Eclipse 3.6) the M2T Backend is part of M2T Xpand. As of the Eclipse Indigo release the Backend Compiler has been added.

The basic idea behind the M2T Backend is to not build a compiler for every language but use an intermediary "language", i.e. the backend abstract syntax tree, that is compiled into executable Java code. Xpand, Xtend and Check are translated into a backend AST by so called middleends . Middleends are specific for each language. Hence, there exists a language specific middleend for each supported language. If a middleend for a certain language is available, it is compilable into Java code and finally to bytecode using a plain Java Compiler or automatically during the build Eclipse JDT Compiler. In contrast to the backend language, Xpand, Xtend and Check are called frontend languages .

The M2T Backend supports functional and aspect oriented programming. Amongst others it supports language features such as:

  • closures
  • higher order functions - use any expression as parameters, even function calls
  • currying of functions
  • multi dispatch - call a function based on the runtime parameter types as in Xpand / Xtend / Check instead of the statically assigned parameter types as in Java
  • guards on functions - constrain the execution of a function to certain conditions defined in the guard
  • deferred evaluation of expressions - use the function call as a placeholder and evaluate the expression later
  • AOP
  • declare functions in Java using several annotations
  • Support for multiple typesystems a.k.a metamodels. Currently JavaBeans, EMF, Eclipse UML2 and XSD are supported.