com.bea.jvm
Interface CompilationSystem

All Superinterfaces:
Describable, JVMComponent

public interface CompilationSystem
extends JVMComponent

Interface to the compilation (machine code generation) unit of the JVM.

Author:
Calle Wilund
, Marcus Hirt

Method Summary
 void addCompilationListener(CompilationListener listener)
          Adds a listener to recieve notification when a method is compiled.
 boolean forceCompilation(java.lang.reflect.Constructor constructor)
          Force the compiler to generate code for the specified Constructor using the default OptimizationLevel.
 boolean forceCompilation(java.lang.reflect.Constructor constructor, OptimizationLevel optLevel)
          Forces the compiler to generate code for the specified constructor using the specified OptimizationLevel.
 boolean forceCompilation(java.lang.reflect.Method method)
          Force the compiler to generate code for this method using the default OptimizationLevel.
 boolean forceCompilation(java.lang.reflect.Method method, OptimizationLevel optLevel)
          Forces the compiler to generate code for this method using the specified OptimizationLevel.
 OptimizationLevel getOptimizationLevel(java.lang.reflect.Constructor constructor)
          Returns the OptimizationLevel for a Constructor.
 OptimizationLevel getOptimizationLevel(java.lang.reflect.Method method)
          Returns the OptimizationLevel for a Method.
 java.util.List getOptimizationLevels()
          Returns a List of the available OptimizationLevels in this CompilationSystem, in ascending order, i.e. starting with the lowest level (unoptimized), followed by increasing optimization levels.
 boolean isCompiled(java.lang.reflect.Constructor constructor)
          Returns boolean true if the Constructor is compiled, false otherwise.
 boolean isCompiled(java.lang.reflect.Method method)
          Returns boolean true if the Method is compiled, false otherwise.
 boolean isOptimized(java.lang.reflect.Constructor constructor)
          Returns boolean true if the Method is optimized, i.e. has an optimization level higher than the lowest available one.
 boolean isOptimized(java.lang.reflect.Method method)
          Returns boolean true if the Method is optimized, i.e. has an optimization level higher than the lowest available one.
 void redefineMethod(java.lang.reflect.Method method, byte[] buffer, int offset, int length)
          Redefines the specified method.
 void removeCompilationListener(CompilationListener listener)
          Removes a listener which recieves notification when a method is compiled.
 
Methods inherited from interface com.bea.jvm.Describable
getDescription
 

Method Detail

getOptimizationLevels

public java.util.List getOptimizationLevels()
                                     throws NotAvailableException
Returns a List of the available OptimizationLevels in this CompilationSystem, in ascending order, i.e. starting with the lowest level (unoptimized), followed by increasing optimization levels.

Returns:
see above.
Throws:
NotAvailableException - if this functionality isn't available in this JVM.
See Also:
OptimizationLevel

isCompiled

public boolean isCompiled(java.lang.reflect.Method method)
                   throws NotAvailableException
Returns boolean true if the Method is compiled, false otherwise.

Parameters:
method - the method to check.
Returns:
see above.
Throws:
NotAvailableException - if this functionality isn't available in this JVM.

isCompiled

public boolean isCompiled(java.lang.reflect.Constructor constructor)
                   throws NotAvailableException
Returns boolean true if the Constructor is compiled, false otherwise.

Parameters:
constructor - the constructor to check.
Returns:
see above.
Throws:
NotAvailableException - if this functionality isn't available in this JVM.

isOptimized

public boolean isOptimized(java.lang.reflect.Method method)
                    throws NotAvailableException
Returns boolean true if the Method is optimized, i.e. has an optimization level higher than the lowest available one. This method throws a NullPointerException if the argument is null.

Parameters:
method - the Method to check.
Returns:
see above.
Throws:
NotAvailableException - if this functionality isn't available in this JVM.

isOptimized

public boolean isOptimized(java.lang.reflect.Constructor constructor)
                    throws NotAvailableException
Returns boolean true if the Method is optimized, i.e. has an optimization level higher than the lowest available one. This method throws a NullPointerException if the argument is null.

Parameters:
constructor - the Constructor to check.
Returns:
see above.
Throws:
NotAvailableException - if this functionality isn't available in this JVM.

getOptimizationLevel

public OptimizationLevel getOptimizationLevel(java.lang.reflect.Method method)
                                       throws NotAvailableException
Returns the OptimizationLevel for a Method. This method throws a NullPointerException if the argument is null.

Parameters:
method - the Method for which to return the optimization level.
Returns:
see above.
Throws:
NotAvailableException - if this functionality isn't available in this JVM.
See Also:
OptimizationLevel

getOptimizationLevel

public OptimizationLevel getOptimizationLevel(java.lang.reflect.Constructor constructor)
                                       throws NotAvailableException
Returns the OptimizationLevel for a Constructor. This method throws a NullPointerException if the argument is null.

Parameters:
constructor - the Constructor for which to return the optimization level.
Returns:
see above.
Throws:
NotAvailableException - if this functionality isn't available in this JVM.
See Also:
OptimizationLevel

forceCompilation

public boolean forceCompilation(java.lang.reflect.Method method)
                         throws NotAvailableException
Force the compiler to generate code for this method using the default OptimizationLevel. This method throws a NullPointerException if the argument is null.

Parameters:
method - the method to recompile.
Returns:
true if the method will be recompiled, false otherwise
Throws:
NotAvailableException - if this functionality isn't available in this JVM.

forceCompilation

public boolean forceCompilation(java.lang.reflect.Constructor constructor)
                         throws NotAvailableException
Force the compiler to generate code for the specified Constructor using the default OptimizationLevel. This method throws a NullPointerException if the argument is null.

Parameters:
constructor - the method to recompile.
Returns:
true if the method will be recompiled, false otherwise
Throws:
NotAvailableException - if this functionality isn't available in this JVM.

forceCompilation

public boolean forceCompilation(java.lang.reflect.Method method,
                                OptimizationLevel optLevel)
                         throws NotAvailableException
Forces the compiler to generate code for this method using the specified OptimizationLevel. This method throws a NullPointerException if one of the arguments is null.

Parameters:
method - the Method to recompile.
optLevel - the optimization level to use when recompiling.
Returns:
true if the method will be recompiled, false otherwise
Throws:
NotAvailableException - if this functionality isn't available in this JVM.

forceCompilation

public boolean forceCompilation(java.lang.reflect.Constructor constructor,
                                OptimizationLevel optLevel)
                         throws NotAvailableException
Forces the compiler to generate code for the specified constructor using the specified OptimizationLevel. This method throws a NullPointerException if one of the arguments is null.

Parameters:
constructor - the Constructor to recompile.
optLevel - the optimization level to use when recompiling.
Returns:
true if the method will be recompiled, false otherwise
Throws:
NotAvailableException - if this functionality isn't available in this JVM.

addCompilationListener

public void addCompilationListener(CompilationListener listener)
                            throws NotAvailableException
Adds a listener to recieve notification when a method is compiled. This method throws a NullPointerException if the argument is null.

Parameters:
listener - the listener to receive information about compiled methods.
Throws:
NotAvailableException - if this functionality isn't available in this JVM.

removeCompilationListener

public void removeCompilationListener(CompilationListener listener)
                               throws NotAvailableException
Removes a listener which recieves notification when a method is compiled. This method throws a NullPointerException if the argument is null.

Parameters:
listener - the listener to be removed.
Throws:
NotAvailableException - if this functionality isn't available in this JVM.

redefineMethod

public void redefineMethod(java.lang.reflect.Method method,
                           byte[] buffer,
                           int offset,
                           int length)
                    throws NotAvailableException
Redefines the specified method.

Parameters:
method - the method to be redefined.
buffer - the byte buffer containing the bytecode for the new version of the method.
offset - the offset to start reading from.
length - the length to read.
Throws:
NotAvailableException - if this functionality isn't available in this JVM. This exception is currently thrown by all JRockit versions.