Package org.eclipse.m2m.atl.emftvm.jit
Class JITCodeBlock
java.lang.Object
org.eclipse.m2m.atl.emftvm.jit.JITCodeBlock
Interface for code generated by the
JITCodeBlock compiler.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final CodeBlockTheCodeBlockthat thisJITCodeBlockrepresents.protected final Class<?> The Java context type for thisCodeBlock, ornull.protected final org.eclipse.emf.ecore.EClassThe EMF context type for thisCodeBlock, ornull.protected static final org.eclipse.emf.ecore.EClassSingleton instance of theExecEnvEClass.protected final org.eclipse.emf.common.util.EList<CodeBlock> The nestedCodeBlocks ofcb. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static voidAddsvtoo.propname.protected static voiddelete(org.eclipse.emf.ecore.EObject element, StackFrame frame) Implements the DELETE instruction.abstract Objectexecute(StackFrame frame) Executes thisJITCodeBlock, using the parameters stored inframe.protected static ObjectImplements the FINDTYPE_S instruction.protected static Objectget(Object o, CodeBlock cb, StackFrame frame, String propname) Implements the GET instruction.protected static ObjectImplements the GET instruction.protected static Objectget(Object o, StackFrame frame, String propname) Implements the GET instruction.protected static ObjectgetStatic(Object o, CodeBlock cb, StackFrame frame, String propname) Implements the GET_STATIC instruction.protected static ObjectgetSuper(Object o, Class<?> context, String propname, StackFrame frame) Implements the GET_SUPER instruction.protected static ObjectgetSuper(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 ObjectinvokeNative(StackFrame frame, Object self, String opname, Object[] args, Method method) Invokes native Javamethodonselfwith argumentsargs.protected static ObjectinvokeNative(StackFrame frame, Object self, String opname, Object arg, Method method) Invokes native Javamethodonselfwith argumentarg.protected static ObjectinvokeNative(StackFrame frame, Object self, String opname, Method method) Invokes native Javamethodonselfwithout arguments.protected static ObjectinvokeStatic(Object type, Object[] args, StackFrame frame, String opname) Implements the INVOKE_STATIC instructionprotected static ObjectinvokeStatic(Object type, Object arg, StackFrame frame, String opname) Implements the INVOKE_STATIC instructionprotected static ObjectinvokeStatic(Object type, StackFrame frame, String opname) Implements the INVOKE_STATIC instructionprotected static ObjectinvokeSuper(Object self, Class<?> context, StackFrame frame, String opname) Implements the INVOKE_SUPER instructionprotected static ObjectinvokeSuper(Object self, Object[] args, Class<?> context, StackFrame frame, String opname) Implements the INVOKE_SUPER instructionprotected static ObjectinvokeSuper(Object self, Object[] args, org.eclipse.emf.ecore.EClass context, StackFrame frame, String opname) Implements the INVOKE_SUPER instructionprotected static ObjectinvokeSuper(Object self, Object arg, Class<?> context, StackFrame frame, String opname) Implements the INVOKE_SUPER instructionprotected static ObjectinvokeSuper(Object self, Object arg, org.eclipse.emf.ecore.EClass context, StackFrame frame, String opname) Implements the INVOKE_SUPER instructionprotected static ObjectinvokeSuper(Object self, org.eclipse.emf.ecore.EClass context, StackFrame frame, String opname) Implements the INVOKE_SUPER instructionprotected static ObjectmatchOne(Object[] args, Rule rule, StackFrame frame) Executesrulewithargs.protected static ObjectmatchOne(Object[] args, StackFrame frame, String rulename) Executesrulewithargs.protected static ObjectmatchOne(Rule rule, StackFrame frame) Executesrulewithout arguments.protected static ObjectmatchOne(StackFrame frame, String rulename) Executesrulewithout arguments.protected static ObjectnewInstance(Object type, String modelname, ExecEnv env) Creates a new instance oftype.protected static voidImplements the REMOVE instruction.protected static voidImplements the SET instruction.protected static voidImplements the SET_STATIC instruction.
-
Field Details
-
EXEC_ENV
protected static final org.eclipse.emf.ecore.EClass EXEC_ENVSingleton instance of theExecEnvEClass. -
cb
TheCodeBlockthat thisJITCodeBlockrepresents. -
nested
The nestedCodeBlocks ofcb. -
eContext
protected final org.eclipse.emf.ecore.EClass eContextThe EMF context type for thisCodeBlock, ornull. -
context
The Java context type for thisCodeBlock, ornull.
-
-
Constructor Details
-
JITCodeBlock
Creates a newJITCodeBlock.- Parameters:
cb- theCodeBlockthat thisJITCodeBlockrepresents
-
-
Method Details
-
execute
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(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 forv- the value to setcb- the original non-JIT'ed code blockframe- the current stack framepropname- the name of the property to set- Throws:
NoSuchFieldExceptionIllegalAccessExceptionIllegalArgumentException
-
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 forcb- the original non-JIT'ed code blockframe- the current stack framepropname- the name of the property to set- Returns:
- the property value
- Throws:
NoSuchFieldExceptionIllegalAccessExceptionIllegalArgumentException
-
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 aFieldwith the givenpropname.- Parameters:
o- the object to get the value forframe- the current stack framepropname- the name of the property to setcb- the original non-JIT'ed code block- Returns:
- the property value
- Throws:
NoSuchFieldExceptionIllegalAccessExceptionIllegalArgumentException
-
get
protected static Object get(Object o, ExecEnv env, String propname) throws NoSuchFieldException, IllegalArgumentException, IllegalAccessException Implements 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:
NoSuchFieldExceptionIllegalAccessExceptionIllegalArgumentException
-
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 forcb- the original non-JIT'ed code blockframe- the current stack framepropname- the name of the property to set- Returns:
- the property values
- Throws:
NoSuchFieldExceptionIllegalAccessExceptionIllegalArgumentException
-
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 objectcontext- the current field context typepropname-frame-- Returns:
- the property value
- Throws:
NoSuchFieldExceptionIllegalAccessExceptionIllegalArgumentException
-
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 objectcontext- the current field context typepropname-frame-- Returns:
- the property value
- Throws:
NoSuchFieldExceptionIllegalAccessExceptionIllegalArgumentException
-
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 forv- the value to setcb- the original non-JIT'ed code blockenv- the execution environmentpropname- the name of the property to set- Throws:
NoSuchFieldExceptionIllegalAccessExceptionIllegalArgumentException
-
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 forcb- the original non-JIT'ed code blockframe- the current stack framepropname- the name of the property to set- Returns:
- the property value
- Throws:
NoSuchFieldExceptionIllegalAccessExceptionIllegalArgumentException
-
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 foundtypeName- the type nameenv- the execution environment- Returns:
- the type
- Throws:
ClassNotFoundException
-
newInstance
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
Implements the DELETE instruction.- Parameters:
element- the element to deleteframe- the current stack frame
-
invokeNative
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 Object invokeNative(StackFrame frame, Object self, String opname, Object arg, 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 Object invokeNative(StackFrame frame, Object self, String opname, Object[] args, 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 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:
IllegalArgumentExceptionIllegalAccessExceptionInvocationTargetException
-
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:
IllegalArgumentExceptionIllegalAccessExceptionInvocationTargetException
-
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:
IllegalArgumentExceptionIllegalAccessExceptionInvocationTargetException
-
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:
IllegalArgumentExceptionIllegalAccessExceptionInvocationTargetException
-
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:
IllegalArgumentExceptionIllegalAccessExceptionInvocationTargetException
-
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:
IllegalArgumentExceptionIllegalAccessExceptionInvocationTargetException
-
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:
IllegalArgumentExceptionIllegalAccessExceptionInvocationTargetException
-
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:
IllegalArgumentExceptionIllegalAccessExceptionInvocationTargetException
-
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:
IllegalArgumentExceptionIllegalAccessExceptionInvocationTargetException
-
matchOne
Executesrulewithargs.- Parameters:
args- the rule argumentsrule- the ruleframe- the current stack frame
-
matchOne
Executesrulewithout arguments.- Parameters:
rule- the ruleframe- the current stack frame
-
matchOne
Executesrulewithargs.- Parameters:
args- the rule argumentsframe- the current stack framerulename- the rule name
-
matchOne
Executesrulewithout arguments.- Parameters:
frame- the current stack framerulename- the rule name
-
add
protected static void add(Object o, Object v, int index, String propname, CodeBlock cb, StackFrame frame) throws NoSuchFieldException, IllegalArgumentException, IllegalAccessException Addsvtoo.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:
NoSuchFieldExceptionIllegalAccessExceptionIllegalArgumentException
-
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- objectv- valuepropname- the property namecb- the original non-JIT'ed code blockframe- the current stack frame- Throws:
NoSuchFieldExceptionIllegalAccessExceptionIllegalArgumentException
-