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.ObjectInterface for code generated by theJITCodeBlockcompiler.
-
-
Field Summary
Fields Modifier and Type Field Description protected CodeBlockcbTheCodeBlockthat thisJITCodeBlockrepresents.protected java.lang.Class<?>contextThe Java context type for thisCodeBlock, ornull.protected org.eclipse.emf.ecore.EClasseContextThe EMF context type for thisCodeBlock, ornull.protected static org.eclipse.emf.ecore.EClassEXEC_ENVSingleton instance of theExecEnvEClass.protected org.eclipse.emf.common.util.EList<CodeBlock>nestedThe nestedCodeBlocks ofcb.
-
Constructor Summary
Constructors Constructor Description JITCodeBlock(CodeBlock cb)Creates a newJITCodeBlock.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected static voidadd(java.lang.Object o, java.lang.Object v, int index, java.lang.String propname, CodeBlock cb, StackFrame frame)Addsvtoo.propname.protected static voiddelete(org.eclipse.emf.ecore.EObject element, StackFrame frame)Implements the DELETE instruction.abstract java.lang.Objectexecute(StackFrame frame)Executes thisJITCodeBlock, using the parameters stored inframe.protected static java.lang.ObjectfindTypeS(java.lang.String modelName, java.lang.String typeName, ExecEnv env)Implements the FINDTYPE_S instruction.protected static java.lang.Objectget(java.lang.Object o, CodeBlock cb, StackFrame frame, java.lang.String propname)Implements the GET instruction.protected static java.lang.Objectget(java.lang.Object o, ExecEnv env, java.lang.String propname)Implements the GET instruction.protected static java.lang.Objectget(java.lang.Object o, StackFrame frame, java.lang.String propname)Implements the GET instruction.protected static java.lang.ObjectgetStatic(java.lang.Object o, CodeBlock cb, StackFrame frame, java.lang.String propname)Implements the GET_STATIC instruction.protected static java.lang.ObjectgetSuper(java.lang.Object o, java.lang.Class<?> context, java.lang.String propname, StackFrame frame)Implements the GET_SUPER instruction.protected static java.lang.ObjectgetSuper(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.ObjectinvokeNative(StackFrame frame, java.lang.Object self, java.lang.String opname, java.lang.Object[] args, java.lang.reflect.Method method)Invokes native Javamethodonselfwith argumentsargs.protected static java.lang.ObjectinvokeNative(StackFrame frame, java.lang.Object self, java.lang.String opname, java.lang.Object arg, java.lang.reflect.Method method)Invokes native Javamethodonselfwith argumentarg.protected static java.lang.ObjectinvokeNative(StackFrame frame, java.lang.Object self, java.lang.String opname, java.lang.reflect.Method method)Invokes native Javamethodonselfwithout arguments.protected static java.lang.ObjectinvokeStatic(java.lang.Object type, java.lang.Object[] args, StackFrame frame, java.lang.String opname)Implements the INVOKE_STATIC instructionprotected static java.lang.ObjectinvokeStatic(java.lang.Object type, java.lang.Object arg, StackFrame frame, java.lang.String opname)Implements the INVOKE_STATIC instructionprotected static java.lang.ObjectinvokeStatic(java.lang.Object type, StackFrame frame, java.lang.String opname)Implements the INVOKE_STATIC instructionprotected static java.lang.ObjectinvokeSuper(java.lang.Object self, java.lang.Class<?> context, StackFrame frame, java.lang.String opname)Implements the INVOKE_SUPER instructionprotected static java.lang.ObjectinvokeSuper(java.lang.Object self, java.lang.Object[] args, java.lang.Class<?> context, StackFrame frame, java.lang.String opname)Implements the INVOKE_SUPER instructionprotected static java.lang.ObjectinvokeSuper(java.lang.Object self, java.lang.Object[] args, org.eclipse.emf.ecore.EClass context, StackFrame frame, java.lang.String opname)Implements the INVOKE_SUPER instructionprotected static java.lang.ObjectinvokeSuper(java.lang.Object self, java.lang.Object arg, java.lang.Class<?> context, StackFrame frame, java.lang.String opname)Implements the INVOKE_SUPER instructionprotected static java.lang.ObjectinvokeSuper(java.lang.Object self, java.lang.Object arg, org.eclipse.emf.ecore.EClass context, StackFrame frame, java.lang.String opname)Implements the INVOKE_SUPER instructionprotected static java.lang.ObjectinvokeSuper(java.lang.Object self, org.eclipse.emf.ecore.EClass context, StackFrame frame, java.lang.String opname)Implements the INVOKE_SUPER instructionprotected static java.lang.ObjectmatchOne(java.lang.Object[] args, Rule rule, StackFrame frame)Executesrulewithargs.protected static java.lang.ObjectmatchOne(java.lang.Object[] args, StackFrame frame, java.lang.String rulename)Executesrulewithargs.protected static java.lang.ObjectmatchOne(Rule rule, StackFrame frame)Executesrulewithout arguments.protected static java.lang.ObjectmatchOne(StackFrame frame, java.lang.String rulename)Executesrulewithout arguments.protected static java.lang.ObjectnewInstance(java.lang.Object type, java.lang.String modelname, ExecEnv env)Creates a new instance oftype.protected static voidremove(java.lang.Object o, java.lang.Object v, java.lang.String propname, CodeBlock cb, StackFrame frame)Implements the REMOVE instruction.protected static voidset(java.lang.Object o, java.lang.Object v, CodeBlock cb, StackFrame frame, java.lang.String propname)Implements the SET instruction.protected static voidsetStatic(java.lang.Object o, java.lang.Object v, CodeBlock cb, ExecEnv env, java.lang.String propname)Implements the SET_STATIC instruction.
-
-
-
Field Detail
-
EXEC_ENV
protected static final org.eclipse.emf.ecore.EClass EXEC_ENV
Singleton instance of theExecEnvEClass.
-
cb
protected final CodeBlock cb
TheCodeBlockthat thisJITCodeBlockrepresents.
-
nested
protected final org.eclipse.emf.common.util.EList<CodeBlock> nested
The nestedCodeBlocks ofcb.
-
eContext
protected final org.eclipse.emf.ecore.EClass eContext
The EMF context type for thisCodeBlock, ornull.
-
context
protected final java.lang.Class<?> context
The Java context type for thisCodeBlock, ornull.
-
-
Constructor Detail
-
JITCodeBlock
public JITCodeBlock(CodeBlock cb)
Creates a newJITCodeBlock.- Parameters:
cb- theCodeBlockthat thisJITCodeBlockrepresents
-
-
Method Detail
-
execute
public abstract java.lang.Object execute(StackFrame frame)
Executes thisJITCodeBlock, using the parameters stored inframe.- Parameters:
frame- theStackFrameto 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.IllegalAccessExceptionImplements the SET instruction.- Parameters:
o- the object to set the value forv- the value to setcb- the original non-JIT'ed code blockframe- the current stack framepropname- the name of the property to set- Throws:
java.lang.NoSuchFieldExceptionjava.lang.IllegalAccessExceptionjava.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.IllegalAccessExceptionImplements the GET instruction.- Parameters:
o- the object to get the value forcb- the original non-JIT'ed code blockframe- the current stack framepropname- the name of the property to set- Returns:
- the property value
- Throws:
java.lang.NoSuchFieldExceptionjava.lang.IllegalAccessExceptionjava.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.IllegalAccessExceptionImplements the GET instruction. Assumes this code block is not contained in a rule, or the rule does not contain aFieldwith the givenpropname.- Parameters:
o- the object to get the value forcb- the original non-JIT'ed code blockframe- the current stack framepropname- the name of the property to set- Returns:
- the property value
- Throws:
java.lang.NoSuchFieldExceptionjava.lang.IllegalAccessExceptionjava.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.IllegalAccessExceptionImplements the GET instruction. Assumes there is noFieldwith the givenpropname.- Parameters:
o- the object to get the value forenv- the execution environmentpropname- the name of the property to set- Returns:
- the property value
- Throws:
java.lang.NoSuchFieldExceptionjava.lang.IllegalAccessExceptionjava.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.IllegalAccessExceptionImplements the GET_TRANS instruction.- Parameters:
o- the object to get the value forcb- the original non-JIT'ed code blockframe- the current stack framepropname- the name of the property to set- Returns:
- the property values
- Throws:
java.lang.NoSuchFieldExceptionjava.lang.IllegalAccessExceptionjava.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.IllegalAccessExceptionImplements the GET_SUPER instruction.- Parameters:
o- the source objectcontext- the current field context typepropname-frame-- Returns:
- the property value
- Throws:
java.lang.NoSuchFieldExceptionjava.lang.IllegalAccessExceptionjava.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.IllegalAccessExceptionImplements the GET_SUPER instruction.- Parameters:
o- the source objectcontext- the current field context typepropname-frame-- Returns:
- the property value
- Throws:
java.lang.NoSuchFieldExceptionjava.lang.IllegalAccessExceptionjava.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.IllegalAccessExceptionImplements the SET_STATIC instruction.- Parameters:
o- the object type to set the value forv- the value to setcb- the original non-JIT'ed code blockenv- the execution environmentpropname- the name of the property to set- Throws:
java.lang.NoSuchFieldExceptionjava.lang.IllegalAccessExceptionjava.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.IllegalAccessExceptionImplements the GET_STATIC instruction.- Parameters:
o- the object to get the value forcb- the original non-JIT'ed code blockframe- the current stack framepropname- the name of the property to set- Returns:
- the property value
- Throws:
java.lang.NoSuchFieldExceptionjava.lang.IllegalAccessExceptionjava.lang.IllegalArgumentException
-
findTypeS
protected static java.lang.Object findTypeS(java.lang.String modelName, java.lang.String typeName, ExecEnv env) throws java.lang.ClassNotFoundExceptionImplements the FINDTYPE_S instruction.- Parameters:
modelName- the name of the model in which type can be foundtypeName- the type nameenv- 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 oftype.- Parameters:
type- the type to instantiatemodelname- the name of the model in which to create a new instanceenv- 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 deleteframe- 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 Javamethodonselfwithout arguments.- Parameters:
frame- the current stack frameself- the object on which to invoke the methodopname- the method namemethod- 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 Javamethodonselfwith argumentarg.- Parameters:
frame- the current stack frameself- the object on which to invoke the methodopname- the method namearg- the method argumentmethod- 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 Javamethodonselfwith argumentsargs.- Parameters:
frame- the current stack frameself- the object on which to invoke the methodopname- the method nameargs- 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.InvocationTargetExceptionImplements the INVOKE_SUPER instruction- Parameters:
self-context- the context type for "super"frame-opname-- Returns:
- the invocation result
- Throws:
java.lang.IllegalArgumentExceptionjava.lang.IllegalAccessExceptionjava.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.InvocationTargetExceptionImplements the INVOKE_SUPER instruction- Parameters:
self-context- the context type for "super"frame-opname-- Returns:
- the invocation result
- Throws:
java.lang.IllegalArgumentExceptionjava.lang.IllegalAccessExceptionjava.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.InvocationTargetExceptionImplements the INVOKE_SUPER instruction- Parameters:
self-arg-context- the context type for "super"frame-opname-- Returns:
- the invocation result
- Throws:
java.lang.IllegalArgumentExceptionjava.lang.IllegalAccessExceptionjava.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.InvocationTargetExceptionImplements the INVOKE_SUPER instruction- Parameters:
self-arg-context- the context type for "super"frame-opname-- Returns:
- the invocation result
- Throws:
java.lang.IllegalArgumentExceptionjava.lang.IllegalAccessExceptionjava.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.InvocationTargetExceptionImplements the INVOKE_SUPER instruction- Parameters:
self-args-context- the context type for "super"frame-opname-- Returns:
- the invocation result
- Throws:
java.lang.IllegalArgumentExceptionjava.lang.IllegalAccessExceptionjava.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.InvocationTargetExceptionImplements the INVOKE_SUPER instruction- Parameters:
self-args-context- the context type for "super"frame-opname-- Returns:
- the invocation result
- Throws:
java.lang.IllegalArgumentExceptionjava.lang.IllegalAccessExceptionjava.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.InvocationTargetExceptionImplements the INVOKE_STATIC instruction- Parameters:
type-frame-opname-- Returns:
- the invocation result
- Throws:
java.lang.IllegalArgumentExceptionjava.lang.IllegalAccessExceptionjava.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.InvocationTargetExceptionImplements the INVOKE_STATIC instruction- Parameters:
type-arg-frame-opname-- Returns:
- the invocation result
- Throws:
java.lang.IllegalArgumentExceptionjava.lang.IllegalAccessExceptionjava.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.InvocationTargetExceptionImplements the INVOKE_STATIC instruction- Parameters:
type-args-frame-opname-- Returns:
- the invocation result
- Throws:
java.lang.IllegalArgumentExceptionjava.lang.IllegalAccessExceptionjava.lang.reflect.InvocationTargetException
-
matchOne
protected static java.lang.Object matchOne(java.lang.Object[] args, Rule rule, StackFrame frame)Executesrulewithargs.- Parameters:
args- the rule argumentsrule- the ruleframe- the current stack frame
-
matchOne
protected static java.lang.Object matchOne(Rule rule, StackFrame frame)
Executesrulewithout arguments.- Parameters:
rule- the ruleframe- the current stack frame
-
matchOne
protected static java.lang.Object matchOne(java.lang.Object[] args, StackFrame frame, java.lang.String rulename)Executesrulewithargs.- Parameters:
args- the rule argumentsframe- the current stack framerulename- the rule name
-
matchOne
protected static java.lang.Object matchOne(StackFrame frame, java.lang.String rulename)
Executesrulewithout arguments.- Parameters:
frame- the current stack framerulename- 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.IllegalAccessExceptionAddsvtoo.propname. Implements the ADD and INSERT instructions.- Parameters:
o- objectv- valueindex- the insertion index (-1 for end)propname- the property namecb- the original non-JIT'ed code blockframe- the current stack frame- Throws:
java.lang.NoSuchFieldExceptionjava.lang.IllegalAccessExceptionjava.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.IllegalAccessExceptionImplements the REMOVE instruction.- Parameters:
o- objectv- valuepropname- the property namecb- the original non-JIT'ed code blockframe- the current stack frame- Throws:
java.lang.NoSuchFieldExceptionjava.lang.IllegalAccessExceptionjava.lang.IllegalArgumentException
-
-