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

# Class JITCodeBlock

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

public abstract class JITCodeBlock extends Object
Interface for code generated by the `JITCodeBlock` compiler.

## Field Summary

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

## Constructor Summary

Constructors
Constructor
Description
`JITCodeBlock(CodeBlock cb)`
Creates a new `JITCodeBlock`.

## Method Summary

Modifier and Type
Method
Description
`protected static void`
`add(Object o, Object v, int index, 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 Object`
`execute(StackFrame frame)`
Executes this `JITCodeBlock`, using the parameters stored in `frame`.
`protected static Object`
`findTypeS(String modelName, String typeName, ExecEnv env)`
Implements the FINDTYPE_S instruction.
`protected static Object`
`get(Object o, CodeBlock cb, StackFrame frame, String propname)`
Implements the GET instruction.
`protected static Object`
`get(Object o, ExecEnv env, String propname)`
Implements the GET instruction.
`protected static Object`
`get(Object o, StackFrame frame, String propname)`
Implements the GET instruction.
`protected static Object`
`getStatic(Object o, CodeBlock cb, StackFrame frame, String propname)`
Implements the GET_STATIC instruction.
`protected static Object`
`getSuper(Object o, Class<?> context, String propname, StackFrame frame)`
Implements the GET_SUPER instruction.
`protected static Object`
`getSuper(Object o, org.eclipse.emf.ecore.EClass context, String propname, StackFrame frame)`
Implements the GET_SUPER instruction.
`protected static Collection<Object>`
`getTrans(Object o, CodeBlock cb, StackFrame frame, String propname)`
Implements the GET_TRANS instruction.
`protected static Object`
`invokeNative(StackFrame frame, Object self, String opname, Object[] args, Method method)`
Invokes native Java `method` on `self` with arguments `args`.
`protected static Object`
`invokeNative(StackFrame frame, Object self, String opname, Object arg, Method method)`
Invokes native Java `method` on `self` with argument `arg`.
`protected static Object`
`invokeNative(StackFrame frame, Object self, String opname, Method method)`
Invokes native Java `method` on `self` without arguments.
`protected static Object`
`invokeStatic(Object type, Object[] args, StackFrame frame, String opname)`
Implements the INVOKE_STATIC instruction
`protected static Object`
`invokeStatic(Object type, Object arg, StackFrame frame, String opname)`
Implements the INVOKE_STATIC instruction
`protected static Object`
`invokeStatic(Object type, StackFrame frame, String opname)`
Implements the INVOKE_STATIC instruction
`protected static Object`
`invokeSuper(Object self, Class<?> context, StackFrame frame, String opname)`
Implements the INVOKE_SUPER instruction
`protected static Object`
`invokeSuper(Object self, Object[] args, Class<?> context, StackFrame frame, String opname)`
Implements the INVOKE_SUPER instruction
`protected static Object`
`invokeSuper(Object self, Object[] args, org.eclipse.emf.ecore.EClass context, StackFrame frame, String opname)`
Implements the INVOKE_SUPER instruction
`protected static Object`
`invokeSuper(Object self, Object arg, Class<?> context, StackFrame frame, String opname)`
Implements the INVOKE_SUPER instruction
`protected static Object`
`invokeSuper(Object self, Object arg, org.eclipse.emf.ecore.EClass context, StackFrame frame, String opname)`
Implements the INVOKE_SUPER instruction
`protected static Object`
`invokeSuper(Object self, org.eclipse.emf.ecore.EClass context, StackFrame frame, String opname)`
Implements the INVOKE_SUPER instruction
`protected static Object`
`matchOne(Object[] args, Rule rule, StackFrame frame)`
Executes `rule` with `args`.
`protected static Object`
`matchOne(Object[] args, StackFrame frame, String rulename)`
Executes `rule` with `args`.
`protected static Object`
`matchOne(Rule rule, StackFrame frame)`
Executes `rule` without arguments.
`protected static Object`
`matchOne(StackFrame frame, String rulename)`
Executes `rule` without arguments.
`protected static Object`
`newInstance(Object type, String modelname, ExecEnv env)`
Creates a new instance of `type`.
`protected static void`
`remove(Object o, Object v, String propname, CodeBlock cb, StackFrame frame)`
Implements the REMOVE instruction.
`protected static void`
`set(Object o, Object v, CodeBlock cb, StackFrame frame, String propname)`
Implements the SET instruction.
`protected static void`
`setStatic(Object o, Object v, CodeBlock cb, ExecEnv env, 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 Details

### 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 Class<?> context
The Java context type for this `CodeBlock`, or `null`.

## Constructor Details

### JITCodeBlock

public JITCodeBlock(CodeBlock cb)
Creates a new `JITCodeBlock`.

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

## Method Details

### execute

public abstract 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(Object o, Object v, CodeBlock cb, StackFrame frame, String propname) throws NoSuchFieldException, IllegalArgumentException, 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:
  `NoSuchFieldException`
  `IllegalAccessException`
  `IllegalArgumentException`

### get

protected static Object get(Object o, CodeBlock cb, StackFrame frame, String propname) throws NoSuchFieldException, IllegalArgumentException, 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:
  `NoSuchFieldException`
  `IllegalAccessException`
  `IllegalArgumentException`

### get

protected static Object get(Object o, StackFrame frame, String propname) throws NoSuchFieldException, IllegalArgumentException, 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:
  `NoSuchFieldException`
  `IllegalAccessException`
  `IllegalArgumentException`

### get

protected static Object get(Object o, ExecEnv env, String propname) throws NoSuchFieldException, IllegalArgumentException, 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:
  `NoSuchFieldException`
  `IllegalAccessException`
  `IllegalArgumentException`

### getTrans

protected static Collection<Object> getTrans(Object o, CodeBlock cb, StackFrame frame, String propname) throws NoSuchFieldException, IllegalArgumentException, 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:
  `NoSuchFieldException`
  `IllegalAccessException`
  `IllegalArgumentException`

### getSuper

protected static Object getSuper(Object o, org.eclipse.emf.ecore.EClass context, String propname, StackFrame frame) throws NoSuchFieldException, IllegalArgumentException, IllegalAccessException
Implements the GET_SUPER instruction.

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

### getSuper

protected static Object getSuper(Object o, Class<?> context, String propname, StackFrame frame) throws NoSuchFieldException, IllegalArgumentException, IllegalAccessException
Implements the GET_SUPER instruction.

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

### setStatic

protected static void setStatic(Object o, Object v, CodeBlock cb, ExecEnv env, String propname) throws NoSuchFieldException, IllegalArgumentException, 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:
  `NoSuchFieldException`
  `IllegalAccessException`
  `IllegalArgumentException`

### getStatic

protected static Object getStatic(Object o, CodeBlock cb, StackFrame frame, String propname) throws NoSuchFieldException, IllegalArgumentException, 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:
  `NoSuchFieldException`
  `IllegalAccessException`
  `IllegalArgumentException`

### findTypeS

protected static Object findTypeS(String modelName, String typeName, ExecEnv env) throws 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:
  `ClassNotFoundException`

### newInstance

protected static Object newInstance(Object type, 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 Object invokeNative(StackFrame frame, Object self, String opname, 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 Object invokeNative(StackFrame frame, Object self, String opname, Object arg, 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 Object invokeNative(StackFrame frame, Object self, String opname, Object[] args, 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 Object invokeSuper(Object self, org.eclipse.emf.ecore.EClass context, StackFrame frame, String opname) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException
Implements the INVOKE_SUPER instruction

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

### invokeSuper

protected static Object invokeSuper(Object self, Class<?> context, StackFrame frame, String opname) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException
Implements the INVOKE_SUPER instruction

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

### invokeSuper

protected static Object invokeSuper(Object self, Object arg, org.eclipse.emf.ecore.EClass context, StackFrame frame, String opname) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException
Implements the INVOKE_SUPER instruction

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

### invokeSuper

protected static Object invokeSuper(Object self, Object arg, Class<?> context, StackFrame frame, String opname) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException
Implements the INVOKE_SUPER instruction

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

### invokeSuper

protected static Object invokeSuper(Object self, Object[] args, org.eclipse.emf.ecore.EClass context, StackFrame frame, String opname) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException
Implements the INVOKE_SUPER instruction

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

### invokeSuper

protected static Object invokeSuper(Object self, Object[] args, Class<?> context, StackFrame frame, String opname) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException
Implements the INVOKE_SUPER instruction

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

### invokeStatic

protected static Object invokeStatic(Object type, StackFrame frame, String opname) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException
Implements the INVOKE_STATIC instruction

Parameters:
  `type` -
  `frame` -
  `opname` -
Returns:
  the invocation result
Throws:
  `IllegalArgumentException`
  `IllegalAccessException`
  `InvocationTargetException`

### invokeStatic

protected static Object invokeStatic(Object type, Object arg, StackFrame frame, String opname) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException
Implements the INVOKE_STATIC instruction

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

### invokeStatic

protected static Object invokeStatic(Object type, Object[] args, StackFrame frame, String opname) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException
Implements the INVOKE_STATIC instruction

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

### matchOne

protected static Object matchOne(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 Object matchOne(Rule rule, StackFrame frame)
Executes `rule` without arguments.

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

### matchOne

protected static Object matchOne(Object[] args, StackFrame frame, String rulename)
Executes `rule` with `args`.

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

### matchOne

protected static Object matchOne(StackFrame frame, String rulename)
Executes `rule` without arguments.

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

### add

protected static void add(Object o, Object v, int index, String propname, CodeBlock cb, StackFrame frame) throws NoSuchFieldException, IllegalArgumentException, 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:
  `NoSuchFieldException`
  `IllegalAccessException`
  `IllegalArgumentException`

### remove

protected static void remove(Object o, Object v, String propname, CodeBlock cb, StackFrame frame) throws NoSuchFieldException, IllegalArgumentException, 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:
  `NoSuchFieldException`
  `IllegalAccessException`
  `IllegalArgumentException`