org.eclipse.m2m.atl.engine.emfvm
Class ASMOperation

java.lang.Object
  extended by org.eclipse.m2m.atl.engine.emfvm.lib.Operation
      extended by org.eclipse.m2m.atl.engine.emfvm.ASMOperation

public class ASMOperation
extends Operation

ASM commands scheduler.


Field Summary
static int MAX_STACK
          The max size of the Stack.
 
Fields inherited from class org.eclipse.m2m.atl.engine.emfvm.lib.Operation
maxLocals, name
 
Constructor Summary
ASMOperation(ASM asm, java.lang.String name)
          ASMOperation constructor.
 
Method Summary
 void addLineNumberEntry(java.lang.String id, int begin, int end)
          Adds a line number entry.
 void addLocalVariableEntry(int slot, java.lang.String variableName, int begin, int end)
          Adds a local variable entry with the given parameters.
 void addParameter(java.lang.String parameterName, java.lang.String type)
          Adds a parameter.
 java.lang.Object exec(AbstractStackFrame frame)
          Executes an operation.
 java.lang.Object exec(AbstractStackFrame frame, org.eclipse.core.runtime.IProgressMonitor monitor)
          Executes an operation.
protected static java.lang.reflect.Method findMethod(java.lang.Class<?> caller, java.lang.String name, java.lang.Class<?>[] argumentTypes)
          Looks for a method into cache and metamodel.
 ASM getASM()
           
 Bytecode[] getBytecodes()
          Returns the bytecodes.
 java.lang.String getContext()
           
 java.util.List<?> getInstructions()
          
 java.util.List<org.eclipse.m2m.atl.engine.emfvm.ASMOperation.LineNumberEntry> getLineNumberTable()
           
 java.util.List<org.eclipse.m2m.atl.engine.emfvm.ASMOperation.LocalVariableEntry> getLocalVariableTable()
           
 int getMaxLocals()
          
 java.lang.String getName()
          
 java.util.List<java.lang.String> getParameters()
           
 java.lang.String resolveLineNumber(int l)
          Returns the line at the specified number.
 java.lang.String resolveVariableName(int slot, int l)
          Resolves a variable name by its slot number and its index.
 void setBytecodes(Bytecode[] bytecodes)
          Sets the bytecodes for the operation.
 void setContext(java.lang.String context)
           
 java.lang.String toString()
          
 
Methods inherited from class org.eclipse.m2m.atl.engine.emfvm.lib.Operation
setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MAX_STACK

public static final int MAX_STACK
The max size of the Stack.

See Also:
Constant Field Values
Constructor Detail

ASMOperation

public ASMOperation(ASM asm,
                    java.lang.String name)
ASMOperation constructor.

Parameters:
asm - the parent asm
name - operation name
Method Detail

getMaxLocals

public int getMaxLocals()

Overrides:
getMaxLocals in class Operation
See Also:
Operation.getMaxLocals()

getParameters

public java.util.List<java.lang.String> getParameters()

setContext

public void setContext(java.lang.String context)

getContext

public java.lang.String getContext()

addParameter

public void addParameter(java.lang.String parameterName,
                         java.lang.String type)
Adds a parameter.

Parameters:
parameterName - the parameter name
type - the parameter type

addLineNumberEntry

public void addLineNumberEntry(java.lang.String id,
                               int begin,
                               int end)
Adds a line number entry.

Parameters:
id - the parameter id
begin - the begin index
end - the end index

getLineNumberTable

public java.util.List<org.eclipse.m2m.atl.engine.emfvm.ASMOperation.LineNumberEntry> getLineNumberTable()

resolveLineNumber

public java.lang.String resolveLineNumber(int l)
Returns the line at the specified number.

Overrides:
resolveLineNumber in class Operation
Parameters:
l - the line number
Returns:
the line at the specified number
See Also:
Operation.resolveLineNumber(int)

addLocalVariableEntry

public void addLocalVariableEntry(int slot,
                                  java.lang.String variableName,
                                  int begin,
                                  int end)
Adds a local variable entry with the given parameters.

Parameters:
slot - the slot number
variableName - the variable name
begin - the begin index
end - the end index

getLocalVariableTable

public java.util.List<org.eclipse.m2m.atl.engine.emfvm.ASMOperation.LocalVariableEntry> getLocalVariableTable()

resolveVariableName

public java.lang.String resolveVariableName(int slot,
                                            int l)
Resolves a variable name by its slot number and its index.

Overrides:
resolveVariableName in class Operation
Parameters:
slot - the slot number
l - the variable index
Returns:
the variable name
See Also:
Operation.resolveVariableName(int, int)

setBytecodes

public void setBytecodes(Bytecode[] bytecodes)
Sets the bytecodes for the operation.

Parameters:
bytecodes - the bytecodes to set

getBytecodes

public Bytecode[] getBytecodes()
Returns the bytecodes.

Returns:
The bytecodes, if any

getName

public java.lang.String getName()

Overrides:
getName in class Operation
See Also:
Operation.getName()

exec

public java.lang.Object exec(AbstractStackFrame frame,
                             org.eclipse.core.runtime.IProgressMonitor monitor)
Executes an operation.

Parameters:
frame - the frame for execution
monitor - the progress monitor
Returns:
the result

exec

public java.lang.Object exec(AbstractStackFrame frame)
Executes an operation.

Specified by:
exec in class Operation
Parameters:
frame - the frame for execution
Returns:
the result
See Also:
Operation.exec(org.eclipse.m2m.atl.engine.emfvm.lib.AbstractStackFrame)

getASM

public ASM getASM()

findMethod

protected static java.lang.reflect.Method findMethod(java.lang.Class<?> caller,
                                                     java.lang.String name,
                                                     java.lang.Class<?>[] argumentTypes)
Looks for a method into cache and metamodel.

Parameters:
caller - The class of the method
name - The method name
argumentTypes - The types of all arguments
Returns:
the method if found, null otherwise

getInstructions

public java.util.List<?> getInstructions()

Overrides:
getInstructions in class Operation
See Also:
Operation.getInstructions()

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

Copyright 2007 IBM Corporation and others.
All Rights Reserved.