Mercurial > hg > graal-compiler
changeset 22894:6bcd82f2b070
Factor out compilation exception handling logic
author | Tom Rodriguez <tom.rodriguez@oracle.com> |
---|---|
date | Tue, 27 Oct 2015 09:44:24 -0700 |
parents | afcdf0430946 |
children | 262d42eaa97b |
files | graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java |
diffstat | 1 files changed, 16 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java Tue Oct 27 14:09:17 2015 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java Tue Oct 27 09:44:24 2015 -0700 @@ -232,10 +232,6 @@ bailout.printStackTrace(TTY.out); } } catch (Throwable t) { - if (PrintStackTraceOnException.getValue() || ExitVMOnException.getValue()) { - t.printStackTrace(TTY.out); - } - // Log a failure event. CompilerFailureEvent event = eventProvider.newCompilerFailureEvent(); if (event.shouldWrite()) { @@ -244,9 +240,7 @@ event.commit(); } - if (ExitVMOnException.getValue()) { - System.exit(-1); - } + handleException(t); } finally { try { int compiledBytecodes = 0; @@ -284,17 +278,25 @@ codeCache.notifyCompilationStatistics(getId(), method, entryBCI != JVMCICompiler.INVOCATION_ENTRY_BCI, compiledBytecodes, compilationTime, timeUnitsPerSecond, installedCode); } } catch (Throwable t) { - // Don't allow exceptions during recording of statistics to leak out - if (PrintStackTraceOnException.getValue() || ExitVMOnException.getValue()) { - t.printStackTrace(TTY.out); - } - if (ExitVMOnException.getValue()) { - System.exit(-1); - } + handleException(t); } } } + protected void handleException(Throwable t) { + if (PrintStackTraceOnException.getValue() || ExitVMOnException.getValue()) { + try { + t.printStackTrace(TTY.out); + } catch (Throwable throwable) { + // Don't let an exception here change the other control flow + } + } + + if (ExitVMOnException.getValue()) { + System.exit(-1); + } + } + private String getMethodDescription() { HotSpotResolvedJavaMethod method = getMethod(); return String.format("%-6d JVMCI %-70s %-45s %-50s %s", getId(), method.getDeclaringClass().getName(), method.getName(), method.getSignature().toMethodDescriptor(),