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 theJITCodeBlock
compiler.
-
-
Field Summary
Fields Modifier and Type Field Description protected CodeBlock
cb
TheCodeBlock
that thisJITCodeBlock
represents.protected java.lang.Class<?>
context
The Java context type for thisCodeBlock
, ornull
.protected org.eclipse.emf.ecore.EClass
eContext
The EMF context type for thisCodeBlock
, ornull
.protected static org.eclipse.emf.ecore.EClass
EXEC_ENV
Singleton instance of theExecEnv
EClass
.protected org.eclipse.emf.common.util.EList<CodeBlock>
nested
The nestedCodeBlock
s 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 void
add(java.lang.Object o, java.lang.Object v, int index, java.lang.String propname, CodeBlock cb, StackFrame frame)
Addsv
too.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 thisJITCodeBlock
, using the parameters stored inframe
.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 Javamethod
onself
with argumentsargs
.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 Javamethod
onself
with argumentarg
.protected static java.lang.Object
invokeNative(StackFrame frame, java.lang.Object self, java.lang.String opname, java.lang.reflect.Method method)
Invokes native Javamethod
onself
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 instructionprotected static java.lang.Object
invokeStatic(java.lang.Object type, java.lang.Object arg, StackFrame frame, java.lang.String opname)
Implements the INVOKE_STATIC instructionprotected static java.lang.Object
invokeStatic(java.lang.Object type, StackFrame frame, java.lang.String opname)
Implements the INVOKE_STATIC instructionprotected static java.lang.Object
invokeSuper(java.lang.Object self, java.lang.Class<?> context, StackFrame frame, java.lang.String opname)
Implements the INVOKE_SUPER instructionprotected 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 instructionprotected 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 instructionprotected 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 instructionprotected 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 instructionprotected 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 instructionprotected static java.lang.Object
matchOne(java.lang.Object[] args, Rule rule, StackFrame frame)
Executesrule
withargs
.protected static java.lang.Object
matchOne(java.lang.Object[] args, StackFrame frame, java.lang.String rulename)
Executesrule
withargs
.protected static java.lang.Object
matchOne(Rule rule, StackFrame frame)
Executesrule
without arguments.protected static java.lang.Object
matchOne(StackFrame frame, java.lang.String rulename)
Executesrule
without arguments.protected static java.lang.Object
newInstance(java.lang.Object type, java.lang.String modelname, ExecEnv env)
Creates a new instance oftype
.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.
-
-
-
Field Detail
-
EXEC_ENV
protected static final org.eclipse.emf.ecore.EClass EXEC_ENV
Singleton instance of theExecEnv
EClass
.
-
cb
protected final CodeBlock cb
TheCodeBlock
that thisJITCodeBlock
represents.
-
nested
protected final org.eclipse.emf.common.util.EList<CodeBlock> nested
The nestedCodeBlock
s 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
- theCodeBlock
that thisJITCodeBlock
represents
-
-
Method Detail
-
execute
public abstract java.lang.Object execute(StackFrame frame)
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(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 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.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 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.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 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:
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 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:
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 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.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 objectcontext
- the current field context typepropname
-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 objectcontext
- the current field context typepropname
-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 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.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 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.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 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 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 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 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 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 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 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)
Executesrule
withargs
.- Parameters:
args
- the rule argumentsrule
- the ruleframe
- the current stack frame
-
matchOne
protected static java.lang.Object matchOne(Rule rule, StackFrame frame)
Executesrule
without 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)
Executesrule
withargs
.- 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)
Executesrule
without 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.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:
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
- objectv
- valuepropname
- the property namecb
- the original non-JIT'ed code blockframe
- the current stack frame- Throws:
java.lang.NoSuchFieldException
java.lang.IllegalAccessException
java.lang.IllegalArgumentException
-
-