Package org.eclipse.m2m.atl.emftvm.jit

## Class JITCodeBlock

- java.lang.Object
- - org.eclipse.m2m.atl.emftvm.jit.JITCodeBlock

    public abstract class JITCodeBlock
    extends java.lang.Object

Interface for code generated by the `JITCodeBlock` compiler.

### Field Summary

Fields
`protected CodeBlock` `cb` The `CodeBlock` that this `JITCodeBlock` represents.
`protected java.lang.Class<?>` `context` The Java context type for this `CodeBlock`, or `null`.
`protected org.eclipse.emf.ecore.EClass` `eContext` The EMF context type for this `CodeBlock`, or `null`.
`protected static org.eclipse.emf.ecore.EClass` `EXEC_ENV` Singleton instance of the `ExecEnv` `EClass`.
`protected org.eclipse.emf.common.util.EList<CodeBlock>` `nested` The nested `CodeBlock`s of `cb`.

### Constructor Summary

Constructors
`JITCodeBlock​(CodeBlock cb)` Creates a new `JITCodeBlock`.

### Method Summary

All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
`protected static void` `add​(java.lang.Object o, java.lang.Object v, int index, java.lang.String propname, CodeBlock cb, StackFrame frame)` Adds `v` to `o.propname`.
`protected static void` `delete​(org.eclipse.emf.ecore.EObject element, StackFrame frame)` Implements the DELETE instruction.
`abstract java.lang.Object` `execute​(StackFrame frame)` Executes this `JITCodeBlock`, using the parameters stored in `frame`.
`protected static java.lang.Object` `findTypeS​(java.lang.String modelName, java.lang.String typeName, ExecEnv env)` Implements the FINDTYPE_S instruction.
`protected static java.lang.Object` `get​(java.lang.Object o, CodeBlock cb, StackFrame frame, java.lang.String propname)` Implements the GET instruction.
`protected static java.lang.Object` `get​(java.lang.Object o, ExecEnv env, java.lang.String propname)` Implements the GET instruction.
`protected static java.lang.Object` `get​(java.lang.Object o, StackFrame frame, java.lang.String propname)` Implements the GET instruction.
`protected static java.lang.Object` `getStatic​(java.lang.Object o, CodeBlock cb, StackFrame frame, java.lang.String propname)` Implements the GET_STATIC instruction.
`protected static java.lang.Object` `getSuper​(java.lang.Object o, java.lang.Class<?> context, java.lang.String propname, StackFrame frame)` Implements the GET_SUPER instruction.
`protected static java.lang.Object` `getSuper​(java.lang.Object o, org.eclipse.emf.ecore.EClass context, java.lang.String propname, StackFrame frame)` Implements the GET_SUPER instruction.
`protected static java.util.Collection<java.lang.Object>` `getTrans​(java.lang.Object o, CodeBlock cb, StackFrame frame, java.lang.String propname)` Implements the GET_TRANS instruction.
`protected static java.lang.Object` `invokeNative​(StackFrame frame, java.lang.Object self, java.lang.String opname, java.lang.Object[] args, java.lang.reflect.Method method)` Invokes native Java `method` on `self` with arguments `args`.
`protected static java.lang.Object` `invokeNative​(StackFrame frame, java.lang.Object self, java.lang.String opname, java.lang.Object arg, java.lang.reflect.Method method)` Invokes native Java `method` on `self` with argument `arg`.
`protected static java.lang.Object` `invokeNative​(StackFrame frame, java.lang.Object self, java.lang.String opname, java.lang.reflect.Method method)` Invokes native Java `method` on `self` without arguments.
`protected static java.lang.Object` `invokeStatic​(java.lang.Object type, java.lang.Object[] args, StackFrame frame, java.lang.String opname)` Implements the INVOKE_STATIC instruction
`protected static java.lang.Object` `invokeStatic​(java.lang.Object type, java.lang.Object arg, StackFrame frame, java.lang.String opname)` Implements the INVOKE_STATIC instruction
`protected static java.lang.Object` `invokeStatic​(java.lang.Object type, StackFrame frame, java.lang.String opname)` Implements the INVOKE_STATIC instruction
`protected static java.lang.Object` `invokeSuper​(java.lang.Object self, java.lang.Class<?> context, StackFrame frame, java.lang.String opname)` Implements the INVOKE_SUPER instruction
`protected static java.lang.Object` `invokeSuper​(java.lang.Object self, java.lang.Object[] args, java.lang.Class<?> context, StackFrame frame, java.lang.String opname)` Implements the INVOKE_SUPER instruction
`protected static java.lang.Object` `invokeSuper​(java.lang.Object self, java.lang.Object[] args, org.eclipse.emf.ecore.EClass context, StackFrame frame, java.lang.String opname)` Implements the INVOKE_SUPER instruction
`protected static java.lang.Object` `invokeSuper​(java.lang.Object self, java.lang.Object arg, java.lang.Class<?> context, StackFrame frame, java.lang.String opname)` Implements the INVOKE_SUPER instruction
`protected static java.lang.Object` `invokeSuper​(java.lang.Object self, java.lang.Object arg, org.eclipse.emf.ecore.EClass context, StackFrame frame, java.lang.String opname)` Implements the INVOKE_SUPER instruction
`protected static java.lang.Object` `invokeSuper​(java.lang.Object self, org.eclipse.emf.ecore.EClass context, StackFrame frame, java.lang.String opname)` Implements the INVOKE_SUPER instruction
`protected static java.lang.Object` `matchOne​(java.lang.Object[] args, Rule rule, StackFrame frame)` Executes `rule` with `args`.
`protected static java.lang.Object` `matchOne​(java.lang.Object[] args, StackFrame frame, java.lang.String rulename)` Executes `rule` with `args`.
`protected static java.lang.Object` `matchOne​(Rule rule, StackFrame frame)` Executes `rule` without arguments.
`protected static java.lang.Object` `matchOne​(StackFrame frame, java.lang.String rulename)` Executes `rule` without arguments.
`protected static java.lang.Object` `newInstance​(java.lang.Object type, java.lang.String modelname, ExecEnv env)` Creates a new instance of `type`.
`protected static void` `remove​(java.lang.Object o, java.lang.Object v, java.lang.String propname, CodeBlock cb, StackFrame frame)` Implements the REMOVE instruction.
`protected static void` `set​(java.lang.Object o, java.lang.Object v, CodeBlock cb, StackFrame frame, java.lang.String propname)` Implements the SET instruction.
`protected static void` `setStatic​(java.lang.Object o, java.lang.Object v, CodeBlock cb, ExecEnv env, java.lang.String propname)` Implements the SET_STATIC instruction.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### EXEC_ENV

    protected static final org.eclipse.emf.ecore.EClass EXEC_ENV

Singleton instance of the `ExecEnv` `EClass`.

#### cb

    protected final CodeBlock cb

The `CodeBlock` that this `JITCodeBlock` represents.

#### nested

    protected final org.eclipse.emf.common.util.EList<CodeBlock> nested

The nested `CodeBlock`s of `cb`.

#### eContext

    protected final org.eclipse.emf.ecore.EClass eContext

The EMF context type for this `CodeBlock`, or `null`.

#### context

    protected final java.lang.Class<?> context

The Java context type for this `CodeBlock`, or `null`.

### Constructor Detail

#### JITCodeBlock

    public JITCodeBlock​(CodeBlock cb)

Creates a new `JITCodeBlock`.

Parameters:
  `cb` - the `CodeBlock` that this `JITCodeBlock` represents

### Method Detail

#### execute

    public abstract java.lang.Object execute​(StackFrame frame)

Executes this `JITCodeBlock`, using the parameters stored in `frame`.

Parameters:
  `frame` - the `StackFrame` to use during execution.
Returns:
  the `frame`, containing any return value on top.

#### set

    protected static void set​(java.lang.Object o,
                              java.lang.Object v,
                              CodeBlock cb,
                              StackFrame frame,
                              java.lang.String propname)
                       throws java.lang.NoSuchFieldException,
                              java.lang.IllegalArgumentException,
                              java.lang.IllegalAccessException

Implements the SET instruction.

Parameters:
  `o` - the object to set the value for
  `v` - the value to set
  `cb` - the original non-JIT'ed code block
  `frame` - the current stack frame
  `propname` - the name of the property to set
Throws:
  `java.lang.NoSuchFieldException`
  `java.lang.IllegalAccessException`
  `java.lang.IllegalArgumentException`

#### get

    protected static java.lang.Object get​(java.lang.Object o,
                                          CodeBlock cb,
                                          StackFrame frame,
                                          java.lang.String propname)
                                   throws java.lang.NoSuchFieldException,
                                          java.lang.IllegalArgumentException,
                                          java.lang.IllegalAccessException

Implements the GET instruction.

Parameters:
  `o` - the object to get the value for
  `cb` - the original non-JIT'ed code block
  `frame` - the current stack frame
  `propname` - the name of the property to set
Returns:
  the property value
Throws:
  `java.lang.NoSuchFieldException`
  `java.lang.IllegalAccessException`
  `java.lang.IllegalArgumentException`

#### get

    protected static java.lang.Object get​(java.lang.Object o,
                                          StackFrame frame,
                                          java.lang.String propname)
                                   throws java.lang.NoSuchFieldException,
                                          java.lang.IllegalArgumentException,
                                          java.lang.IllegalAccessException

Implements the GET instruction. Assumes this code block is not contained in a rule, or the rule does not contain a `Field` with the given `propname`.

Parameters:
  `o` - the object to get the value for
  `cb` - the original non-JIT'ed code block
  `frame` - the current stack frame
  `propname` - the name of the property to set
Returns:
  the property value
Throws:
  `java.lang.NoSuchFieldException`
  `java.lang.IllegalAccessException`
  `java.lang.IllegalArgumentException`

#### get

    protected static java.lang.Object get​(java.lang.Object o,
                                          ExecEnv env,
                                          java.lang.String propname)
                                   throws java.lang.NoSuchFieldException,
                                          java.lang.IllegalArgumentException,
                                          java.lang.IllegalAccessException

Implements the GET instruction. Assumes there is no `Field` with the given `propname`.

Parameters:
  `o` - the object to get the value for
  `env` - the execution environment
  `propname` - the name of the property to set
Returns:
  the property value
Throws:
  `java.lang.NoSuchFieldException`
  `java.lang.IllegalAccessException`
  `java.lang.IllegalArgumentException`

#### getTrans

    protected static java.util.Collection<java.lang.Object> getTrans​(java.lang.Object o,
                                                                     CodeBlock cb,
                                                                     StackFrame frame,
                                                                     java.lang.String propname)
                                                              throws java.lang.NoSuchFieldException,
                                                                     java.lang.IllegalArgumentException,
                                                                     java.lang.IllegalAccessException

Implements the GET_TRANS instruction.

Parameters:
  `o` - the object to get the value for
  `cb` - the original non-JIT'ed code block
  `frame` - the current stack frame
  `propname` - the name of the property to set
Returns:
  the property values
Throws:
  `java.lang.NoSuchFieldException`
  `java.lang.IllegalAccessException`
  `java.lang.IllegalArgumentException`

#### getSuper

    protected static java.lang.Object getSuper​(java.lang.Object o,
                                               org.eclipse.emf.ecore.EClass context,
                                               java.lang.String propname,
                                               StackFrame frame)
                                        throws java.lang.NoSuchFieldException,
                                               java.lang.IllegalArgumentException,
                                               java.lang.IllegalAccessException

Implements the GET_SUPER instruction.

Parameters:
  `o` - the source object
  `context` - the current field context type
  `propname` -
  `frame` -
Returns:
  the property value
Throws:
  `java.lang.NoSuchFieldException`
  `java.lang.IllegalAccessException`
  `java.lang.IllegalArgumentException`

#### getSuper

    protected static java.lang.Object getSuper​(java.lang.Object o,
                                               java.lang.Class<?> context,
                                               java.lang.String propname,
                                               StackFrame frame)
                                        throws java.lang.NoSuchFieldException,
                                               java.lang.IllegalArgumentException,
                                               java.lang.IllegalAccessException

Implements the GET_SUPER instruction.

Parameters:
  `o` - the source object
  `context` - the current field context type
  `propname` -
  `frame` -
Returns:
  the property value
Throws:
  `java.lang.NoSuchFieldException`
  `java.lang.IllegalAccessException`
  `java.lang.IllegalArgumentException`

#### setStatic

    protected static void setStatic​(java.lang.Object o,
                                    java.lang.Object v,
                                    CodeBlock cb,
                                    ExecEnv env,
                                    java.lang.String propname)
                             throws java.lang.NoSuchFieldException,
                                    java.lang.IllegalArgumentException,
                                    java.lang.IllegalAccessException

Implements the SET_STATIC instruction.

Parameters:
  `o` - the object type to set the value for
  `v` - the value to set
  `cb` - the original non-JIT'ed code block
  `env` - the execution environment
  `propname` - the name of the property to set
Throws:
  `java.lang.NoSuchFieldException`
  `java.lang.IllegalAccessException`
  `java.lang.IllegalArgumentException`

#### getStatic

    protected static java.lang.Object getStatic​(java.lang.Object o,
                                                CodeBlock cb,
                                                StackFrame frame,
                                                java.lang.String propname)
                                         throws java.lang.NoSuchFieldException,
                                                java.lang.IllegalArgumentException,
                                                java.lang.IllegalAccessException

Implements the GET_STATIC instruction.

Parameters:
  `o` - the object to get the value for
  `cb` - the original non-JIT'ed code block
  `frame` - the current stack frame
  `propname` - the name of the property to set
Returns:
  the property value
Throws:
  `java.lang.NoSuchFieldException`
  `java.lang.IllegalAccessException`
  `java.lang.IllegalArgumentException`

#### findTypeS

    protected static java.lang.Object findTypeS​(java.lang.String modelName,
                                                java.lang.String typeName,
                                                ExecEnv env)
                                         throws java.lang.ClassNotFoundException

Implements the FINDTYPE_S instruction.

Parameters:
  `modelName` - the name of the model in which type can be found
  `typeName` - the type name
  `env` - the execution environment
Returns:
  the type
Throws:
  `java.lang.ClassNotFoundException`

#### newInstance

    protected static java.lang.Object newInstance​(java.lang.Object type,
                                                  java.lang.String modelname,
                                                  ExecEnv env)

Creates a new instance of `type`.

Parameters:
  `type` - the type to instantiate
  `modelname` - the name of the model in which to create a new instance
  `env` - the execution environment
Returns:
  the new object

#### delete

    protected static void delete​(org.eclipse.emf.ecore.EObject element,
                                 StackFrame frame)

Implements the DELETE instruction.

Parameters:
  `element` - the element to delete
  `frame` - the current stack frame

#### invokeNative

    protected static java.lang.Object invokeNative​(StackFrame frame,
                                                   java.lang.Object self,
                                                   java.lang.String opname,
                                                   java.lang.reflect.Method method)

Invokes native Java `method` on `self` without arguments.

Parameters:
  `frame` - the current stack frame
  `self` - the object on which to invoke the method
  `opname` - the method name
  `method` - the method
Returns:
  the method result

#### invokeNative

    protected static java.lang.Object invokeNative​(StackFrame frame,
                                                   java.lang.Object self,
                                                   java.lang.String opname,
                                                   java.lang.Object arg,
                                                   java.lang.reflect.Method method)

Invokes native Java `method` on `self` with argument `arg`.

Parameters:
  `frame` - the current stack frame
  `self` - the object on which to invoke the method
  `opname` - the method name
  `arg` - the method argument
  `method` - the method
Returns:
  the method result

#### invokeNative

    protected static java.lang.Object invokeNative​(StackFrame frame,
                                                   java.lang.Object self,
                                                   java.lang.String opname,
                                                   java.lang.Object[] args,
                                                   java.lang.reflect.Method method)

Invokes native Java `method` on `self` with arguments `args`.

Parameters:
  `frame` - the current stack frame
  `self` - the object on which to invoke the method
  `opname` - the method name
  `args` - the method arguments
Returns:
  the method result

#### invokeSuper

    protected static java.lang.Object invokeSuper​(java.lang.Object self,
                                                  org.eclipse.emf.ecore.EClass context,
                                                  StackFrame frame,
                                                  java.lang.String opname)
                                           throws java.lang.IllegalArgumentException,
                                                  java.lang.IllegalAccessException,
                                                  java.lang.reflect.InvocationTargetException

Implements the INVOKE_SUPER instruction

Parameters:
  `self` -
  `context` - the context type for "super"
  `frame` -
  `opname` -
Returns:
  the invocation result
Throws:
  `java.lang.IllegalArgumentException`
  `java.lang.IllegalAccessException`
  `java.lang.reflect.InvocationTargetException`

#### invokeSuper

    protected static java.lang.Object invokeSuper​(java.lang.Object self,
                                                  java.lang.Class<?> context,
                                                  StackFrame frame,
                                                  java.lang.String opname)
                                           throws java.lang.IllegalArgumentException,
                                                  java.lang.IllegalAccessException,
                                                  java.lang.reflect.InvocationTargetException

Implements the INVOKE_SUPER instruction

Parameters:
  `self` -
  `context` - the context type for "super"
  `frame` -
  `opname` -
Returns:
  the invocation result
Throws:
  `java.lang.IllegalArgumentException`
  `java.lang.IllegalAccessException`
  `java.lang.reflect.InvocationTargetException`

#### invokeSuper

    protected static java.lang.Object invokeSuper​(java.lang.Object self,
                                                  java.lang.Object arg,
                                                  org.eclipse.emf.ecore.EClass context,
                                                  StackFrame frame,
                                                  java.lang.String opname)
                                           throws java.lang.IllegalArgumentException,
                                                  java.lang.IllegalAccessException,
                                                  java.lang.reflect.InvocationTargetException

Implements the INVOKE_SUPER instruction

Parameters:
  `self` -
  `arg` -
  `context` - the context type for "super"
  `frame` -
  `opname` -
Returns:
  the invocation result
Throws:
  `java.lang.IllegalArgumentException`
  `java.lang.IllegalAccessException`
  `java.lang.reflect.InvocationTargetException`

#### invokeSuper

    protected static java.lang.Object invokeSuper​(java.lang.Object self,
                                                  java.lang.Object arg,
                                                  java.lang.Class<?> context,
                                                  StackFrame frame,
                                                  java.lang.String opname)
                                           throws java.lang.IllegalArgumentException,
                                                  java.lang.IllegalAccessException,
                                                  java.lang.reflect.InvocationTargetException

Implements the INVOKE_SUPER instruction

Parameters:
  `self` -
  `arg` -
  `context` - the context type for "super"
  `frame` -
  `opname` -
Returns:
  the invocation result
Throws:
  `java.lang.IllegalArgumentException`
  `java.lang.IllegalAccessException`
  `java.lang.reflect.InvocationTargetException`

#### invokeSuper

    protected static java.lang.Object invokeSuper​(java.lang.Object self,
                                                  java.lang.Object[] args,
                                                  org.eclipse.emf.ecore.EClass context,
                                                  StackFrame frame,
                                                  java.lang.String opname)
                                           throws java.lang.IllegalArgumentException,
                                                  java.lang.IllegalAccessException,
                                                  java.lang.reflect.InvocationTargetException

Implements the INVOKE_SUPER instruction

Parameters:
  `self` -
  `args` -
  `context` - the context type for "super"
  `frame` -
  `opname` -
Returns:
  the invocation result
Throws:
  `java.lang.IllegalArgumentException`
  `java.lang.IllegalAccessException`
  `java.lang.reflect.InvocationTargetException`

#### invokeSuper

    protected static java.lang.Object invokeSuper​(java.lang.Object self,
                                                  java.lang.Object[] args,
                                                  java.lang.Class<?> context,
                                                  StackFrame frame,
                                                  java.lang.String opname)
                                           throws java.lang.IllegalArgumentException,
                                                  java.lang.IllegalAccessException,
                                                  java.lang.reflect.InvocationTargetException

Implements the INVOKE_SUPER instruction

Parameters:
  `self` -
  `args` -
  `context` - the context type for "super"
  `frame` -
  `opname` -
Returns:
  the invocation result
Throws:
  `java.lang.IllegalArgumentException`
  `java.lang.IllegalAccessException`
  `java.lang.reflect.InvocationTargetException`

#### invokeStatic

    protected static java.lang.Object invokeStatic​(java.lang.Object type,
                                                   StackFrame frame,
                                                   java.lang.String opname)
                                            throws java.lang.IllegalArgumentException,
                                                   java.lang.IllegalAccessException,
                                                   java.lang.reflect.InvocationTargetException

Implements the INVOKE_STATIC instruction

Parameters:
  `type` -
  `frame` -
  `opname` -
Returns:
  the invocation result
Throws:
  `java.lang.IllegalArgumentException`
  `java.lang.IllegalAccessException`
  `java.lang.reflect.InvocationTargetException`

#### invokeStatic

    protected static java.lang.Object invokeStatic​(java.lang.Object type,
                                                   java.lang.Object arg,
                                                   StackFrame frame,
                                                   java.lang.String opname)
                                            throws java.lang.IllegalArgumentException,
                                                   java.lang.IllegalAccessException,
                                                   java.lang.reflect.InvocationTargetException

Implements the INVOKE_STATIC instruction

Parameters:
  `type` -
  `arg` -
  `frame` -
  `opname` -
Returns:
  the invocation result
Throws:
  `java.lang.IllegalArgumentException`
  `java.lang.IllegalAccessException`
  `java.lang.reflect.InvocationTargetException`

#### invokeStatic

    protected static java.lang.Object invokeStatic​(java.lang.Object type,
                                                   java.lang.Object[] args,
                                                   StackFrame frame,
                                                   java.lang.String opname)
                                            throws java.lang.IllegalArgumentException,
                                                   java.lang.IllegalAccessException,
                                                   java.lang.reflect.InvocationTargetException

Implements the INVOKE_STATIC instruction

Parameters:
  `type` -
  `args` -
  `frame` -
  `opname` -
Returns:
  the invocation result
Throws:
  `java.lang.IllegalArgumentException`
  `java.lang.IllegalAccessException`
  `java.lang.reflect.InvocationTargetException`

#### matchOne

    protected static java.lang.Object matchOne​(java.lang.Object[] args,
                                               Rule rule,
                                               StackFrame frame)

Executes `rule` with `args`.

Parameters:
  `args` - the rule arguments
  `rule` - the rule
  `frame` - the current stack frame

#### matchOne

    protected static java.lang.Object matchOne​(Rule rule,
                                               StackFrame frame)

Executes `rule` without arguments.

Parameters:
  `rule` - the rule
  `frame` - the current stack frame

#### matchOne

    protected static java.lang.Object matchOne​(java.lang.Object[] args,
                                               StackFrame frame,
                                               java.lang.String rulename)

Executes `rule` with `args`.

Parameters:
  `args` - the rule arguments
  `frame` - the current stack frame
  `rulename` - the rule name

#### matchOne

    protected static java.lang.Object matchOne​(StackFrame frame,
                                               java.lang.String rulename)

Executes `rule` without arguments.

Parameters:
  `frame` - the current stack frame
  `rulename` - the rule name

#### add

    protected static void add​(java.lang.Object o,
                              java.lang.Object v,
                              int index,
                              java.lang.String propname,
                              CodeBlock cb,
                              StackFrame frame)
                       throws java.lang.NoSuchFieldException,
                              java.lang.IllegalArgumentException,
                              java.lang.IllegalAccessException

Adds `v` to `o.propname`. Implements the ADD and INSERT instructions.

Parameters:
  `o` - object
  `v` - value
  `index` - the insertion index (-1 for end)
  `propname` - the property name
  `cb` - the original non-JIT'ed code block
  `frame` - the current stack frame
Throws:
  `java.lang.NoSuchFieldException`
  `java.lang.IllegalAccessException`
  `java.lang.IllegalArgumentException`

#### remove

    protected static void remove​(java.lang.Object o,
                                 java.lang.Object v,
                                 java.lang.String propname,
                                 CodeBlock cb,
                                 StackFrame frame)
                          throws java.lang.NoSuchFieldException,
                                 java.lang.IllegalArgumentException,
                                 java.lang.IllegalAccessException

Implements the REMOVE instruction.

Parameters:
  `o` - object
  `v` - value
  `propname` - the property name
  `cb` - the original non-JIT'ed code block
  `frame` - the current stack frame
Throws:
  `java.lang.NoSuchFieldException`
  `java.lang.IllegalAccessException`
  `java.lang.IllegalArgumentException`