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, CodeGenerationStrategy strategy)
          Forces the compiler to generate code for the specified constructor using the specified CodeGenerationStrategy.
 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, CodeGenerationStrategy strategy)
          Deprecated. Replaced. @see
 boolean forceCompilation(java.lang.reflect.Method method, OptimizationLevel optLevel)
          Deprecated. Replaced. @see
 java.util.List getCodeGenerationStrategies()
          Returns an immutable List of the available CodeGenerationStrategies available in this CompilationSystem, in ascending order, i.e. starting with the lowest level (quick), followed by increasingly advanced strategies.
 CodeGenerationStrategy getCodeGenerationStrategy(java.lang.reflect.Constructor constructor)
          Returns the CodeGenerationStrategy for a Constructor.
 CodeGenerationStrategy getCodeGenerationStrategy(java.lang.reflect.Method method)
          Returns the CodeGenerationStrategy that was used for generating the Method.
 OptimizationLevel getOptimizationLevel(java.lang.reflect.Constructor constructor)
          Deprecated. Replaced. @see CompilationSystem#getCodeGenerationStrategy(Constructor)
 OptimizationLevel getOptimizationLevel(java.lang.reflect.Method method)
          Deprecated. Replaced. @see CompilationSystem#getCodeGenerationStrategy(Method)
 java.util.List getOptimizationLevels()
          Deprecated. Replaced by getCodeGenerationStrategies().
 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 constructor is optimized, i.e. has been generated using the optimizing code generation strategy.
 boolean isOptimized(java.lang.reflect.Method method)
          Returns boolean true if the method is optimized, i.e. has been generated using the optimizing code generation strategy.
 boolean isOptimizing()
          This method returns boolean false if optimization is turned off (i.e.
 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.
 void setOptimizing(boolean optimize)
          This method will turn on or off optimizations.
 
Methods inherited from interface com.bea.jvm.Describable
getDescription
 

Method Detail

getOptimizationLevels

public java.util.List getOptimizationLevels()
                                     throws NotAvailableException
Deprecated. Replaced by getCodeGenerationStrategies().

Returns an immutable 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

getCodeGenerationStrategies

public java.util.List getCodeGenerationStrategies()
                                           throws NotAvailableException
Returns an immutable List of the available CodeGenerationStrategies available in this CompilationSystem, in ascending order, i.e. starting with the lowest level (quick), followed by increasingly advanced strategies.

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

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 been generated using the optimizing code generation strategy. 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.

isOptimizing

public boolean isOptimizing()
                     throws NotAvailableException
This method returns boolean false if optimization is turned off (i.e. the hostspot detector is no longer enqueuing methods for optimization). It will return true if optimization is turned on.

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

setOptimizing

public void setOptimizing(boolean optimize)
                   throws NotAvailableException
This method will turn on or off optimizations. If turned off, the hotspot detector will no longer enqueue methods for optimization. If it is already turned off, the request will be ignored. If turned on, the hotspot detector will look for and enqueue methods for optimization. If it is already turned on the request will be ignored.

Parameters:
optimize - if true the hotspot detector will be allowed to enqueue methods for optimization. If false, the hotspot detector will cease to enqueue methods for optimization.
Throws:
NotAvailableException

isOptimized

public boolean isOptimized(java.lang.reflect.Constructor constructor)
                    throws NotAvailableException
Returns boolean true if the constructor is optimized, i.e. has been generated using the optimizing code generation strategy. 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
Deprecated. Replaced. @see CompilationSystem#getCodeGenerationStrategy(Method)

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

getCodeGenerationStrategy

public CodeGenerationStrategy getCodeGenerationStrategy(java.lang.reflect.Method method)
                                                 throws NotAvailableException
Returns the CodeGenerationStrategy that was used for generating the Method. This method throws a NullPointerException if the argument is null. If this method is invoked on a method that has not been compiled yet, the result is the strategy that would be used if the method was to be compiled right now.

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

getOptimizationLevel

public OptimizationLevel getOptimizationLevel(java.lang.reflect.Constructor constructor)
                                       throws NotAvailableException
Deprecated. Replaced. @see CompilationSystem#getCodeGenerationStrategy(Constructor)

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

getCodeGenerationStrategy

public CodeGenerationStrategy getCodeGenerationStrategy(java.lang.reflect.Constructor constructor)
                                                 throws NotAvailableException
Returns the CodeGenerationStrategy for a Constructor. This method throws a NullPointerException if the argument is null. If this method is invoked on a constructor that has not been compiled yet, the result is the strategy that would be used if the method was to be compiled right now.

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

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
Deprecated. Replaced. @see

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.Method method,
                                CodeGenerationStrategy strategy)
                         throws NotAvailableException
Deprecated. Replaced. @see

Forces the compiler to generate code for this method using the specified CodeGenerationStrategy. This method throws a NullPointerException if one of the arguments is null.

Parameters:
method - the method to recompile.
strategy - the code generation strategy 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.

forceCompilation

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

Parameters:
constructor - the Constructor to recompile.
strategy - the code generation strategy 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.