public abstract class CompilationWrapper<T> extends Object
GraalCompilerOptions.CompilationBailoutAsFailure and
GraalCompilerOptions.CompilationFailureAction when an uncaught exception occurs during
compilation.| Modifier and Type | Class and Description |
|---|---|
static class |
CompilationWrapper.ExceptionAction
Actions to take upon an exception being raised during compilation performed via
CompilationWrapper. |
class |
CompilationWrapper.Failure
Call back for handling a compilation failure.
|
| Constructor and Description |
|---|
CompilationWrapper(DiagnosticsOutputDirectory outputDirectory,
Map<CompilationWrapper.ExceptionAction,Integer> problemsHandledPerAction) |
| Modifier and Type | Method and Description |
|---|---|
protected abstract DebugContext |
createRetryDebugContext(DebugContext initialDebug,
OptionValues options,
PrintStream logStream)
Creates the
DebugContext to use when retrying a compilation. |
protected abstract void |
exitHostVM(int status)
Calls
System.exit(int) in the runtime embedding the Graal compiler. |
protected abstract T |
handleException(Throwable t)
Handles an uncaught exception.
|
protected CompilationWrapper.ExceptionAction |
lookupAction(OptionValues options,
Throwable cause)
Gets the action to take based on the value of
GraalCompilerOptions.CompilationBailoutAsFailure,
GraalCompilerOptions.CompilationFailureAction and
GraalCompilerOptions.ExitVMOnException in options. |
protected T |
onCompilationFailure(CompilationWrapper.Failure failure)
Entry point for handling a compilation failure.
|
protected abstract T |
performCompilation(DebugContext debug)
Perform the compilation wrapped by this object.
|
T |
run(DebugContext initialDebug) |
abstract String |
toString()
Gets a value that represents the input to the compilation.
|
public CompilationWrapper(DiagnosticsOutputDirectory outputDirectory, Map<CompilationWrapper.ExceptionAction,Integer> problemsHandledPerAction)
outputDirectory - object used to access a directory for dumping if the compilation is
re-executedproblemsHandledPerAction - map used to count the number of compilation failures or
bailouts handled by each action. This is provided by the caller as it is expected
to be shared between instances of CompilationWrapper.protected abstract T handleException(Throwable t)
t - an exception thrown during CompilationWrapper.run(DebugContext)null)protected CompilationWrapper.ExceptionAction lookupAction(OptionValues options, Throwable cause)
GraalCompilerOptions.CompilationBailoutAsFailure,
GraalCompilerOptions.CompilationFailureAction and
GraalCompilerOptions.ExitVMOnException in options.
Subclasses can override this to choose a different action.cause - the cause of the bailout or failureprotected abstract T performCompilation(DebugContext debug)
debug - the debug context to use for the compilationpublic abstract String toString()
protected abstract DebugContext createRetryDebugContext(DebugContext initialDebug, OptionValues options, PrintStream logStream)
DebugContext to use when retrying a compilation.initialDebug - the debug context used in the failing compilationoptions - the options for configuring the debug contextlogStream - the log stream to use in the debug contextprotected T onCompilationFailure(CompilationWrapper.Failure failure)
failure.handle()public final T run(DebugContext initialDebug)
protected abstract void exitHostVM(int status)
System.exit(int) in the runtime embedding the Graal compiler. This will be a
different runtime than Graal's runtime in the case of libgraal.