Mercurial > hg > graal-compiler
annotate graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/PrintStreamOption.java @ 21554:b1530a6cce8c
renamed com.oracle.graal.[debug|options|hotspotvmconfig]* modules to com.oracle.jvmci.[debug|options|hotspotvmconfig]* modules (JBS:GRAAL-53)
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Tue, 26 May 2015 23:21:15 +0200 |
parents | 9579a3c62a9e |
children | f5b549811bac |
rev | line source |
---|---|
16008
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1 /* |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
4 * |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
8 * |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
14 * |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
18 * |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
21 * questions. |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
22 */ |
21552
9579a3c62a9e
use skeleton findbugs jar containing only SuppresFBWarnings to avoid external dependency for JVMCI classes (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21526
diff
changeset
|
23 package com.oracle.jvmci.hotspot; |
16008
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
24 |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
25 import java.io.*; |
16128
66e3fc56e85f
support adding pid to LogFile name
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16008
diff
changeset
|
26 import java.lang.management.*; |
16008
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
27 |
21554
b1530a6cce8c
renamed com.oracle.graal.[debug|options|hotspotvmconfig]* modules to com.oracle.jvmci.[debug|options|hotspotvmconfig]* modules (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21552
diff
changeset
|
28 import com.oracle.jvmci.options.*; |
b1530a6cce8c
renamed com.oracle.graal.[debug|options|hotspotvmconfig]* modules to com.oracle.jvmci.[debug|options|hotspotvmconfig]* modules (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21552
diff
changeset
|
29 |
16008
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
30 |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
31 /** |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
32 * An option that encapsulates and configures a print stream. |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
33 */ |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
34 public class PrintStreamOption extends OptionValue<String> { |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
35 |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
36 public PrintStreamOption() { |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
37 super(null); |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
38 } |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
39 |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
40 /** |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
41 * The print stream to which output will be written. |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
42 * |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
43 * Declared {@code volatile} to enable safe use of double-checked locking in |
16405
9bfc4247262f
send log output to native tty
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16128
diff
changeset
|
44 * {@link #getStream(CompilerToVM)} and {@link #setValue(Object)}. |
16008
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
45 */ |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
46 private volatile PrintStream ps; |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
47 |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
48 /** |
16128
66e3fc56e85f
support adding pid to LogFile name
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16008
diff
changeset
|
49 * Replace any instance of %p with a an identifying name. Try to get it from the RuntimeMXBean |
66e3fc56e85f
support adding pid to LogFile name
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16008
diff
changeset
|
50 * name. |
16405
9bfc4247262f
send log output to native tty
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16128
diff
changeset
|
51 * |
16128
66e3fc56e85f
support adding pid to LogFile name
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16008
diff
changeset
|
52 * @return the name of the file to log to |
66e3fc56e85f
support adding pid to LogFile name
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16008
diff
changeset
|
53 */ |
66e3fc56e85f
support adding pid to LogFile name
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16008
diff
changeset
|
54 private String getFilename() { |
66e3fc56e85f
support adding pid to LogFile name
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16008
diff
changeset
|
55 String name = getValue(); |
66e3fc56e85f
support adding pid to LogFile name
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16008
diff
changeset
|
56 if (name.contains("%p")) { |
66e3fc56e85f
support adding pid to LogFile name
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16008
diff
changeset
|
57 String runtimeName = ManagementFactory.getRuntimeMXBean().getName(); |
66e3fc56e85f
support adding pid to LogFile name
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16008
diff
changeset
|
58 try { |
66e3fc56e85f
support adding pid to LogFile name
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16008
diff
changeset
|
59 int index = runtimeName.indexOf('@'); |
66e3fc56e85f
support adding pid to LogFile name
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16008
diff
changeset
|
60 if (index != -1) { |
66e3fc56e85f
support adding pid to LogFile name
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16008
diff
changeset
|
61 long pid = Long.parseLong(runtimeName.substring(0, index)); |
66e3fc56e85f
support adding pid to LogFile name
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16008
diff
changeset
|
62 runtimeName = Long.toString(pid); |
66e3fc56e85f
support adding pid to LogFile name
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16008
diff
changeset
|
63 } |
66e3fc56e85f
support adding pid to LogFile name
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16008
diff
changeset
|
64 name = name.replaceAll("%p", runtimeName); |
66e3fc56e85f
support adding pid to LogFile name
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16008
diff
changeset
|
65 } catch (NumberFormatException e) { |
66e3fc56e85f
support adding pid to LogFile name
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16008
diff
changeset
|
66 |
66e3fc56e85f
support adding pid to LogFile name
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16008
diff
changeset
|
67 } |
66e3fc56e85f
support adding pid to LogFile name
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16008
diff
changeset
|
68 } |
66e3fc56e85f
support adding pid to LogFile name
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16008
diff
changeset
|
69 return name; |
66e3fc56e85f
support adding pid to LogFile name
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16008
diff
changeset
|
70 } |
66e3fc56e85f
support adding pid to LogFile name
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16008
diff
changeset
|
71 |
66e3fc56e85f
support adding pid to LogFile name
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16008
diff
changeset
|
72 /** |
16405
9bfc4247262f
send log output to native tty
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16128
diff
changeset
|
73 * Gets the print stream configured by this option. If no file is configured, the print stream |
9bfc4247262f
send log output to native tty
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16128
diff
changeset
|
74 * will output to {@link CompilerToVM#writeDebugOutput(byte[], int, int)}. |
16008
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
75 */ |
16405
9bfc4247262f
send log output to native tty
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16128
diff
changeset
|
76 public PrintStream getStream(final CompilerToVM compilerToVM) { |
16008
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
77 if (ps == null) { |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
78 if (getValue() != null) { |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
79 synchronized (this) { |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
80 if (ps == null) { |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
81 try { |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
82 final boolean enableAutoflush = true; |
16128
66e3fc56e85f
support adding pid to LogFile name
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16008
diff
changeset
|
83 ps = new PrintStream(new FileOutputStream(getFilename()), enableAutoflush); |
18947
7186feb0d971
Add Java and JVM arguments to log file when -G:LogFile= is used
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18163
diff
changeset
|
84 /* Add the JVM and Java arguments to the log file to help identity it. */ |
7186feb0d971
Add Java and JVM arguments to log file when -G:LogFile= is used
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18163
diff
changeset
|
85 String inputArguments = String.join(" ", ManagementFactory.getRuntimeMXBean().getInputArguments()); |
7186feb0d971
Add Java and JVM arguments to log file when -G:LogFile= is used
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18163
diff
changeset
|
86 ps.println("VM Arguments: " + inputArguments); |
7186feb0d971
Add Java and JVM arguments to log file when -G:LogFile= is used
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18163
diff
changeset
|
87 String cmd = System.getProperty("sun.java.command"); |
7186feb0d971
Add Java and JVM arguments to log file when -G:LogFile= is used
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18163
diff
changeset
|
88 if (cmd != null) { |
7186feb0d971
Add Java and JVM arguments to log file when -G:LogFile= is used
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18163
diff
changeset
|
89 ps.println("sun.java.command=" + cmd); |
7186feb0d971
Add Java and JVM arguments to log file when -G:LogFile= is used
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18163
diff
changeset
|
90 } |
16008
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
91 } catch (FileNotFoundException e) { |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
92 throw new RuntimeException("couldn't open file: " + getValue(), e); |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
93 } |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
94 } |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
95 } |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
96 } else { |
16405
9bfc4247262f
send log output to native tty
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16128
diff
changeset
|
97 OutputStream ttyOut = new OutputStream() { |
9bfc4247262f
send log output to native tty
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16128
diff
changeset
|
98 @Override |
9bfc4247262f
send log output to native tty
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16128
diff
changeset
|
99 public void write(byte[] b, int off, int len) throws IOException { |
9bfc4247262f
send log output to native tty
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16128
diff
changeset
|
100 if (b == null) { |
9bfc4247262f
send log output to native tty
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16128
diff
changeset
|
101 throw new NullPointerException(); |
9bfc4247262f
send log output to native tty
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16128
diff
changeset
|
102 } else if (off < 0 || off > b.length || len < 0 || (off + len) > b.length || (off + len) < 0) { |
9bfc4247262f
send log output to native tty
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16128
diff
changeset
|
103 throw new IndexOutOfBoundsException(); |
9bfc4247262f
send log output to native tty
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16128
diff
changeset
|
104 } else if (len == 0) { |
9bfc4247262f
send log output to native tty
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16128
diff
changeset
|
105 return; |
9bfc4247262f
send log output to native tty
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16128
diff
changeset
|
106 } |
9bfc4247262f
send log output to native tty
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16128
diff
changeset
|
107 compilerToVM.writeDebugOutput(b, off, len); |
9bfc4247262f
send log output to native tty
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16128
diff
changeset
|
108 } |
9bfc4247262f
send log output to native tty
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16128
diff
changeset
|
109 |
9bfc4247262f
send log output to native tty
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16128
diff
changeset
|
110 @Override |
9bfc4247262f
send log output to native tty
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16128
diff
changeset
|
111 public void write(int b) throws IOException { |
9bfc4247262f
send log output to native tty
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16128
diff
changeset
|
112 write(new byte[]{(byte) b}, 0, 1); |
9bfc4247262f
send log output to native tty
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16128
diff
changeset
|
113 } |
21119
294ed4ce1fa0
PrintStreamOption: also forward flushes to the VM
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
18947
diff
changeset
|
114 |
294ed4ce1fa0
PrintStreamOption: also forward flushes to the VM
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
18947
diff
changeset
|
115 @Override |
294ed4ce1fa0
PrintStreamOption: also forward flushes to the VM
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
18947
diff
changeset
|
116 public void flush() throws IOException { |
294ed4ce1fa0
PrintStreamOption: also forward flushes to the VM
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
18947
diff
changeset
|
117 compilerToVM.flushDebugOutput(); |
294ed4ce1fa0
PrintStreamOption: also forward flushes to the VM
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
18947
diff
changeset
|
118 } |
16405
9bfc4247262f
send log output to native tty
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16128
diff
changeset
|
119 }; |
9bfc4247262f
send log output to native tty
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16128
diff
changeset
|
120 ps = new PrintStream(ttyOut); |
16008
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
121 } |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
122 } |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
123 return ps; |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
124 } |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
125 |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
126 @Override |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
127 public void setValue(Object v) { |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
128 if (ps != null) { |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
129 synchronized (this) { |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
130 if (ps != null) { |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
131 ps.close(); |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
132 ps = null; |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
133 } |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
134 } |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
135 } |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
136 super.setValue(v); |
76f40e11c820
refactored HotSpotGraalRuntime.LogFileOption to PrintStreamOption to workaround a javac bug as well as to clarify its design
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
137 } |
18163
c88ab4f1f04a
re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents:
16405
diff
changeset
|
138 } |