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
Modifier and TypeFieldDescriptionprotected final CodeBlock
TheCodeBlock
that thisJITCodeBlock
represents.protected final Class<?>
The Java context type for thisCodeBlock
, ornull
.protected final org.eclipse.emf.ecore.EClass
The EMF context type for thisCodeBlock
, ornull
.protected static final org.eclipse.emf.ecore.EClass
Singleton instance of theExecEnv
EClass
.protected final org.eclipse.emf.common.util.EList<CodeBlock>
The nestedCodeBlock
s ofcb
. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected static void
Addsv
too.propname
.protected static void
delete
(org.eclipse.emf.ecore.EObject element, StackFrame frame) Implements the DELETE instruction.abstract Object
execute
(StackFrame frame) Executes thisJITCodeBlock
, using the parameters stored inframe
.protected static Object
Implements the FINDTYPE_S instruction.protected static Object
get
(Object o, CodeBlock cb, StackFrame frame, String propname) Implements the GET instruction.protected static Object
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 Javamethod
onself
with argumentsargs
.protected static Object
invokeNative
(StackFrame frame, Object self, String opname, Object arg, Method method) Invokes native Javamethod
onself
with argumentarg
.protected static Object
invokeNative
(StackFrame frame, Object self, String opname, Method method) Invokes native Javamethod
onself
without arguments.protected static Object
invokeStatic
(Object type, Object[] args, StackFrame frame, String opname) Implements the INVOKE_STATIC instructionprotected static Object
invokeStatic
(Object type, Object arg, StackFrame frame, String opname) Implements the INVOKE_STATIC instructionprotected static Object
invokeStatic
(Object type, StackFrame frame, String opname) Implements the INVOKE_STATIC instructionprotected static Object
invokeSuper
(Object self, Class<?> context, StackFrame frame, String opname) Implements the INVOKE_SUPER instructionprotected static Object
invokeSuper
(Object self, Object[] args, Class<?> context, StackFrame frame, String opname) Implements the INVOKE_SUPER instructionprotected static Object
invokeSuper
(Object self, Object[] args, org.eclipse.emf.ecore.EClass context, StackFrame frame, String opname) Implements the INVOKE_SUPER instructionprotected static Object
invokeSuper
(Object self, Object arg, Class<?> context, StackFrame frame, String opname) Implements the INVOKE_SUPER instructionprotected static Object
invokeSuper
(Object self, Object arg, org.eclipse.emf.ecore.EClass context, StackFrame frame, String opname) Implements the INVOKE_SUPER instructionprotected static Object
invokeSuper
(Object self, org.eclipse.emf.ecore.EClass context, StackFrame frame, String opname) Implements the INVOKE_SUPER instructionprotected static Object
matchOne
(Object[] args, Rule rule, StackFrame frame) Executesrule
withargs
.protected static Object
matchOne
(Object[] args, StackFrame frame, String rulename) Executesrule
withargs
.protected static Object
matchOne
(Rule rule, StackFrame frame) Executesrule
without arguments.protected static Object
matchOne
(StackFrame frame, String rulename) Executesrule
without arguments.protected static Object
newInstance
(Object type, String modelname, ExecEnv env) Creates a new instance oftype
.protected static void
Implements the REMOVE instruction.protected static void
Implements the SET instruction.protected static void
Implements the SET_STATIC instruction.
-
Field Details
-
EXEC_ENV
protected static final org.eclipse.emf.ecore.EClass EXEC_ENVSingleton instance of theExecEnv
EClass
. -
cb
TheCodeBlock
that thisJITCodeBlock
represents. -
nested
The nestedCodeBlock
s 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
- theCodeBlock
that thisJITCodeBlock
represents
-
-
Method Details
-
execute
Executes thisJITCodeBlock
, using the parameters stored inframe
.- Parameters:
frame
- theStackFrame
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 forv
- the value to setcb
- the original non-JIT'ed code blockframe
- the current stack framepropname
- 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 forcb
- the original non-JIT'ed code blockframe
- the current stack framepropname
- 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 aField
with 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:
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 noField
with 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:
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 forcb
- the original non-JIT'ed code blockframe
- the current stack framepropname
- 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 objectcontext
- the current field context typepropname
-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 objectcontext
- the current field context typepropname
-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 forv
- the value to setcb
- the original non-JIT'ed code blockenv
- the execution environmentpropname
- 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 forcb
- the original non-JIT'ed code blockframe
- the current stack framepropname
- 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 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 Javamethod
onself
without 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 Javamethod
onself
with 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 Javamethod
onself
with 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:
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
Executesrule
withargs
.- Parameters:
args
- the rule argumentsrule
- the ruleframe
- the current stack frame
-
matchOne
Executesrule
without arguments.- Parameters:
rule
- the ruleframe
- the current stack frame
-
matchOne
Executesrule
withargs
.- Parameters:
args
- the rule argumentsframe
- the current stack framerulename
- the rule name
-
matchOne
Executesrule
without 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 Addsv
too.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:
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
- objectv
- valuepropname
- the property namecb
- the original non-JIT'ed code blockframe
- the current stack frame- Throws:
NoSuchFieldException
IllegalAccessException
IllegalArgumentException
-